Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
ffaef3f1
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看板
提交
ffaef3f1
编写于
12月 17, 2015
作者:
D
Dr. Stephen Henson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Always generate DH keys for ephemeral DH cipher suites.
Reviewed-by:
N
Matt Caswell
<
matt@openssl.org
>
上级
d938e8df
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
14 addition
and
53 deletion
+14
-53
doc/ssl/SSL_CTX_set_tmp_dh_callback.pod
doc/ssl/SSL_CTX_set_tmp_dh_callback.pod
+5
-24
include/openssl/ssl.h
include/openssl/ssl.h
+2
-2
ssl/s3_lib.c
ssl/s3_lib.c
+4
-13
ssl/statem/statem_srvr.c
ssl/statem/statem_srvr.c
+3
-14
未找到文件。
doc/ssl/SSL_CTX_set_tmp_dh_callback.pod
浏览文件 @
ffaef3f1
...
@@ -48,25 +48,8 @@ even if he gets hold of the normal (certified) key, as this key was
...
@@ -48,25 +48,8 @@ even if he gets hold of the normal (certified) key, as this key was
only used for signing.
only used for signing.
In order to perform a DH key exchange the server must use a DH group
In order to perform a DH key exchange the server must use a DH group
(DH parameters) and generate a DH key.
(DH parameters) and generate a DH key. The server will always generate
The server will always generate a new DH key during the negotiation
a new DH key during the negotiation.
if either the DH parameters are supplied via callback or the
SSL_OP_SINGLE_DH_USE option of SSL_CTX_set_options(3) is set (or both).
It will immediately create a DH key if DH parameters are supplied via
SSL_CTX_set_tmp_dh() and SSL_OP_SINGLE_DH_USE is not set.
In this case,
it may happen that a key is generated on initialization without later
being needed, while on the other hand the computer time during the
negotiation is being saved.
If "strong" primes were used to generate the DH parameters, it is not strictly
necessary to generate a new key for each handshake but it does improve forward
secrecy. If it is not assured that "strong" primes were used,
SSL_OP_SINGLE_DH_USE must be used in order to prevent small subgroup
attacks. Always using SSL_OP_SINGLE_DH_USE has an impact on the
computer time needed during negotiation, but it is not very large, so
application authors/users should consider always enabling this option.
The option is required to implement perfect forward secrecy (PFS).
As generating DH parameters is extremely time consuming, an application
As generating DH parameters is extremely time consuming, an application
should not generate the parameters on the fly but supply the parameters.
should not generate the parameters on the fly but supply the parameters.
...
@@ -92,10 +75,9 @@ can supply the DH parameters via a callback function.
...
@@ -92,10 +75,9 @@ can supply the DH parameters via a callback function.
Previous versions of the callback used B<is_export> and B<keylength>
Previous versions of the callback used B<is_export> and B<keylength>
parameters to control parameter generation for export and non-export
parameters to control parameter generation for export and non-export
cipher suites. Modern servers that do not support export ciphersuites
cipher suites. Modern servers that do not support export ciphersuites
are advised to either use SSL_CTX_set_tmp_dh() in combination with
are advised to either use SSL_CTX_set_tmp_dh() or alternatively, use
SSL_OP_SINGLE_DH_USE, or alternatively, use the callback but ignore
the callback but ignore B<keylength> and B<is_export> and simply
B<keylength> and B<is_export> and simply supply at least 2048-bit
supply at least 2048-bit parameters in the callback.
parameters in the callback.
=head1 EXAMPLES
=head1 EXAMPLES
...
@@ -127,7 +109,6 @@ partly left out.)
...
@@ -127,7 +109,6 @@ partly left out.)
if (SSL_CTX_set_tmp_dh(ctx, dh_2048) != 1) {
if (SSL_CTX_set_tmp_dh(ctx, dh_2048) != 1) {
/* Error. */
/* Error. */
}
}
SSL_CTX_set_options(ctx, SSL_OP_SINGLE_DH_USE);
...
...
=head1 RETURN VALUES
=head1 RETURN VALUES
...
...
include/openssl/ssl.h
浏览文件 @
ffaef3f1
...
@@ -411,8 +411,8 @@ typedef int (*custom_ext_parse_cb) (SSL *s, unsigned int ext_type,
...
@@ -411,8 +411,8 @@ typedef int (*custom_ext_parse_cb) (SSL *s, unsigned int ext_type,
# define SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION 0x00040000U
# define SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION 0x00040000U
/* Does nothing: retained for compatibility */
/* Does nothing: retained for compatibility */
# define SSL_OP_SINGLE_ECDH_USE 0x0
# define SSL_OP_SINGLE_ECDH_USE 0x0
/*
If set, always create a new key when using tmp_dh parameters
*/
/*
Does nothing: retained for compatibility
*/
# define SSL_OP_SINGLE_DH_USE 0x0
0100000U
# define SSL_OP_SINGLE_DH_USE 0x0
/* Does nothing: retained for compatibiity */
/* Does nothing: retained for compatibiity */
# define SSL_OP_EPHEMERAL_RSA 0x0
# define SSL_OP_EPHEMERAL_RSA 0x0
/*
/*
...
...
ssl/s3_lib.c
浏览文件 @
ffaef3f1
...
@@ -3499,13 +3499,6 @@ long ssl3_ctrl(SSL *s, int cmd, long larg, void *parg)
...
@@ -3499,13 +3499,6 @@ long ssl3_ctrl(SSL *s, int cmd, long larg, void *parg)
SSLerr
(
SSL_F_SSL3_CTRL
,
ERR_R_DH_LIB
);
SSLerr
(
SSL_F_SSL3_CTRL
,
ERR_R_DH_LIB
);
return
(
ret
);
return
(
ret
);
}
}
if
(
!
(
s
->
options
&
SSL_OP_SINGLE_DH_USE
))
{
if
(
!
DH_generate_key
(
dh
))
{
DH_free
(
dh
);
SSLerr
(
SSL_F_SSL3_CTRL
,
ERR_R_DH_LIB
);
return
(
ret
);
}
}
DH_free
(
s
->
cert
->
dh_tmp
);
DH_free
(
s
->
cert
->
dh_tmp
);
s
->
cert
->
dh_tmp
=
dh
;
s
->
cert
->
dh_tmp
=
dh
;
ret
=
1
;
ret
=
1
;
...
@@ -3887,12 +3880,10 @@ long ssl3_ctx_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg)
...
@@ -3887,12 +3880,10 @@ long ssl3_ctx_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg)
SSLerr
(
SSL_F_SSL3_CTX_CTRL
,
ERR_R_DH_LIB
);
SSLerr
(
SSL_F_SSL3_CTX_CTRL
,
ERR_R_DH_LIB
);
return
0
;
return
0
;
}
}
if
(
!
(
ctx
->
options
&
SSL_OP_SINGLE_DH_USE
))
{
if
(
!
DH_generate_key
(
new
))
{
if
(
!
DH_generate_key
(
new
))
{
SSLerr
(
SSL_F_SSL3_CTX_CTRL
,
ERR_R_DH_LIB
);
SSLerr
(
SSL_F_SSL3_CTX_CTRL
,
ERR_R_DH_LIB
);
DH_free
(
new
);
DH_free
(
new
);
return
0
;
return
0
;
}
}
}
DH_free
(
cert
->
dh_tmp
);
DH_free
(
cert
->
dh_tmp
);
cert
->
dh_tmp
=
new
;
cert
->
dh_tmp
=
new
;
...
...
ssl/statem/statem_srvr.c
浏览文件 @
ffaef3f1
...
@@ -1800,20 +1800,9 @@ int tls_construct_server_key_exchange(SSL *s)
...
@@ -1800,20 +1800,9 @@ int tls_construct_server_key_exchange(SSL *s)
}
}
s
->
s3
->
tmp
.
dh
=
dh
;
s
->
s3
->
tmp
.
dh
=
dh
;
if
((
dhp
->
pub_key
==
NULL
||
if
(
!
DH_generate_key
(
dh
))
{
dhp
->
priv_key
==
NULL
||
SSLerr
(
SSL_F_TLS_CONSTRUCT_SERVER_KEY_EXCHANGE
,
ERR_R_DH_LIB
);
(
s
->
options
&
SSL_OP_SINGLE_DH_USE
)))
{
goto
err
;
if
(
!
DH_generate_key
(
dh
))
{
SSLerr
(
SSL_F_TLS_CONSTRUCT_SERVER_KEY_EXCHANGE
,
ERR_R_DH_LIB
);
goto
err
;
}
}
else
{
dh
->
pub_key
=
BN_dup
(
dhp
->
pub_key
);
dh
->
priv_key
=
BN_dup
(
dhp
->
priv_key
);
if
((
dh
->
pub_key
==
NULL
)
||
(
dh
->
priv_key
==
NULL
))
{
SSLerr
(
SSL_F_TLS_CONSTRUCT_SERVER_KEY_EXCHANGE
,
ERR_R_DH_LIB
);
goto
err
;
}
}
}
r
[
0
]
=
dh
->
p
;
r
[
0
]
=
dh
->
p
;
r
[
1
]
=
dh
->
g
;
r
[
1
]
=
dh
->
g
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录