Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
ad89bf78
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看板
提交
ad89bf78
编写于
12月 19, 2011
作者:
D
Dr. Stephen Henson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
PR: 2563
Submitted by: Paul Green <Paul.Green@stratus.com> Reviewed by: steve Improved PRNG seeding for VOS.
上级
e75440d2
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
86 addition
and
37 deletion
+86
-37
CHANGES
CHANGES
+3
-0
Configure
Configure
+2
-2
crypto/rand/rand_unix.c
crypto/rand/rand_unix.c
+74
-34
e_os2.h
e_os2.h
+7
-1
未找到文件。
CHANGES
浏览文件 @
ad89bf78
...
@@ -255,6 +255,9 @@
...
@@ -255,6 +255,9 @@
Changes between 1.0.0f and 1.0.1 [xx XXX xxxx]
Changes between 1.0.0f and 1.0.1 [xx XXX xxxx]
*) Improved PRNG seeding for VOS.
[Paul Green <Paul.Green@stratus.com>]
*) Extensive assembler packs updates, most notably:
*) Extensive assembler packs updates, most notably:
- x86[_64]: AES-NI, PCLMULQDQ, RDRAND support;
- x86[_64]: AES-NI, PCLMULQDQ, RDRAND support;
...
...
Configure
浏览文件 @
ad89bf78
...
@@ -200,8 +200,8 @@ my %table=(
...
@@ -200,8 +200,8 @@ my %table=(
"cc", "cc:-O::(unknown)::::::",
"cc", "cc:-O::(unknown)::::::",
####VOS Configurations
####VOS Configurations
"vos-gcc","gcc:-O3 -Wall -D_POSIX_C_SOURCE=200112L -D_BSD -D_VOS_EXTENDED_NAMES -DB_ENDIAN::(unknown):VOS:-Wl,-map:BN_LLONG:${no_asm}:::::.so:",
"vos-gcc","gcc:-O3 -Wall -D
OPENSSL_SYSNAME_VOS -D
_POSIX_C_SOURCE=200112L -D_BSD -D_VOS_EXTENDED_NAMES -DB_ENDIAN::(unknown):VOS:-Wl,-map:BN_LLONG:${no_asm}:::::.so:",
"debug-vos-gcc","gcc:-O0 -g -Wall -D_POSIX_C_SOURCE=200112L -D_BSD -D_VOS_EXTENDED_NAMES -DB_ENDIAN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG::(unknown):VOS:-Wl,-map:BN_LLONG:${no_asm}:::::.so:",
"debug-vos-gcc","gcc:-O0 -g -Wall -D
OPENSSL_SYSNAME_VOS -D
_POSIX_C_SOURCE=200112L -D_BSD -D_VOS_EXTENDED_NAMES -DB_ENDIAN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG::(unknown):VOS:-Wl,-map:BN_LLONG:${no_asm}:::::.so:",
#### Solaris x86 with GNU C setups
#### Solaris x86 with GNU C setups
# -DOPENSSL_NO_INLINE_ASM switches off inline assembler. We have to do it
# -DOPENSSL_NO_INLINE_ASM switches off inline assembler. We have to do it
...
...
crypto/rand/rand_unix.c
浏览文件 @
ad89bf78
...
@@ -133,47 +133,87 @@
...
@@ -133,47 +133,87 @@
# define FD_SETSIZE (8*sizeof(fd_set))
# define FD_SETSIZE (8*sizeof(fd_set))
#endif
#endif
#ifdef __VOS__
#if defined(OPENSSL_SYS_VOS)
/* The following algorithm repeatedly samples the real-time clock
(RTC) to generate a sequence of unpredictable data. The algorithm
relies upon the uneven execution speed of the code (due to factors
such as cache misses, interrupts, bus activity, and scheduling) and
upon the rather large relative difference between the speed of the
clock and the rate at which it can be read.
If this code is ported to an environment where execution speed is
more constant or where the RTC ticks at a much slower rate, or the
clock can be read with fewer instructions, it is likely that the
results would be far more predictable.
As a precaution, we generate 4 times the minimum required amount of
seed data. */
int
RAND_poll
(
void
)
int
RAND_poll
(
void
)
{
{
unsigned
char
buf
[
ENTROPY_NEEDED
];
short
int
code
;
gid_t
curr_gid
;
pid_t
curr_pid
;
pid_t
curr_pid
;
uid_t
curr_uid
;
uid_t
curr_uid
;
static
int
first
=
1
;
int
i
,
k
;
int
i
;
long
rnd
=
0
;
struct
timespec
ts
;
struct
timespec
ts
;
unsigned
seed
;
unsigned
char
v
;
/* The VOS random() function starts from a static seed so its
initial value is predictable. If random() returns the
initial value, reseed it with dynamic data. The VOS
real-time clock has a granularity of 1 nsec so it should be
reasonably difficult to predict its exact value. Do not
gratuitously reseed the PRNG because other code in this
process or thread may be using it. */
if
(
first
)
{
first
=
0
;
rnd
=
random
();
if
(
rnd
==
1804289383
)
{
clock_gettime
(
CLOCK_REALTIME
,
&
ts
);
curr_pid
=
getpid
();
curr_uid
=
getuid
();
seed
=
ts
.
tv_sec
^
ts
.
tv_nsec
^
curr_pid
^
curr_uid
;
srandom
(
seed
);
}
}
for
(
i
=
0
;
i
<
sizeof
(
buf
);
i
++
)
{
#ifdef OPENSSL_SYS_VOS_HPPA
if
(
i
%
4
==
0
)
long
duration
;
rnd
=
random
();
extern
void
s
$
sleep
(
long
*
_duration
,
short
int
*
_code
);
buf
[
i
]
=
rnd
;
#else
rnd
>>=
8
;
#ifdef OPENSSL_SYS_VOS_IA32
}
long
long
duration
;
RAND_add
(
buf
,
sizeof
(
buf
),
ENTROPY_NEEDED
);
extern
void
s
$
sleep2
(
long
long
*
_duration
,
short
int
*
_code
);
memset
(
buf
,
0
,
sizeof
(
buf
));
#else
#error "Unsupported Platform."
#endif
/* OPENSSL_SYS_VOS_IA32 */
#endif
/* OPENSSL_SYS_VOS_HPPA */
/* Seed with the gid, pid, and uid, to ensure *some*
variation between different processes. */
curr_gid
=
getgid
();
RAND_add
(
&
curr_gid
,
sizeof
curr_gid
,
1
);
curr_gid
=
0
;
curr_pid
=
getpid
();
RAND_add
(
&
curr_pid
,
sizeof
curr_pid
,
1
);
curr_pid
=
0
;
curr_uid
=
getuid
();
RAND_add
(
&
curr_uid
,
sizeof
curr_uid
,
1
);
curr_uid
=
0
;
for
(
i
=
0
;
i
<
(
ENTROPY_NEEDED
*
4
);
i
++
)
{
/* burn some cpu; hope for interrupts, cache
collisions, bus interference, etc. */
for
(
k
=
0
;
k
<
99
;
k
++
)
ts
.
tv_nsec
=
random
();
#ifdef OPENSSL_SYS_VOS_HPPA
/* sleep for 1/1024 of a second (976 us). */
duration
=
1
;
s
$
sleep
(
&
duration
,
&
code
);
#else
#ifdef OPENSSL_SYS_VOS_IA32
/* sleep for 1/65536 of a second (15 us). */
duration
=
1
;
s
$
sleep2
(
&
duration
,
&
code
);
#endif
/* OPENSSL_SYS_VOS_IA32 */
#endif
/* OPENSSL_SYS_VOS_HPPA */
/* get wall clock time. */
clock_gettime
(
CLOCK_REALTIME
,
&
ts
);
/* take 8 bits */
v
=
(
unsigned
char
)
(
ts
.
tv_nsec
%
256
);
RAND_add
(
&
v
,
sizeof
v
,
1
);
v
=
0
;
}
return
1
;
return
1
;
}
}
#elif defined __OpenBSD__
#elif defined __OpenBSD__
...
...
e_os2.h
浏览文件 @
ad89bf78
...
@@ -193,8 +193,14 @@ extern "C" {
...
@@ -193,8 +193,14 @@ extern "C" {
#endif
#endif
/* --------------------------------- VOS ----------------------------------- */
/* --------------------------------- VOS ----------------------------------- */
#if
def OPENSSL_SYSNAME_VOS
#if
defined(__VOS__) || defined(OPENSSL_SYSNAME_VOS)
# define OPENSSL_SYS_VOS
# define OPENSSL_SYS_VOS
#ifdef __HPPA__
# define OPENSSL_SYS_VOS_HPPA
#endif
#ifdef __IA32__
# define OPENSSL_SYS_VOS_IA32
#endif
#endif
#endif
/* ------------------------------- VxWorks --------------------------------- */
/* ------------------------------- VxWorks --------------------------------- */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录