Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
7a8c7288
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看板
提交
7a8c7288
编写于
3月 24, 2005
作者:
U
Ulf Möller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
undo Cygwin change
上级
6141b86a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
26 addition
and
7 deletion
+26
-7
CHANGES
CHANGES
+6
-1
crypto/rand/rand_win.c
crypto/rand/rand_win.c
+20
-6
未找到文件。
CHANGES
浏览文件 @
7a8c7288
...
@@ -761,7 +761,12 @@
...
@@ -761,7 +761,12 @@
differing sizes.
differing sizes.
[Richard Levitte]
[Richard Levitte]
Changes between 0.9.7e and 0.9.7f [XX xxx XXXX]
Changes between 0.9.7f and 0.9.7g [XX xxx xxxx]
*) Undo Cygwin change.
[Ulf Möller]
Changes between 0.9.7e and 0.9.7f [23 Mar 2005]
*) Use (SSL_RANDOM_VALUE - 4) bytes of pseudo random data when generating
*) Use (SSL_RANDOM_VALUE - 4) bytes of pseudo random data when generating
server and client random values. Previously
server and client random values. Previously
...
...
crypto/rand/rand_win.c
浏览文件 @
7a8c7288
...
@@ -113,7 +113,7 @@
...
@@ -113,7 +113,7 @@
#include <openssl/rand.h>
#include <openssl/rand.h>
#include "rand_lcl.h"
#include "rand_lcl.h"
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
|| defined(OPENSSL_SYS_WIN32_CYGWIN)
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
#include <windows.h>
#include <windows.h>
#ifndef _WIN32_WINNT
#ifndef _WIN32_WINNT
# define _WIN32_WINNT 0x0400
# define _WIN32_WINNT 0x0400
...
@@ -121,6 +121,10 @@
...
@@ -121,6 +121,10 @@
#include <wincrypt.h>
#include <wincrypt.h>
#include <tlhelp32.h>
#include <tlhelp32.h>
/* Limit the time spent walking through the heap, processes, threads and modules to
a maximum of 1000 miliseconds each, unless CryptoGenRandom failed */
#define MAXDELAY 1000
/* Intel hardware RNG CSP -- available from
/* Intel hardware RNG CSP -- available from
* http://developer.intel.com/design/security/rng/redist_license.htm
* http://developer.intel.com/design/security/rng/redist_license.htm
*/
*/
...
@@ -192,6 +196,7 @@ int RAND_poll(void)
...
@@ -192,6 +196,7 @@ int RAND_poll(void)
BYTE
buf
[
64
];
BYTE
buf
[
64
];
DWORD
w
;
DWORD
w
;
HWND
h
;
HWND
h
;
int
good
=
0
;
HMODULE
advapi
,
kernel
,
user
,
netapi
;
HMODULE
advapi
,
kernel
,
user
,
netapi
;
CRYPTACQUIRECONTEXTW
acquire
=
0
;
CRYPTACQUIRECONTEXTW
acquire
=
0
;
...
@@ -362,6 +367,7 @@ int RAND_poll(void)
...
@@ -362,6 +367,7 @@ int RAND_poll(void)
if
(
gen
(
hProvider
,
sizeof
(
buf
),
buf
)
!=
0
)
if
(
gen
(
hProvider
,
sizeof
(
buf
),
buf
)
!=
0
)
{
{
RAND_add
(
buf
,
sizeof
(
buf
),
0
);
RAND_add
(
buf
,
sizeof
(
buf
),
0
);
good
=
1
;
#if 0
#if 0
printf("randomness from PROV_RSA_FULL\n");
printf("randomness from PROV_RSA_FULL\n");
#endif
#endif
...
@@ -375,6 +381,7 @@ int RAND_poll(void)
...
@@ -375,6 +381,7 @@ int RAND_poll(void)
if
(
gen
(
hProvider
,
sizeof
(
buf
),
buf
)
!=
0
)
if
(
gen
(
hProvider
,
sizeof
(
buf
),
buf
)
!=
0
)
{
{
RAND_add
(
buf
,
sizeof
(
buf
),
sizeof
(
buf
));
RAND_add
(
buf
,
sizeof
(
buf
),
sizeof
(
buf
));
good
=
1
;
#if 0
#if 0
printf("randomness from PROV_INTEL_SEC\n");
printf("randomness from PROV_INTEL_SEC\n");
#endif
#endif
...
@@ -464,6 +471,7 @@ int RAND_poll(void)
...
@@ -464,6 +471,7 @@ int RAND_poll(void)
PROCESSENTRY32
p
;
PROCESSENTRY32
p
;
THREADENTRY32
t
;
THREADENTRY32
t
;
MODULEENTRY32
m
;
MODULEENTRY32
m
;
DWORD
stoptime
=
0
;
snap
=
(
CREATETOOLHELP32SNAPSHOT
)
snap
=
(
CREATETOOLHELP32SNAPSHOT
)
GetProcAddress
(
kernel
,
"CreateToolhelp32Snapshot"
);
GetProcAddress
(
kernel
,
"CreateToolhelp32Snapshot"
);
...
@@ -495,6 +503,7 @@ int RAND_poll(void)
...
@@ -495,6 +503,7 @@ int RAND_poll(void)
* of entropy.
* of entropy.
*/
*/
hlist
.
dwSize
=
sizeof
(
HEAPLIST32
);
hlist
.
dwSize
=
sizeof
(
HEAPLIST32
);
if
(
good
)
stoptime
=
GetTickCount
()
+
MAXDELAY
;
if
(
heaplist_first
(
handle
,
&
hlist
))
if
(
heaplist_first
(
handle
,
&
hlist
))
do
do
{
{
...
@@ -512,18 +521,20 @@ int RAND_poll(void)
...
@@ -512,18 +521,20 @@ int RAND_poll(void)
&&
--
entrycnt
>
0
);
&&
--
entrycnt
>
0
);
}
}
}
while
(
heaplist_next
(
handle
,
}
while
(
heaplist_next
(
handle
,
&
hlist
));
&
hlist
)
&&
GetTickCount
()
<
stoptime
);
/* process walking */
/* process walking */
/* PROCESSENTRY32 contains 9 fields that will change
/* PROCESSENTRY32 contains 9 fields that will change
* with each entry. Consider each field a source of
* with each entry. Consider each field a source of
* 1 byte of entropy.
* 1 byte of entropy.
*/
*/
p
.
dwSize
=
sizeof
(
PROCESSENTRY32
);
p
.
dwSize
=
sizeof
(
PROCESSENTRY32
);
if
(
good
)
stoptime
=
GetTickCount
()
+
MAXDELAY
;
if
(
process_first
(
handle
,
&
p
))
if
(
process_first
(
handle
,
&
p
))
do
do
RAND_add
(
&
p
,
p
.
dwSize
,
9
);
RAND_add
(
&
p
,
p
.
dwSize
,
9
);
while
(
process_next
(
handle
,
&
p
));
while
(
process_next
(
handle
,
&
p
)
&&
GetTickCount
()
<
stoptime
);
/* thread walking */
/* thread walking */
/* THREADENTRY32 contains 6 fields that will change
/* THREADENTRY32 contains 6 fields that will change
...
@@ -531,10 +542,11 @@ int RAND_poll(void)
...
@@ -531,10 +542,11 @@ int RAND_poll(void)
* 1 byte of entropy.
* 1 byte of entropy.
*/
*/
t
.
dwSize
=
sizeof
(
THREADENTRY32
);
t
.
dwSize
=
sizeof
(
THREADENTRY32
);
if
(
good
)
stoptime
=
GetTickCount
()
+
MAXDELAY
;
if
(
thread_first
(
handle
,
&
t
))
if
(
thread_first
(
handle
,
&
t
))
do
do
RAND_add
(
&
t
,
t
.
dwSize
,
6
);
RAND_add
(
&
t
,
t
.
dwSize
,
6
);
while
(
thread_next
(
handle
,
&
t
));
while
(
thread_next
(
handle
,
&
t
)
&&
GetTickCount
()
<
stoptime
);
/* module walking */
/* module walking */
/* MODULEENTRY32 contains 9 fields that will change
/* MODULEENTRY32 contains 9 fields that will change
...
@@ -542,14 +554,16 @@ int RAND_poll(void)
...
@@ -542,14 +554,16 @@ int RAND_poll(void)
* 1 byte of entropy.
* 1 byte of entropy.
*/
*/
m
.
dwSize
=
sizeof
(
MODULEENTRY32
);
m
.
dwSize
=
sizeof
(
MODULEENTRY32
);
if
(
good
)
stoptime
=
GetTickCount
()
+
MAXDELAY
;
if
(
module_first
(
handle
,
&
m
))
if
(
module_first
(
handle
,
&
m
))
do
do
RAND_add
(
&
m
,
m
.
dwSize
,
9
);
RAND_add
(
&
m
,
m
.
dwSize
,
9
);
while
(
module_next
(
handle
,
&
m
));
while
(
module_next
(
handle
,
&
m
)
&&
GetTickCount
<
stoptime
);
if
(
close_snap
)
if
(
close_snap
)
close_snap
(
handle
);
close_snap
(
handle
);
else
else
CloseHandle
(
handle
);
CloseHandle
(
handle
);
}
}
FreeLibrary
(
kernel
);
FreeLibrary
(
kernel
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录