Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
btwise
openssl
提交
6a149cee
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,发现更多精彩内容 >>
提交
6a149cee
编写于
11月 18, 2016
作者:
M
Matt Caswell
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Convert TLS Record receipt to use PACKET
Reviewed-by:
N
Rich Salz
<
rsalz@openssl.org
>
上级
c7c42022
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
31 addition
and
11 deletion
+31
-11
ssl/record/ssl3_record.c
ssl/record/ssl3_record.c
+31
-11
未找到文件。
ssl/record/ssl3_record.c
浏览文件 @
6a149cee
...
...
@@ -124,7 +124,7 @@ static int ssl3_record_app_data_waiting(SSL *s)
/* used only by ssl3_read_bytes */
int
ssl3_get_record
(
SSL
*
s
)
{
int
ssl_major
,
ssl_minor
,
al
;
int
al
;
int
enc_err
,
rret
,
ret
=
-
1
;
int
i
;
size_t
more
,
n
;
...
...
@@ -133,10 +133,11 @@ int ssl3_get_record(SSL *s)
SSL_SESSION
*
sess
;
unsigned
char
*
p
;
unsigned
char
md
[
EVP_MAX_MD_SIZE
];
shor
t
version
;
unsigned
in
t
version
;
size_t
mac_size
;
int
imac_size
;
size_t
num_recs
=
0
,
max_recs
,
j
;
PACKET
pkt
,
sslv2pkt
;
rr
=
RECORD_LAYER_get_rrec
(
&
s
->
rlayer
);
rbuf
=
RECORD_LAYER_get_rbuf
(
&
s
->
rlayer
);
...
...
@@ -150,6 +151,9 @@ int ssl3_get_record(SSL *s)
if
((
RECORD_LAYER_get_rstate
(
&
s
->
rlayer
)
!=
SSL_ST_READ_BODY
)
||
(
RECORD_LAYER_get_packet_length
(
&
s
->
rlayer
)
<
SSL3_RT_HEADER_LENGTH
))
{
size_t
sslv2len
;
unsigned
int
type
;
rret
=
ssl3_read_n
(
s
,
SSL3_RT_HEADER_LENGTH
,
SSL3_BUFFER_get_len
(
rbuf
),
0
,
num_recs
==
0
?
1
:
0
,
&
n
);
...
...
@@ -158,12 +162,25 @@ int ssl3_get_record(SSL *s)
RECORD_LAYER_set_rstate
(
&
s
->
rlayer
,
SSL_ST_READ_BODY
);
p
=
RECORD_LAYER_get_packet
(
&
s
->
rlayer
);
if
(
!
PACKET_buf_init
(
&
pkt
,
RECORD_LAYER_get_packet
(
&
s
->
rlayer
),
RECORD_LAYER_get_packet_length
(
&
s
->
rlayer
)))
{
al
=
SSL_AD_INTERNAL_ERROR
;
SSLerr
(
SSL_F_SSL3_GET_RECORD
,
ERR_R_INTERNAL_ERROR
);
goto
f_err
;
}
sslv2pkt
=
pkt
;
if
(
!
PACKET_get_net_2_len
(
&
sslv2pkt
,
&
sslv2len
)
||
!
PACKET_get_1
(
&
sslv2pkt
,
&
type
))
{
al
=
SSL_AD_INTERNAL_ERROR
;
SSLerr
(
SSL_F_SSL3_GET_RECORD
,
ERR_R_INTERNAL_ERROR
);
goto
f_err
;
}
/*
* The first record received by the server may be a V2ClientHello.
*/
if
(
s
->
server
&&
RECORD_LAYER_is_first_record
(
&
s
->
rlayer
)
&&
(
p
[
0
]
&
0x80
)
&&
(
p
[
2
]
==
SSL2_MT_CLIENT_HELLO
))
{
&&
(
sslv2len
&
0x8000
)
!=
0
&&
(
type
==
SSL2_MT_CLIENT_HELLO
))
{
/*
* SSLv2 style record
*
...
...
@@ -176,7 +193,7 @@ int ssl3_get_record(SSL *s)
rr
[
num_recs
].
type
=
SSL3_RT_HANDSHAKE
;
rr
[
num_recs
].
rec_version
=
SSL2_VERSION
;
rr
[
num_recs
].
length
=
((
p
[
0
]
&
0x7f
)
<<
8
)
|
p
[
1
]
;
rr
[
num_recs
].
length
=
sslv2len
&
0x7fff
;
if
(
rr
[
num_recs
].
length
>
SSL3_BUFFER_get_len
(
rbuf
)
-
SSL2_RT_HEADER_LENGTH
)
{
...
...
@@ -197,16 +214,19 @@ int ssl3_get_record(SSL *s)
s
->
msg_callback_arg
);
/* Pull apart the header into the SSL3_RECORD */
rr
[
num_recs
].
type
=
*
(
p
++
);
ssl_major
=
*
(
p
++
);
ssl_minor
=
*
(
p
++
);
version
=
(
ssl_major
<<
8
)
|
ssl_minor
;
if
(
!
PACKET_get_1
(
&
pkt
,
&
type
)
||
!
PACKET_get_net_2
(
&
pkt
,
&
version
)
||
!
PACKET_get_net_2_len
(
&
pkt
,
&
rr
[
num_recs
].
length
))
{
al
=
SSL_AD_INTERNAL_ERROR
;
SSLerr
(
SSL_F_SSL3_GET_RECORD
,
ERR_R_INTERNAL_ERROR
);
goto
f_err
;
}
rr
[
num_recs
].
type
=
type
;
rr
[
num_recs
].
rec_version
=
version
;
n2s
(
p
,
rr
[
num_recs
].
length
);
/* Lets check version. In TLSv1.3 we ignore this field */
if
(
!
s
->
first_packet
&&
!
SSL_IS_TLS13
(
s
)
&&
version
!=
s
->
version
)
{
&&
version
!=
(
unsigned
int
)
s
->
version
)
{
SSLerr
(
SSL_F_SSL3_GET_RECORD
,
SSL_R_WRONG_VERSION_NUMBER
);
if
((
s
->
version
&
0xFF00
)
==
(
version
&
0xFF00
)
&&
!
s
->
enc_write_ctx
&&
!
s
->
write_hash
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录