Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
e3068929
T
Third Party Openssl
项目概览
OpenHarmony
/
Third Party Openssl
9 个月 前同步成功
通知
8
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,体验更适合开发者的 AI 搜索 >>
提交
e3068929
编写于
2月 10, 2001
作者:
B
Bodo Möller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Simplify BN_rand_range
上级
836f9960
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
8 addition
and
13 deletion
+8
-13
crypto/bn/bn.h
crypto/bn/bn.h
+1
-1
crypto/bn/bn_rand.c
crypto/bn/bn_rand.c
+3
-7
crypto/dsa/dsa_ossl.c
crypto/dsa/dsa_ossl.c
+1
-1
doc/crypto/BN_rand.pod
doc/crypto/BN_rand.pod
+2
-3
doc/crypto/bn.pod
doc/crypto/bn.pod
+1
-1
未找到文件。
crypto/bn/bn.h
浏览文件 @
e3068929
...
...
@@ -329,7 +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
*
range
);
int
BN_rand_range
(
BIGNUM
*
rnd
,
BIGNUM
*
range
);
int
BN_num_bits
(
const
BIGNUM
*
a
);
int
BN_num_bits_word
(
BN_ULONG
);
BIGNUM
*
BN_new
(
void
);
...
...
crypto/bn/bn_rand.c
浏览文件 @
e3068929
...
...
@@ -169,8 +169,9 @@ int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom)
}
#endif
/* random number r: min <= r < min+range */
int
BN_rand_range
(
BIGNUM
*
r
,
BIGNUM
*
min
,
BIGNUM
*
range
)
/* random number r: 0 <= r < range */
int
BN_rand_range
(
BIGNUM
*
r
,
BIGNUM
*
range
)
{
int
n
;
...
...
@@ -217,10 +218,5 @@ int BN_rand_range(BIGNUM *r, BIGNUM *min, BIGNUM *range)
while
(
BN_cmp
(
r
,
range
)
>=
0
);
}
if
(
min
!=
NULL
)
{
if
(
!
BN_add
(
r
,
r
,
min
))
return
0
;
}
return
1
;
}
crypto/dsa/dsa_ossl.c
浏览文件 @
e3068929
...
...
@@ -181,7 +181,7 @@ static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp)
/* Get random k */
do
if
(
!
BN_rand_range
(
&
k
,
NULL
,
dsa
->
q
))
goto
err
;
if
(
!
BN_rand_range
(
&
k
,
dsa
->
q
))
goto
err
;
while
(
BN_is_zero
(
&
k
));
if
((
dsa
->
method_mont_p
==
NULL
)
&&
(
dsa
->
flags
&
DSA_FLAG_CACHE_MONT_P
))
...
...
doc/crypto/BN_rand.pod
浏览文件 @
e3068929
...
...
@@ -12,7 +12,7 @@ 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 *
range);
int BN_rand_range(BIGNUM *rnd, BIGNUM *range);
=head1 DESCRIPTION
...
...
@@ -28,8 +28,7 @@ non-cryptographic purposes and for certain purposes in cryptographic
protocols, but usually not for key generation etc.
BN_rand_range() generates a cryptographically strong pseudo-random
number B<rnd> in the range B<min> E<lt>= B<rnd> E<lt> B<min> + B<range>.
B<min> may be NULL, in that case 0 E<lt>= B<rnd> E<lt> B<range>.
number B<rnd> in the range 0 <lt>= B<rnd> E<lt> B<range>.
The PRNG must be seeded prior to calling BN_rand() or BN_rand_range().
...
...
doc/crypto/bn.pod
浏览文件 @
e3068929
...
...
@@ -68,7 +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
);
int BN_rand_range(BIGNUM *rnd, BIGNUM *
range
);
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录