Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
c88a900f
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,发现更多精彩内容 >>
提交
c88a900f
编写于
1月 22, 2000
作者:
B
Bodo Möller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update PRNG documentation/comments
上级
2a99e8b9
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
20 addition
and
16 deletion
+20
-16
crypto/rand/md_rand.c
crypto/rand/md_rand.c
+8
-6
doc/crypto/BN_generate_prime.pod
doc/crypto/BN_generate_prime.pod
+1
-1
doc/crypto/rand.pod
doc/crypto/rand.pod
+11
-9
未找到文件。
crypto/rand/md_rand.c
浏览文件 @
c88a900f
...
...
@@ -186,7 +186,7 @@ static void ssleay_rand_add(const void *buf, int num, int add)
/*
* (Based on the rand(3) manpage)
*
* The input is chopped up into units of
16
bytes (or less for
* The input is chopped up into units of
20
bytes (or less for
* the last block). Each of these blocks is run through the hash
* function as follows: The data passed to the hash function
* is the current 'md', the same number of bytes from the 'state'
...
...
@@ -324,13 +324,15 @@ static int ssleay_rand_bytes(unsigned char *buf, int num)
/*
* (Based on the rand(3) manpage:)
*
* For each group of
8
bytes (or less), we do the following:
* For each group of
10
bytes (or less), we do the following:
*
* Input into the hash function the top 8 bytes from 'md', the bytes
* that are to be overwritten by the random bytes, and bytes from the
* Input into the hash function the top 10 bytes from the
* local 'md' (which is initialized from the global 'md'
* before any bytes are generated), the bytes that are
* to be overwritten by the random bytes, and bytes from the
* 'state' (incrementing looping index). From this digest output
* (which is kept in 'md'), the top (up
to) 8
bytes are
* returned to the caller and the bottom (up
to) 8
bytes are xored
* (which is kept in 'md'), the top (up
to) 10
bytes are
* returned to the caller and the bottom (up
to) 10
bytes are xored
* into the 'state'.
* Finally, after we have finished 'num' random bytes for the
* caller, 'count' (which is incremented) and the local and global 'md'
...
...
doc/crypto/BN_generate_prime.pod
浏览文件 @
c88a900f
...
...
@@ -55,7 +55,7 @@ The prime number generation has a negligible error probability.
BN_is_prime() tests if the number B<a> is prime. This is done by
performing a Miller-Rabin probabilistic primality test with B<checks>
iterations. If B<checks == BN_prime_check>, it uses
the minimal
number
iterations. If B<checks == BN_prime_check>, it uses
a
number
of iterations that yields a false positive rate of at most 2^-80 for
random input.
...
...
doc/crypto/rand.pod
浏览文件 @
c88a900f
...
...
@@ -101,12 +101,12 @@ the RNG state or the next random number.
The algorithm is as follows.
There is global state made up of a 1023 byte buffer (the 'state'), a
working hash
function ('md')
and a counter ('count').
working hash
value ('md'),
and a counter ('count').
Whenever seed data is added, it is inserted into the 'state' as
follows.
The input is chopped up into units of
16
bytes (or less for
The input is chopped up into units of
20
bytes (or less for
the last block). Each of these blocks is run through the hash
function as follows: The data passed to the hash function
is the current 'md', the same number of bytes from the 'state'
...
...
@@ -121,13 +121,15 @@ SHA-1), 3 (the 'state'), 4 (via the 'md'), 5 (by the use of a hash
function and xor).
When bytes are extracted from the RNG, the following process is used.
For each group of
8 bytes (or less), we do the following,
For each group of
10 bytes (or less), we do the following:
Input into the hash function the top 8 bytes from 'md', the bytes that
are to be overwritten by the random bytes, and bytes from the 'state'
(incrementing looping index). From this hash function output (which
is kept in 'md'), the top (upto) 8 bytes are returned to the caller
and the bottom (upto) 8 bytes are xored into the 'state'.
Input into the hash function the top 10 bytes from the local 'md'
(which is initialized from the global 'md' before any bytes are
generated), the bytes that are to be overwritten by the random bytes,
and bytes from the 'state' (incrementing looping index). From this
digest output (which is kept in 'md'), the top (up to) 10 bytes are
returned to the caller and the bottom (up to) 10 bytes are xored into
the 'state'.
Finally, after we have finished 'num' random bytes for the caller,
'count' (which is incremented) and the local and global 'md' are fed
...
...
@@ -135,7 +137,7 @@ into the hash function and the results are kept in the global 'md'.
I believe the above addressed points 1 (use of SHA-1), 6 (by hashing
into the 'state' the 'old' data from the caller that is about to be
overwritten) and 7 (by not using the
8
bytes given to the caller to
overwritten) and 7 (by not using the
10
bytes given to the caller to
update the 'state', but they are used to update 'md').
So of the points raised, only 2 is not addressed (but see
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录