Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
btwise
openssl
提交
15780a1e
O
openssl
项目概览
btwise
/
openssl
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
openssl
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
15780a1e
编写于
2月 10, 2007
作者:
N
Nils Larsch
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
use user-supplied malloc functions for persistent kssl objects
PR: 1467 Submitted by: Andrei Pelinescu-Onciul <andrei@iptel.org>
上级
92ada7cc
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
33 addition
and
14 deletion
+33
-14
ssl/kssl.c
ssl/kssl.c
+32
-13
ssl/ssl_sess.c
ssl/ssl_sess.c
+1
-1
未找到文件。
ssl/kssl.c
浏览文件 @
15780a1e
...
...
@@ -784,6 +784,25 @@ kssl_krb5_kt_get_entry(krb5_context context, krb5_keytab keytab,
}
#endif
/* OPENSSL_SYS_WINDOWS || OPENSSL_SYS_WIN32 */
/* memory allocation functions for non-temporary storage
* (e.g. stuff that gets saved into the kssl context) */
static
void
*
kssl_calloc
(
size_t
nmemb
,
size_t
size
)
{
void
*
p
;
p
=
OPENSSL_malloc
(
nmemb
*
size
);
if
(
p
){
memset
(
p
,
0
,
nmemb
*
size
);
}
return
p
;
}
#define kssl_malloc(size) OPENSSL_malloc((size))
#define kssl_realloc(ptr, size) OPENSSL_realloc(ptr, size)
#define kssl_free(ptr) OPENSSL_free((ptr))
char
*
kstring
(
char
*
string
)
{
...
...
@@ -1548,7 +1567,7 @@ kssl_sget_tkt( /* UPDATE */ KSSL_CTX *kssl_ctx,
KSSL_CTX
*
kssl_ctx_new
(
void
)
{
return
((
KSSL_CTX
*
)
calloc
(
1
,
sizeof
(
KSSL_CTX
)));
return
((
KSSL_CTX
*
)
kssl_
calloc
(
1
,
sizeof
(
KSSL_CTX
)));
}
...
...
@@ -1562,13 +1581,13 @@ kssl_ctx_free(KSSL_CTX *kssl_ctx)
if
(
kssl_ctx
->
key
)
OPENSSL_cleanse
(
kssl_ctx
->
key
,
kssl_ctx
->
length
);
if
(
kssl_ctx
->
key
)
free
(
kssl_ctx
->
key
);
if
(
kssl_ctx
->
client_princ
)
free
(
kssl_ctx
->
client_princ
);
if
(
kssl_ctx
->
service_host
)
free
(
kssl_ctx
->
service_host
);
if
(
kssl_ctx
->
service_name
)
free
(
kssl_ctx
->
service_name
);
if
(
kssl_ctx
->
keytab_file
)
free
(
kssl_ctx
->
keytab_file
);
if
(
kssl_ctx
->
key
)
kssl_
free
(
kssl_ctx
->
key
);
if
(
kssl_ctx
->
client_princ
)
kssl_
free
(
kssl_ctx
->
client_princ
);
if
(
kssl_ctx
->
service_host
)
kssl_
free
(
kssl_ctx
->
service_host
);
if
(
kssl_ctx
->
service_name
)
kssl_
free
(
kssl_ctx
->
service_name
);
if
(
kssl_ctx
->
keytab_file
)
kssl_
free
(
kssl_ctx
->
keytab_file
);
free
(
kssl_ctx
);
kssl_
free
(
kssl_ctx
);
return
(
KSSL_CTX
*
)
NULL
;
}
...
...
@@ -1593,7 +1612,7 @@ kssl_ctx_setprinc(KSSL_CTX *kssl_ctx, int which,
case
KSSL_SERVER
:
princ
=
&
kssl_ctx
->
service_host
;
break
;
default:
return
KSSL_CTX_ERR
;
break
;
}
if
(
*
princ
)
free
(
*
princ
);
if
(
*
princ
)
kssl_
free
(
*
princ
);
/* Add up all the entity->lengths */
length
=
0
;
...
...
@@ -1606,7 +1625,7 @@ kssl_ctx_setprinc(KSSL_CTX *kssl_ctx, int which,
/* Space for the ('@'+realm+NULL | NULL) */
length
+=
((
realm
)
?
realm
->
length
+
2
:
1
);
if
((
*
princ
=
calloc
(
1
,
length
))
==
NULL
)
if
((
*
princ
=
kssl_
calloc
(
1
,
length
))
==
NULL
)
return
KSSL_CTX_ERR
;
else
{
...
...
@@ -1649,7 +1668,7 @@ kssl_ctx_setstring(KSSL_CTX *kssl_ctx, int which, char *text)
case
KSSL_KEYTAB
:
string
=
&
kssl_ctx
->
keytab_file
;
break
;
default:
return
KSSL_CTX_ERR
;
break
;
}
if
(
*
string
)
free
(
*
string
);
if
(
*
string
)
kssl_
free
(
*
string
);
if
(
!
text
)
{
...
...
@@ -1657,7 +1676,7 @@ kssl_ctx_setstring(KSSL_CTX *kssl_ctx, int which, char *text)
return
KSSL_CTX_OK
;
}
if
((
*
string
=
calloc
(
1
,
strlen
(
text
)
+
1
))
==
NULL
)
if
((
*
string
=
kssl_
calloc
(
1
,
strlen
(
text
)
+
1
))
==
NULL
)
return
KSSL_CTX_ERR
;
else
strcpy
(
*
string
,
text
);
...
...
@@ -1681,7 +1700,7 @@ kssl_ctx_setkey(KSSL_CTX *kssl_ctx, krb5_keyblock *session)
if
(
kssl_ctx
->
key
)
{
OPENSSL_cleanse
(
kssl_ctx
->
key
,
kssl_ctx
->
length
);
free
(
kssl_ctx
->
key
);
kssl_
free
(
kssl_ctx
->
key
);
}
if
(
session
)
...
...
@@ -1707,7 +1726,7 @@ kssl_ctx_setkey(KSSL_CTX *kssl_ctx, krb5_keyblock *session)
}
if
((
kssl_ctx
->
key
=
(
krb5_octet
FAR
*
)
calloc
(
1
,
kssl_ctx
->
length
))
==
NULL
)
(
krb5_octet
FAR
*
)
kssl_
calloc
(
1
,
kssl_ctx
->
length
))
==
NULL
)
{
kssl_ctx
->
length
=
0
;
return
KSSL_CTX_ERR
;
...
...
ssl/ssl_sess.c
浏览文件 @
15780a1e
...
...
@@ -723,7 +723,7 @@ int SSL_set_session(SSL *s, SSL_SESSION *session)
if
(
s
->
kssl_ctx
&&
!
s
->
kssl_ctx
->
client_princ
&&
session
->
krb5_client_princ_len
>
0
)
{
s
->
kssl_ctx
->
client_princ
=
(
char
*
)
malloc
(
session
->
krb5_client_princ_len
+
1
);
s
->
kssl_ctx
->
client_princ
=
(
char
*
)
OPENSSL_
malloc
(
session
->
krb5_client_princ_len
+
1
);
memcpy
(
s
->
kssl_ctx
->
client_princ
,
session
->
krb5_client_princ
,
session
->
krb5_client_princ_len
);
s
->
kssl_ctx
->
client_princ
[
session
->
krb5_client_princ_len
]
=
'\0'
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录