Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
57e7d3ce
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看板
提交
57e7d3ce
编写于
2月 07, 2001
作者:
U
Ulf Möller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Bleichenbacher's DSA attack
上级
a8ebe469
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
28 addition
and
10 deletion
+28
-10
CHANGES
CHANGES
+4
-0
crypto/bn/bn.h
crypto/bn/bn.h
+1
-0
crypto/bn/bn_rand.c
crypto/bn/bn_rand.c
+11
-0
crypto/dsa/dsa_ossl.c
crypto/dsa/dsa_ossl.c
+1
-7
doc/crypto/BN_rand.pod
doc/crypto/BN_rand.pod
+10
-3
doc/crypto/bn.pod
doc/crypto/bn.pod
+1
-0
未找到文件。
CHANGES
浏览文件 @
57e7d3ce
...
...
@@ -3,6 +3,10 @@
Changes between 0.9.6 and 0.9.7 [xx XXX 2000]
*) Add new function BN_rand_range(), and fix DSA_sign_setup() to prevent
Bleichenbacher's DSA attack.
[Ulf Moeller]
*) Update Rijndael code to version 3.0 and change EVP AES ciphers to
handle the new API. Currently only ECB, CBC modes supported. Add new
AES OIDs. Add TLS AES ciphersuites as described in the "AES Ciphersuites
...
...
crypto/bn/bn.h
浏览文件 @
57e7d3ce
...
...
@@ -329,6 +329,7 @@ BIGNUM *BN_CTX_get(BN_CTX *ctx);
void
BN_CTX_end
(
BN_CTX
*
ctx
);
int
BN_rand
(
BIGNUM
*
rnd
,
int
bits
,
int
top
,
int
bottom
);
int
BN_pseudo_rand
(
BIGNUM
*
rnd
,
int
bits
,
int
top
,
int
bottom
);
int
BN_rand_range
(
BIGNUM
*
rnd
,
BIGNUM
*
min
,
BIGNUM
*
max
);
int
BN_num_bits
(
const
BIGNUM
*
a
);
int
BN_num_bits_word
(
BN_ULONG
);
BIGNUM
*
BN_new
(
void
);
...
...
crypto/bn/bn_rand.c
浏览文件 @
57e7d3ce
...
...
@@ -168,3 +168,14 @@ int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom)
return
bnrand
(
2
,
rnd
,
bits
,
top
,
bottom
);
}
#endif
/* random number r: min <= r < max */
int
BN_rand_range
(
BIGNUM
*
r
,
BIGNUM
*
min
,
BIGNUM
*
max
)
{
int
n
=
BN_num_bits
(
max
);
do
{
if
(
!
BN_rand
(
r
,
n
,
0
,
0
))
return
0
;
}
while
((
min
&&
BN_cmp
(
r
,
min
)
<
0
)
||
BN_cmp
(
r
,
max
)
>=
0
);
return
1
;
}
crypto/dsa/dsa_ossl.c
浏览文件 @
57e7d3ce
...
...
@@ -180,13 +180,7 @@ static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp)
kinv
=
NULL
;
/* Get random k */
for
(;;)
{
if
(
!
BN_rand
(
&
k
,
BN_num_bits
(
dsa
->
q
),
0
,
0
))
goto
err
;
if
(
BN_cmp
(
&
k
,
dsa
->
q
)
>=
0
)
BN_sub
(
&
k
,
&
k
,
dsa
->
q
);
if
(
!
BN_is_zero
(
&
k
))
break
;
}
if
(
!
BN_rand_range
(
&
k
,
BN_value_one
(),
dsa
->
q
))
goto
err
;
if
((
dsa
->
method_mont_p
==
NULL
)
&&
(
dsa
->
flags
&
DSA_FLAG_CACHE_MONT_P
))
{
...
...
doc/crypto/BN_rand.pod
浏览文件 @
57e7d3ce
...
...
@@ -12,6 +12,8 @@ BN_rand, BN_pseudo_rand - generate pseudo-random number
int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom);
int BN_rand_range(BIGNUM *rnd, BIGNUM *min, BIGNUM *max);
=head1 DESCRIPTION
BN_rand() generates a cryptographically strong pseudo-random number of
...
...
@@ -25,11 +27,15 @@ this function are not necessarily unpredictable. They can be used for
non-cryptographic purposes and for certain purposes in cryptographic
protocols, but usually not for key generation etc.
The PRNG must be seeded prior to calling BN_rand().
BN_rand_range() generates a cryptographically strong pseudo-random
number B<rnd> in the range B<min> E<lt>= B<rnd> E<lt> B<max>. B<min>
may be NULL, in that case 0 E<lt>= B<rnd> E<lt> B<max>.
The PRNG must be seeded prior to calling BN_rand() or BN_rand_range().
=head1 RETURN VALUES
BN_rand() and BN_pseudo_rand()
return 1 on success, 0 on error.
The functions
return 1 on success, 0 on error.
The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>.
=head1 SEE ALSO
...
...
@@ -40,6 +46,7 @@ L<RAND_add(3)|RAND_add(3)>, L<RAND_bytes(3)|RAND_bytes(3)>
=head1 HISTORY
BN_rand() is available in all versions of SSLeay and OpenSSL.
BN_pseudo_rand() was added in OpenSSL 0.9.5.
BN_pseudo_rand() was added in OpenSSL 0.9.5, and BN_rand_range()
in OpenSSL 0.9.6a.
=cut
doc/crypto/bn.pod
浏览文件 @
57e7d3ce
...
...
@@ -68,6 +68,7 @@ bn - multiprecision integer arithmetics
int BN_rand(BIGNUM *rnd, int bits, int top, int bottom);
int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom);
int BN_rand_range(BIGNUM *rnd, BIGNUM *min, BIGNUM *max);
BIGNUM *BN_generate_prime(BIGNUM *ret, int bits,int safe, BIGNUM *add,
BIGNUM *rem, void (*callback)(int, int, void *), void *cb_arg);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录