Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
1e803100
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看板
提交
1e803100
编写于
3月 17, 2011
作者:
D
Dr. Stephen Henson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Implement continuous RNG test for SP800-90 DRBGs.
上级
96ec46f7
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
76 addition
and
2 deletion
+76
-2
crypto/fips_err.h
crypto/fips_err.h
+2
-0
fips/fips.h
fips/fips.h
+2
-0
fips/rand/fips_drbg_lib.c
fips/rand/fips_drbg_lib.c
+66
-2
fips/rand/fips_rand_lcl.h
fips/rand/fips_rand_lcl.h
+6
-0
未找到文件。
crypto/fips_err.h
浏览文件 @
1e803100
...
...
@@ -84,6 +84,7 @@ static ERR_STRING_DATA FIPS_str_functs[]=
{
ERR_FUNC
(
FIPS_F_FIPS_CIPHERINIT
),
"FIPS_CIPHERINIT"
},
{
ERR_FUNC
(
FIPS_F_FIPS_DIGESTINIT
),
"FIPS_DIGESTINIT"
},
{
ERR_FUNC
(
FIPS_F_FIPS_DRBG_GENERATE
),
"FIPS_drbg_generate"
},
{
ERR_FUNC
(
FIPS_F_FIPS_DRBG_GENERATE_INTERNAL
),
"FIPS_DRBG_GENERATE_INTERNAL"
},
{
ERR_FUNC
(
FIPS_F_FIPS_DRBG_HEALTH_CHECK
),
"FIPS_DRBG_HEALTH_CHECK"
},
{
ERR_FUNC
(
FIPS_F_FIPS_DRBG_INIT
),
"FIPS_drbg_init"
},
{
ERR_FUNC
(
FIPS_F_FIPS_DRBG_INSTANTIATE
),
"FIPS_drbg_instantiate"
},
...
...
@@ -118,6 +119,7 @@ static ERR_STRING_DATA FIPS_str_reasons[]=
{
ERR_REASON
(
FIPS_R_CANNOT_READ_EXE
)
,
"cannot read exe"
},
{
ERR_REASON
(
FIPS_R_CANNOT_READ_EXE_DIGEST
),
"cannot read exe digest"
},
{
ERR_REASON
(
FIPS_R_CONTRADICTING_EVIDENCE
),
"contradicting evidence"
},
{
ERR_REASON
(
FIPS_R_DRBG_STUCK
)
,
"drbg stuck"
},
{
ERR_REASON
(
FIPS_R_ENTROPY_ERROR_UNDETECTED
),
"entropy error undetected"
},
{
ERR_REASON
(
FIPS_R_ENTROPY_NOT_REQUESTED_FOR_RESEED
),
"entropy not requested for reseed"
},
{
ERR_REASON
(
FIPS_R_ERROR_INITIALISING_DRBG
),
"error initialising drbg"
},
...
...
fips/fips.h
浏览文件 @
1e803100
...
...
@@ -194,6 +194,7 @@ void ERR_load_FIPS_strings(void);
#define FIPS_F_FIPS_CIPHERINIT 128
#define FIPS_F_FIPS_DIGESTINIT 127
#define FIPS_F_FIPS_DRBG_GENERATE 132
#define FIPS_F_FIPS_DRBG_GENERATE_INTERNAL 138
#define FIPS_F_FIPS_DRBG_HEALTH_CHECK 137
#define FIPS_F_FIPS_DRBG_INIT 136
#define FIPS_F_FIPS_DRBG_INSTANTIATE 133
...
...
@@ -225,6 +226,7 @@ void ERR_load_FIPS_strings(void);
#define FIPS_R_CANNOT_READ_EXE 103
#define FIPS_R_CANNOT_READ_EXE_DIGEST 104
#define FIPS_R_CONTRADICTING_EVIDENCE 114
#define FIPS_R_DRBG_STUCK 142
#define FIPS_R_ENTROPY_ERROR_UNDETECTED 133
#define FIPS_R_ENTROPY_NOT_REQUESTED_FOR_RESEED 134
#define FIPS_R_ERROR_INITIALISING_DRBG 120
...
...
fips/rand/fips_drbg_lib.c
浏览文件 @
1e803100
...
...
@@ -263,7 +263,8 @@ int FIPS_drbg_reseed(DRBG_CTX *dctx,
}
int
FIPS_drbg_generate
(
DRBG_CTX
*
dctx
,
unsigned
char
*
out
,
size_t
outlen
,
static
int
fips_drbg_generate_internal
(
DRBG_CTX
*
dctx
,
unsigned
char
*
out
,
size_t
outlen
,
int
strength
,
int
prediction_resistance
,
const
unsigned
char
*
adin
,
size_t
adinlen
)
{
...
...
@@ -313,13 +314,76 @@ int FIPS_drbg_generate(DRBG_CTX *dctx, unsigned char *out, size_t outlen,
if
(
r
)
{
if
(
!
(
dctx
->
flags
&
DRBG_FLAG_NOERR
))
FIPSerr
(
FIPS_F_FIPS_DRBG_GENERATE
,
r
);
FIPSerr
(
FIPS_F_FIPS_DRBG_GENERATE
_INTERNAL
,
r
);
return
0
;
}
return
1
;
}
/* external generate function: incorporates continuous RNG test if not
* in test mode.
*/
int
FIPS_drbg_generate
(
DRBG_CTX
*
dctx
,
unsigned
char
*
out
,
size_t
outlen
,
int
strength
,
int
prediction_resistance
,
const
unsigned
char
*
adin
,
size_t
adinlen
)
{
unsigned
char
tmp
[
16
],
*
pout
;
size_t
poutlen
;
/* If test mode don't run continuous RNG test */
if
(
dctx
->
flags
&
DRBG_FLAG_TEST
)
{
return
fips_drbg_generate_internal
(
dctx
,
out
,
outlen
,
strength
,
prediction_resistance
,
adin
,
adinlen
);
}
/* If this is the first call generate block and save buffer */
if
(
!
dctx
->
lb_valid
)
{
if
(
!
fips_drbg_generate_internal
(
dctx
,
dctx
->
lb
,
16
,
strength
,
prediction_resistance
,
adin
,
adinlen
))
return
0
;
dctx
->
lb_valid
=
1
;
}
/* If request less that 16 bytes request 16 in temp buffer */
if
(
outlen
<
16
)
{
pout
=
tmp
;
poutlen
=
16
;
}
else
{
pout
=
out
;
poutlen
=
outlen
;
}
/* Generate data */
if
(
!
fips_drbg_generate_internal
(
dctx
,
pout
,
poutlen
,
strength
,
prediction_resistance
,
adin
,
adinlen
))
return
0
;
/* Compare to last block for continuous PRNG test */
if
(
!
memcmp
(
pout
,
dctx
->
lb
,
16
))
{
FIPSerr
(
FIPS_F_FIPS_DRBG_GENERATE
,
FIPS_R_DRBG_STUCK
);
return
0
;
}
/* Update last block */
memcpy
(
dctx
->
lb
,
pout
,
16
);
/* Copy to output buffer if needed */
if
(
outlen
<
16
)
memcpy
(
out
,
pout
,
outlen
);
return
1
;
}
int
FIPS_drbg_uninstantiate
(
DRBG_CTX
*
dctx
)
{
int
rv
;
...
...
fips/rand/fips_rand_lcl.h
浏览文件 @
1e803100
...
...
@@ -167,6 +167,12 @@ struct drbg_ctx_st
size_t
(
*
get_nonce
)(
DRBG_CTX
*
ctx
,
unsigned
char
*
out
,
int
entropy
,
size_t
min_len
,
size_t
max_len
);
/* Continuous random number test temporary area */
/* Last block */
unsigned
char
lb
[
16
];
/* set if lb is valid */
int
lb_valid
;
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录