Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
a70183bc
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,发现更多精彩内容 >>
提交
a70183bc
编写于
3月 30, 2006
作者:
B
Bodo Möller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix for hostname extension
Submitted by: Kaspar Brand, Peter Sylvester
上级
33273721
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
51 addition
and
18 deletion
+51
-18
ssl/t1_lib.c
ssl/t1_lib.c
+51
-18
未找到文件。
ssl/t1_lib.c
浏览文件 @
a70183bc
...
...
@@ -164,22 +164,37 @@ unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned char *p, unsigned cha
ret
+=
2
;
if
(
ret
>=
limit
)
return
NULL
;
/* this really never occurs, but ... */
if
(
s
->
servername_done
==
0
&&
s
->
tlsext_hostname
!=
NULL
)
if
(
s
->
tlsext_hostname
!=
NULL
)
{
/* Add TLS extension servername to the Client Hello message */
unsigned
long
size_str
;
long
lenmax
;
if
((
lenmax
=
limit
-
p
-
7
)
<
0
)
return
NULL
;
if
((
size_str
=
strlen
(
s
->
tlsext_hostname
))
>
(
unsigned
long
)
lenmax
)
return
NULL
;
/* check for enough space.
4 for the servername type and entension length
2 for servernamelist length
1 for the hostname type
2 for hostname length
+ hostname length
*/
if
((
lenmax
=
limit
-
p
-
9
)
<
0
||
(
size_str
=
strlen
(
s
->
tlsext_hostname
))
>
(
unsigned
long
)
lenmax
)
return
NULL
;
/* extension type and length */
s2n
(
TLSEXT_TYPE_server_name
,
ret
);
s2n
(
size_str
+
5
,
ret
);
/* length of servername list */
s2n
(
size_str
+
3
,
ret
);
/* hostname type, length and hostname */
*
(
ret
++
)
=
(
unsigned
char
)
TLSEXT_NAMETYPE_host_name
;
s2n
(
size_str
,
ret
);
memcpy
(
ret
,
s
->
tlsext_hostname
,
size_str
);
ret
+=
size_str
;
}
#ifndef OPENSSL_NO_EC
if
(
s
->
tlsext_ecpointformatlist
!=
NULL
)
...
...
@@ -264,6 +279,7 @@ unsigned char *ssl_add_serverhello_tlsext(SSL *s, unsigned char *p, unsigned cha
*
(
ret
++
)
=
(
unsigned
char
)
s
->
tlsext_ecpointformatlist_length
;
memcpy
(
ret
,
s
->
tlsext_ecpointformatlist
,
s
->
tlsext_ecpointformatlist_length
);
ret
+=
s
->
tlsext_ecpointformatlist_length
;
}
/* Currently the server should not respond with a SupportedCurves extension */
#endif
/* OPENSSL_NO_EC */
...
...
@@ -281,9 +297,6 @@ int ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, in
unsigned
short
size
;
unsigned
short
len
;
unsigned
char
*
data
=
*
p
;
#if 0
fprintf(stderr,"ssl_parse_clienthello_tlsext %s\n",s->session->tlsext_hostname?s->session->tlsext_hostname:"NULL");
#endif
s
->
servername_done
=
0
;
if
(
data
>=
(
d
+
n
-
2
))
...
...
@@ -326,20 +339,36 @@ int ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, in
if
(
type
==
TLSEXT_TYPE_server_name
)
{
unsigned
char
*
sdata
=
data
;
unsigned
char
*
sdata
;
int
servname_type
;
int
dsize
=
size
-
3
;
int
dsize
;
if
(
dsize
>
0
)
if
(
size
<
2
)
{
*
al
=
SSL_AD_DECODE_ERROR
;
return
0
;
}
n2s
(
data
,
dsize
);
size
-=
2
;
if
(
dsize
>
size
)
{
*
al
=
SSL_AD_DECODE_ERROR
;
return
0
;
}
sdata
=
data
;
while
(
dsize
>
3
)
{
servname_type
=
*
(
sdata
++
);
n2s
(
sdata
,
len
);
if
(
len
!=
dsize
)
dsize
-=
3
;
if
(
len
>
dsize
)
{
*
al
=
SSL_AD_DECODE_ERROR
;
return
0
;
}
if
(
s
->
servername_done
==
0
)
switch
(
servname_type
)
{
case
TLSEXT_NAMETYPE_host_name
:
...
...
@@ -360,9 +389,6 @@ int ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, in
}
s
->
servername_done
=
1
;
#if 0
fprintf(stderr,"ssl_parse_clienthello_tlsext s->session->tlsext_hostname %s\n",s->session->tlsext_hostname);
#endif
}
else
s
->
servername_done
=
strlen
(
s
->
session
->
tlsext_hostname
)
==
len
...
...
@@ -374,7 +400,14 @@ int ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, in
break
;
}
dsize
-=
len
;
}
if
(
dsize
!=
0
)
{
*
al
=
SSL_AD_DECODE_ERROR
;
return
0
;
}
}
#ifndef OPENSSL_NO_EC
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录