Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
706735ae
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,发现更多精彩内容 >>
提交
706735ae
编写于
4月 14, 2011
作者:
D
Dr. Stephen Henson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add new POST support to X9.31 PRNG.
上级
8f331999
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
26 addition
and
18 deletion
+26
-18
fips/fips.h
fips/fips.h
+0
-1
fips/fips_test_suite.c
fips/fips_test_suite.c
+4
-1
fips/rand/fips_rand_selftest.c
fips/rand/fips_rand_selftest.c
+22
-16
未找到文件。
fips/fips.h
浏览文件 @
706735ae
...
...
@@ -79,7 +79,6 @@ int FIPS_selftest_des(void);
int
FIPS_selftest_rsa
(
void
);
int
FIPS_selftest_dsa
(
void
);
int
FIPS_selftest_ecdsa
(
void
);
void
FIPS_corrupt_x931
(
void
);
void
FIPS_corrupt_drbg
(
void
);
void
FIPS_x931_stick
(
void
);
void
FIPS_drbg_stick
(
void
);
...
...
fips/fips_test_suite.c
浏览文件 @
706735ae
...
...
@@ -711,6 +711,7 @@ static int fail_key = -1;
static
int
post_cb
(
int
op
,
int
id
,
int
subid
,
void
*
ex
)
{
const
char
*
idstr
,
*
exstr
=
""
;
char
asctmp
[
20
];
int
keytype
=
-
1
;
switch
(
id
)
{
...
...
@@ -762,6 +763,8 @@ static int post_cb(int op, int id, int subid, void *ex)
case
FIPS_TEST_X931
:
idstr
=
"X9.31 PRNG"
;
sprintf
(
asctmp
,
"keylen=%d"
,
subid
);
exstr
=
asctmp
;
break
;
case
FIPS_TEST_DRBG
:
...
...
@@ -883,7 +886,7 @@ int main(int argc,char **argv)
}
else
if
(
!
strcmp
(
argv
[
1
],
"drbg"
))
{
FIPS_corrupt_drbg
();
}
else
if
(
!
strcmp
(
argv
[
1
],
"rng"
))
{
FIPS_corrupt_x931
()
;
fail_id
=
FIPS_TEST_X931
;
}
else
if
(
!
strcmp
(
argv
[
1
],
"rngstick"
))
{
do_rng_stick
=
1
;
no_exit
=
1
;
...
...
fips/rand/fips_rand_selftest.c
浏览文件 @
706735ae
...
...
@@ -54,6 +54,7 @@
#include <openssl/fips.h>
#include <openssl/rand.h>
#include <openssl/fips_rand.h>
#include "fips_locl.h"
#ifdef OPENSSL_FIPS
...
...
@@ -324,11 +325,6 @@ static AES_PRNG_TV aes_256_tv[] = {
};
void
FIPS_corrupt_x931
()
{
aes_192_tv
[
0
].
V
[
0
]
++
;
}
#define fips_x931_test(key, tv) \
do_x931_test(key, sizeof key, tv, sizeof(tv)/sizeof(AES_PRNG_TV))
...
...
@@ -336,38 +332,48 @@ static int do_x931_test(unsigned char *key, int keylen,
AES_PRNG_TV
*
tv
,
int
ntv
)
{
unsigned
char
R
[
16
];
int
i
;
int
i
,
rv
=
1
;
if
(
!
FIPS_x931_set_key
(
key
,
keylen
))
return
0
;
for
(
i
=
0
;
i
<
ntv
;
i
++
)
{
if
(
!
fips_post_started
(
FIPS_TEST_X931
,
keylen
,
NULL
))
return
1
;
if
(
!
fips_post_corrupt
(
FIPS_TEST_X931
,
keylen
,
NULL
))
tv
[
i
].
V
[
0
]
++
;
FIPS_x931_seed
(
tv
[
i
].
V
,
16
);
FIPS_x931_set_dt
(
tv
[
i
].
DT
);
FIPS_x931_bytes
(
R
,
16
);
if
(
memcmp
(
R
,
tv
[
i
].
R
,
16
))
{
fips_post_failed
(
FIPS_TEST_X931
,
keylen
,
NULL
);
rv
=
0
;
}
else
if
(
!
fips_post_success
(
FIPS_TEST_X931
,
keylen
,
NULL
))
return
0
;
}
return
1
;
return
rv
;
}
int
FIPS_selftest_x931
()
{
int
rv
=
1
;
FIPS_x931_reset
();
if
(
!
FIPS_x931_test_mode
())
{
FIPSerr
(
FIPS_F_FIPS_SELFTEST_X931
,
FIPS_R_SELFTEST_FAILED
);
return
0
;
}
if
(
!
fips_x931_test
(
aes_128_key
,
aes_128_tv
)
||
!
fips_x931_test
(
aes_192_key
,
aes_192_tv
)
||
!
fips_x931_test
(
aes_256_key
,
aes_256_tv
))
{
FIPSerr
(
FIPS_F_FIPS_SELFTEST_X931
,
FIPS_R_SELFTEST_FAILED
);
return
0
;
}
if
(
!
fips_x931_test
(
aes_128_key
,
aes_128_tv
))
rv
=
0
;
if
(
!
fips_x931_test
(
aes_192_key
,
aes_192_tv
))
rv
=
0
;
if
(
!
fips_x931_test
(
aes_256_key
,
aes_256_tv
))
rv
=
0
;
FIPS_x931_reset
();
return
1
;
if
(
!
rv
)
FIPSerr
(
FIPS_F_FIPS_SELFTEST_X931
,
FIPS_R_SELFTEST_FAILED
);
return
rv
;
}
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录