Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
btwise
openssl
提交
0ebfcc8f
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,发现更多精彩内容 >>
提交
0ebfcc8f
编写于
5月 26, 2005
作者:
B
Bodo Möller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
make sure DSA signing exponentiations really are constant-time
上级
c61f571c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
34 addition
and
3 deletion
+34
-3
CHANGES
CHANGES
+7
-0
crypto/dsa/dsa_ossl.c
crypto/dsa/dsa_ossl.c
+27
-3
未找到文件。
CHANGES
浏览文件 @
0ebfcc8f
...
...
@@ -803,6 +803,13 @@
Changes between 0.9.7g and 0.9.7h [XX xxx XXXX]
*) For DSA signing, unless DSA_FLAG_NO_EXP_CONSTTIME is set, perform
the exponentiation using a fixed-length exponent. (Otherwise,
the information leaked through timing could expose the secret key
after many signatures; cf. Bleichenbacher's attack on DSA with
biased k.)
[Bodo Moeller]
*) Make a new fixed-window mod_exp implementation the default for
RSA, DSA, and DH private-key operations so that the sequence of
squares and multiplies and the memory access pattern are
...
...
crypto/dsa/dsa_ossl.c
浏览文件 @
0ebfcc8f
...
...
@@ -202,7 +202,7 @@ err:
static
int
dsa_sign_setup
(
DSA
*
dsa
,
BN_CTX
*
ctx_in
,
BIGNUM
**
kinvp
,
BIGNUM
**
rp
)
{
BN_CTX
*
ctx
;
BIGNUM
k
,
*
kinv
=
NULL
,
*
r
=
NULL
;
BIGNUM
k
,
kq
,
*
K
,
*
kinv
=
NULL
,
*
r
=
NULL
;
int
ret
=
0
;
if
(
!
dsa
->
p
||
!
dsa
->
q
||
!
dsa
->
g
)
...
...
@@ -212,6 +212,7 @@ static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp)
}
BN_init
(
&
k
);
BN_init
(
&
kq
);
if
(
ctx_in
==
NULL
)
{
...
...
@@ -221,7 +222,6 @@ static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp)
ctx
=
ctx_in
;
if
((
r
=
BN_new
())
==
NULL
)
goto
err
;
kinv
=
NULL
;
/* Get random k */
do
...
...
@@ -241,7 +241,30 @@ static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp)
}
/* Compute r = (g^k mod p) mod q */
DSA_BN_MOD_EXP
(
goto
err
,
dsa
,
r
,
dsa
->
g
,
&
k
,
dsa
->
p
,
ctx
,
if
((
dsa
->
flags
&
DSA_FLAG_NO_EXP_CONSTTIME
)
==
0
)
{
if
(
!
BN_copy
(
&
kq
,
&
k
))
goto
err
;
/* We do not want timing information to leak the length of k,
* so we compute g^k using an equivalent exponent of fixed length.
*
* (This is a kludge that we need because the BN_mod_exp_mont()
* does not let us specify the desired timing behaviour.) */
if
(
!
BN_add
(
&
kq
,
&
kq
,
dsa
->
q
))
goto
err
;
if
(
BN_num_bits
(
&
kq
)
<=
BN_num_bits
(
dsa
->
q
))
{
if
(
!
BN_add
(
&
kq
,
&
kq
,
dsa
->
q
))
goto
err
;
}
K
=
&
kq
;
}
else
{
K
=
&
k
;
}
DSA_BN_MOD_EXP
(
goto
err
,
dsa
,
r
,
dsa
->
g
,
K
,
dsa
->
p
,
ctx
,
dsa
->
method_mont_p
);
if
(
!
BN_mod
(
r
,
r
,
dsa
->
q
,
ctx
))
goto
err
;
...
...
@@ -264,6 +287,7 @@ err:
if
(
ctx_in
==
NULL
)
BN_CTX_free
(
ctx
);
if
(
kinv
!=
NULL
)
BN_clear_free
(
kinv
);
BN_clear_free
(
&
k
);
BN_clear_free
(
&
kq
);
return
(
ret
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录