Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
76042020
T
Third Party Openssl
项目概览
OpenHarmony
/
Third Party Openssl
大约 1 年 前同步成功
通知
9
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
76042020
编写于
2月 01, 2015
作者:
M
Matt Caswell
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move SSL3_BUFFER set up and release code into ssl3_buffer.c
Reviewed-by:
N
Richard Levitte
<
levitte@openssl.org
>
上级
4e08d4a8
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
121 addition
and
122 deletion
+121
-122
ssl/record/ssl3_buffer.c
ssl/record/ssl3_buffer.c
+116
-0
ssl/record/ssl3_buffer.h
ssl/record/ssl3_buffer.h
+5
-1
ssl/s3_both.c
ssl/s3_both.c
+0
-116
ssl/ssl_locl.h
ssl/ssl_locl.h
+0
-5
未找到文件。
ssl/record/ssl3_buffer.c
浏览文件 @
76042020
...
...
@@ -125,3 +125,119 @@ void SSL3_BUFFER_release(SSL3_BUFFER *b)
OPENSSL_free
(
b
->
buf
);
b
->
buf
=
NULL
;
}
int
ssl3_setup_read_buffer
(
SSL
*
s
)
{
unsigned
char
*
p
;
size_t
len
,
align
=
0
,
headerlen
;
SSL3_BUFFER
*
b
;
b
=
RECORD_LAYER_get_rbuf
(
&
s
->
rlayer
);
if
(
SSL_version
(
s
)
==
DTLS1_VERSION
||
SSL_version
(
s
)
==
DTLS1_BAD_VER
)
headerlen
=
DTLS1_RT_HEADER_LENGTH
;
else
headerlen
=
SSL3_RT_HEADER_LENGTH
;
#if defined(SSL3_ALIGN_PAYLOAD) && SSL3_ALIGN_PAYLOAD!=0
align
=
(
-
SSL3_RT_HEADER_LENGTH
)
&
(
SSL3_ALIGN_PAYLOAD
-
1
);
#endif
if
(
b
->
buf
==
NULL
)
{
len
=
SSL3_RT_MAX_PLAIN_LENGTH
+
SSL3_RT_MAX_ENCRYPTED_OVERHEAD
+
headerlen
+
align
;
if
(
s
->
options
&
SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER
)
{
s
->
s3
->
init_extra
=
1
;
len
+=
SSL3_RT_MAX_EXTRA
;
}
#ifndef OPENSSL_NO_COMP
if
(
ssl_allow_compression
(
s
))
len
+=
SSL3_RT_MAX_COMPRESSED_OVERHEAD
;
#endif
if
((
p
=
OPENSSL_malloc
(
len
))
==
NULL
)
goto
err
;
b
->
buf
=
p
;
b
->
len
=
len
;
}
s
->
packet
=
&
(
b
->
buf
[
0
]);
return
1
;
err:
SSLerr
(
SSL_F_SSL3_SETUP_READ_BUFFER
,
ERR_R_MALLOC_FAILURE
);
return
0
;
}
int
ssl3_setup_write_buffer
(
SSL
*
s
)
{
unsigned
char
*
p
;
size_t
len
,
align
=
0
,
headerlen
;
SSL3_BUFFER
*
wb
;
wb
=
RECORD_LAYER_get_wbuf
(
&
s
->
rlayer
);
if
(
SSL_version
(
s
)
==
DTLS1_VERSION
||
SSL_version
(
s
)
==
DTLS1_BAD_VER
)
headerlen
=
DTLS1_RT_HEADER_LENGTH
+
1
;
else
headerlen
=
SSL3_RT_HEADER_LENGTH
;
#if defined(SSL3_ALIGN_PAYLOAD) && SSL3_ALIGN_PAYLOAD!=0
align
=
(
-
SSL3_RT_HEADER_LENGTH
)
&
(
SSL3_ALIGN_PAYLOAD
-
1
);
#endif
if
(
wb
->
buf
==
NULL
)
{
len
=
s
->
max_send_fragment
+
SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD
+
headerlen
+
align
;
#ifndef OPENSSL_NO_COMP
if
(
ssl_allow_compression
(
s
))
len
+=
SSL3_RT_MAX_COMPRESSED_OVERHEAD
;
#endif
if
(
!
(
s
->
options
&
SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS
))
len
+=
headerlen
+
align
+
SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD
;
if
((
p
=
OPENSSL_malloc
(
len
))
==
NULL
)
goto
err
;
wb
->
buf
=
p
;
wb
->
len
=
len
;
}
return
1
;
err:
SSLerr
(
SSL_F_SSL3_SETUP_WRITE_BUFFER
,
ERR_R_MALLOC_FAILURE
);
return
0
;
}
int
ssl3_setup_buffers
(
SSL
*
s
)
{
if
(
!
ssl3_setup_read_buffer
(
s
))
return
0
;
if
(
!
ssl3_setup_write_buffer
(
s
))
return
0
;
return
1
;
}
int
ssl3_release_write_buffer
(
SSL
*
s
)
{
SSL3_BUFFER
*
wb
;
wb
=
RECORD_LAYER_get_wbuf
(
&
s
->
rlayer
);
if
(
wb
->
buf
!=
NULL
)
{
OPENSSL_free
(
wb
->
buf
);
wb
->
buf
=
NULL
;
}
return
1
;
}
int
ssl3_release_read_buffer
(
SSL
*
s
)
{
SSL3_BUFFER
*
b
;
b
=
RECORD_LAYER_get_rbuf
(
&
s
->
rlayer
);
if
(
b
->
buf
!=
NULL
)
{
OPENSSL_free
(
b
->
buf
);
b
->
buf
=
NULL
;
}
return
1
;
}
ssl/record/ssl3_buffer.h
浏览文件 @
76042020
...
...
@@ -129,4 +129,8 @@ typedef struct ssl3_buffer_st {
void
SSL3_BUFFER_set_data
(
SSL3_BUFFER
*
b
,
unsigned
char
*
d
,
int
n
);
void
SSL3_BUFFER_release
(
SSL3_BUFFER
*
b
);
__owur
int
ssl3_setup_buffers
(
SSL
*
s
);
__owur
int
ssl3_setup_read_buffer
(
SSL
*
s
);
__owur
int
ssl3_setup_write_buffer
(
SSL
*
s
);
int
ssl3_release_read_buffer
(
SSL
*
s
);
int
ssl3_release_write_buffer
(
SSL
*
s
);
ssl/s3_both.c
浏览文件 @
76042020
...
...
@@ -573,122 +573,6 @@ int ssl_verify_alarm_type(long type)
return
(
al
);
}
int
ssl3_setup_read_buffer
(
SSL
*
s
)
{
unsigned
char
*
p
;
size_t
len
,
align
=
0
,
headerlen
;
SSL3_BUFFER
*
b
;
b
=
RECORD_LAYER_get_rbuf
(
&
s
->
rlayer
);
if
(
SSL_version
(
s
)
==
DTLS1_VERSION
||
SSL_version
(
s
)
==
DTLS1_BAD_VER
)
headerlen
=
DTLS1_RT_HEADER_LENGTH
;
else
headerlen
=
SSL3_RT_HEADER_LENGTH
;
#if defined(SSL3_ALIGN_PAYLOAD) && SSL3_ALIGN_PAYLOAD!=0
align
=
(
-
SSL3_RT_HEADER_LENGTH
)
&
(
SSL3_ALIGN_PAYLOAD
-
1
);
#endif
if
(
b
->
buf
==
NULL
)
{
len
=
SSL3_RT_MAX_PLAIN_LENGTH
+
SSL3_RT_MAX_ENCRYPTED_OVERHEAD
+
headerlen
+
align
;
if
(
s
->
options
&
SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER
)
{
s
->
s3
->
init_extra
=
1
;
len
+=
SSL3_RT_MAX_EXTRA
;
}
#ifndef OPENSSL_NO_COMP
if
(
ssl_allow_compression
(
s
))
len
+=
SSL3_RT_MAX_COMPRESSED_OVERHEAD
;
#endif
if
((
p
=
OPENSSL_malloc
(
len
))
==
NULL
)
goto
err
;
b
->
buf
=
p
;
b
->
len
=
len
;
}
s
->
packet
=
&
(
b
->
buf
[
0
]);
return
1
;
err:
SSLerr
(
SSL_F_SSL3_SETUP_READ_BUFFER
,
ERR_R_MALLOC_FAILURE
);
return
0
;
}
int
ssl3_setup_write_buffer
(
SSL
*
s
)
{
unsigned
char
*
p
;
size_t
len
,
align
=
0
,
headerlen
;
SSL3_BUFFER
*
wb
;
wb
=
RECORD_LAYER_get_wbuf
(
&
s
->
rlayer
);
if
(
SSL_version
(
s
)
==
DTLS1_VERSION
||
SSL_version
(
s
)
==
DTLS1_BAD_VER
)
headerlen
=
DTLS1_RT_HEADER_LENGTH
+
1
;
else
headerlen
=
SSL3_RT_HEADER_LENGTH
;
#if defined(SSL3_ALIGN_PAYLOAD) && SSL3_ALIGN_PAYLOAD!=0
align
=
(
-
SSL3_RT_HEADER_LENGTH
)
&
(
SSL3_ALIGN_PAYLOAD
-
1
);
#endif
if
(
wb
->
buf
==
NULL
)
{
len
=
s
->
max_send_fragment
+
SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD
+
headerlen
+
align
;
#ifndef OPENSSL_NO_COMP
if
(
ssl_allow_compression
(
s
))
len
+=
SSL3_RT_MAX_COMPRESSED_OVERHEAD
;
#endif
if
(
!
(
s
->
options
&
SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS
))
len
+=
headerlen
+
align
+
SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD
;
if
((
p
=
OPENSSL_malloc
(
len
))
==
NULL
)
goto
err
;
wb
->
buf
=
p
;
wb
->
len
=
len
;
}
return
1
;
err:
SSLerr
(
SSL_F_SSL3_SETUP_WRITE_BUFFER
,
ERR_R_MALLOC_FAILURE
);
return
0
;
}
int
ssl3_setup_buffers
(
SSL
*
s
)
{
if
(
!
ssl3_setup_read_buffer
(
s
))
return
0
;
if
(
!
ssl3_setup_write_buffer
(
s
))
return
0
;
return
1
;
}
int
ssl3_release_write_buffer
(
SSL
*
s
)
{
SSL3_BUFFER
*
wb
;
wb
=
RECORD_LAYER_get_wbuf
(
&
s
->
rlayer
);
if
(
wb
->
buf
!=
NULL
)
{
OPENSSL_free
(
wb
->
buf
);
wb
->
buf
=
NULL
;
}
return
1
;
}
int
ssl3_release_read_buffer
(
SSL
*
s
)
{
SSL3_BUFFER
*
b
;
b
=
RECORD_LAYER_get_rbuf
(
&
s
->
rlayer
);
if
(
b
->
buf
!=
NULL
)
{
OPENSSL_free
(
b
->
buf
);
b
->
buf
=
NULL
;
}
return
1
;
}
int
ssl_allow_compression
(
SSL
*
s
)
{
if
(
s
->
options
&
SSL_OP_NO_COMPRESSION
)
...
...
ssl/ssl_locl.h
浏览文件 @
76042020
...
...
@@ -2101,11 +2101,6 @@ void ssl3_free_digest_list(SSL *s);
__owur
unsigned
long
ssl3_output_cert_chain
(
SSL
*
s
,
CERT_PKEY
*
cpk
);
__owur
SSL_CIPHER
*
ssl3_choose_cipher
(
SSL
*
ssl
,
STACK_OF
(
SSL_CIPHER
)
*
clnt
,
STACK_OF
(
SSL_CIPHER
)
*
srvr
);
__owur
int
ssl3_setup_buffers
(
SSL
*
s
);
__owur
int
ssl3_setup_read_buffer
(
SSL
*
s
);
__owur
int
ssl3_setup_write_buffer
(
SSL
*
s
);
int
ssl3_release_read_buffer
(
SSL
*
s
);
int
ssl3_release_write_buffer
(
SSL
*
s
);
__owur
int
ssl3_digest_cached_records
(
SSL
*
s
);
__owur
int
ssl3_new
(
SSL
*
s
);
void
ssl3_free
(
SSL
*
s
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录