Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
28797374
T
Third Party Openssl
项目概览
OpenHarmony
/
Third Party Openssl
1 年多 前同步成功
通知
10
Star
18
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Openssl
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
28797374
编写于
10月 22, 2001
作者:
B
Bodo Möller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix memory leak.
上级
f1558bb4
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
24 addition
and
14 deletion
+24
-14
ssl/s3_enc.c
ssl/s3_enc.c
+9
-6
ssl/t1_enc.c
ssl/t1_enc.c
+15
-8
未找到文件。
ssl/s3_enc.c
浏览文件 @
28797374
...
...
@@ -147,6 +147,7 @@ int ssl3_change_cipher_state(SSL *s, int which)
const
EVP_MD
*
m
;
EVP_MD_CTX
md
;
int
exp
,
n
,
i
,
j
,
k
,
cl
;
int
reuse_dd
=
0
;
exp
=
SSL_C_IS_EXPORT
(
s
->
s3
->
tmp
.
new_cipher
);
c
=
s
->
s3
->
tmp
.
new_sym_enc
;
...
...
@@ -159,9 +160,9 @@ int ssl3_change_cipher_state(SSL *s, int which)
if
(
which
&
SSL3_CC_READ
)
{
if
(
(
s
->
enc_read_ctx
==
NULL
)
&&
((
s
->
enc_read_ctx
=
(
EVP_CIPHER_CTX
*
)
OPENSSL_malloc
(
sizeof
(
EVP_CIPHER_CTX
)))
==
NULL
)
)
if
(
s
->
enc_read_ctx
!=
NULL
)
reuse_dd
=
1
;
else
if
((
s
->
enc_read_ctx
=
OPENSSL_malloc
(
sizeof
(
EVP_CIPHER_CTX
)))
==
NULL
)
goto
err
;
dd
=
s
->
enc_read_ctx
;
s
->
read_hash
=
m
;
...
...
@@ -190,9 +191,9 @@ int ssl3_change_cipher_state(SSL *s, int which)
}
else
{
if
(
(
s
->
enc_write_ctx
==
NULL
)
&&
((
s
->
enc_write_ctx
=
(
EVP_CIPHER_CTX
*
)
OPENSSL_malloc
(
sizeof
(
EVP_CIPHER_CTX
)))
==
NULL
)
)
if
(
s
->
enc_write_ctx
!=
NULL
)
reuse_dd
=
1
;
else
if
((
s
->
enc_write_ctx
=
OPENSSL_malloc
(
sizeof
(
EVP_CIPHER_CTX
)))
==
NULL
)
goto
err
;
dd
=
s
->
enc_write_ctx
;
s
->
write_hash
=
m
;
...
...
@@ -215,6 +216,8 @@ int ssl3_change_cipher_state(SSL *s, int which)
mac_secret
=
&
(
s
->
s3
->
write_mac_secret
[
0
]);
}
if
(
reuse_dd
)
EVP_CIPHER_CTX_cleanup
(
dd
);
EVP_CIPHER_CTX_init
(
dd
);
p
=
s
->
s3
->
tmp
.
key_block
;
...
...
ssl/t1_enc.c
浏览文件 @
28797374
...
...
@@ -180,9 +180,10 @@ int tls1_change_cipher_state(SSL *s, int which)
const
EVP_CIPHER
*
c
;
const
SSL_COMP
*
comp
;
const
EVP_MD
*
m
;
int
_exp
,
n
,
i
,
j
,
k
,
exp_label_len
,
cl
;
int
is_export
,
n
,
i
,
j
,
k
,
exp_label_len
,
cl
;
int
reuse_dd
=
0
;
_exp
=
SSL_C_IS_EXPORT
(
s
->
s3
->
tmp
.
new_cipher
);
is_export
=
SSL_C_IS_EXPORT
(
s
->
s3
->
tmp
.
new_cipher
);
c
=
s
->
s3
->
tmp
.
new_sym_enc
;
m
=
s
->
s3
->
tmp
.
new_hash
;
comp
=
s
->
s3
->
tmp
.
new_compression
;
...
...
@@ -205,9 +206,9 @@ int tls1_change_cipher_state(SSL *s, int which)
if
(
which
&
SSL3_CC_READ
)
{
if
(
(
s
->
enc_read_ctx
==
NULL
)
&&
((
s
->
enc_read_ctx
=
(
EVP_CIPHER_CTX
*
)
OPENSSL_malloc
(
sizeof
(
EVP_CIPHER_CTX
)))
==
NULL
)
)
if
(
s
->
enc_read_ctx
!=
NULL
)
reuse_dd
=
1
;
else
if
((
s
->
enc_read_ctx
=
OPENSSL_malloc
(
sizeof
(
EVP_CIPHER_CTX
)))
==
NULL
)
goto
err
;
dd
=
s
->
enc_read_ctx
;
s
->
read_hash
=
m
;
...
...
@@ -235,6 +236,10 @@ int tls1_change_cipher_state(SSL *s, int which)
}
else
{
if
(
s
->
enc_write_ctx
!=
NULL
)
reuse_dd
=
1
;
else
if
((
s
->
enc_write_ctx
=
OPENSSL_malloc
(
sizeof
(
EVP_CIPHER_CTX
)))
==
NULL
)
goto
err
;
if
((
s
->
enc_write_ctx
==
NULL
)
&&
((
s
->
enc_write_ctx
=
(
EVP_CIPHER_CTX
*
)
OPENSSL_malloc
(
sizeof
(
EVP_CIPHER_CTX
)))
==
NULL
))
...
...
@@ -259,13 +264,15 @@ int tls1_change_cipher_state(SSL *s, int which)
mac_secret
=
&
(
s
->
s3
->
write_mac_secret
[
0
]);
}
if
(
reuse_dd
)
EVP_CIPHER_CTX_cleanup
(
dd
);
EVP_CIPHER_CTX_init
(
dd
);
p
=
s
->
s3
->
tmp
.
key_block
;
i
=
EVP_MD_size
(
m
);
cl
=
EVP_CIPHER_key_length
(
c
);
j
=
_exp
?
(
cl
<
SSL_C_EXPORT_KEYLENGTH
(
s
->
s3
->
tmp
.
new_cipher
)
?
cl
:
SSL_C_EXPORT_KEYLENGTH
(
s
->
s3
->
tmp
.
new_cipher
))
:
cl
;
j
=
is_export
?
(
cl
<
SSL_C_EXPORT_KEYLENGTH
(
s
->
s3
->
tmp
.
new_cipher
)
?
cl
:
SSL_C_EXPORT_KEYLENGTH
(
s
->
s3
->
tmp
.
new_cipher
))
:
cl
;
/* Was j=(exp)?5:EVP_CIPHER_key_length(c); */
k
=
EVP_CIPHER_iv_length
(
c
);
er1
=
&
(
s
->
s3
->
client_random
[
0
]);
...
...
@@ -302,7 +309,7 @@ int tls1_change_cipher_state(SSL *s, int which)
printf
(
"which = %04X
\n
mac key="
,
which
);
{
int
z
;
for
(
z
=
0
;
z
<
i
;
z
++
)
printf
(
"%02X%c"
,
ms
[
z
],((
z
+
1
)
%
16
)
?
' '
:
'\n'
);
}
#endif
if
(
_exp
)
if
(
is_export
)
{
/* In here I set both the read and write key/iv to the
* same value since only the correct one will be used :-).
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录