Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
14264b19
T
Third Party Openssl
项目概览
OpenHarmony
/
Third Party Openssl
12 个月 前同步成功
通知
8
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,发现更多精彩内容 >>
提交
14264b19
编写于
4月 20, 2011
作者:
D
Dr. Stephen Henson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add periodic DRBG health checks as required by SP800-90.
上级
8da18ea1
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
36 addition
and
0 deletion
+36
-0
crypto/fips_err.h
crypto/fips_err.h
+1
-0
fips/fips.h
fips/fips.h
+1
-0
fips/rand/fips_drbg_lib.c
fips/rand/fips_drbg_lib.c
+29
-0
fips/rand/fips_rand.h
fips/rand/fips_rand.h
+1
-0
fips/rand/fips_rand_lcl.h
fips/rand/fips_rand_lcl.h
+4
-0
未找到文件。
crypto/fips_err.h
浏览文件 @
14264b19
...
...
@@ -82,6 +82,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_BYTES
),
"FIPS_DRBG_BYTES"
},
{
ERR_FUNC
(
FIPS_F_FIPS_DRBG_CHECK
),
"FIPS_DRBG_CHECK"
},
{
ERR_FUNC
(
FIPS_F_FIPS_DRBG_CPRNG_TEST
),
"FIPS_DRBG_CPRNG_TEST"
},
{
ERR_FUNC
(
FIPS_F_FIPS_DRBG_GENERATE
),
"FIPS_drbg_generate"
},
{
ERR_FUNC
(
FIPS_F_FIPS_DRBG_HEALTH_CHECK
),
"FIPS_DRBG_HEALTH_CHECK"
},
...
...
fips/fips.h
浏览文件 @
14264b19
...
...
@@ -244,6 +244,7 @@ void ERR_load_FIPS_strings(void);
#define FIPS_F_FIPS_CIPHERINIT 109
#define FIPS_F_FIPS_DIGESTINIT 110
#define FIPS_F_FIPS_DRBG_BYTES 111
#define FIPS_F_FIPS_DRBG_CHECK 146
#define FIPS_F_FIPS_DRBG_CPRNG_TEST 112
#define FIPS_F_FIPS_DRBG_GENERATE 113
#define FIPS_F_FIPS_DRBG_HEALTH_CHECK 114
...
...
fips/rand/fips_drbg_lib.c
浏览文件 @
14264b19
...
...
@@ -71,6 +71,9 @@ int FIPS_drbg_init(DRBG_CTX *dctx, int type, unsigned int flags)
dctx
->
flags
=
flags
;
dctx
->
type
=
type
;
dctx
->
health_check_cnt
=
0
;
dctx
->
health_check_interval
=
DRBG_HEALTH_INTERVAL
;
rv
=
fips_drbg_hash_init
(
dctx
);
if
(
rv
==
-
2
)
...
...
@@ -277,6 +280,24 @@ int FIPS_drbg_reseed(DRBG_CTX *dctx,
return
0
;
}
static
int
fips_drbg_check
(
DRBG_CTX
*
dctx
)
{
if
(
dctx
->
flags
&
DRBG_FLAG_TEST
)
return
1
;
dctx
->
health_check_cnt
++
;
if
(
dctx
->
health_check_cnt
>=
dctx
->
health_check_interval
)
{
DRBG_CTX
tctx
;
if
(
!
fips_drbg_kat
(
&
tctx
,
dctx
->
type
,
dctx
->
flags
|
DRBG_FLAG_TEST
))
{
FIPSerr
(
FIPS_F_FIPS_DRBG_CHECK
,
FIPS_R_SELFTEST_FAILURE
);
return
0
;
}
dctx
->
health_check_cnt
=
0
;
}
return
1
;
}
int
FIPS_drbg_generate
(
DRBG_CTX
*
dctx
,
unsigned
char
*
out
,
size_t
outlen
,
int
strength
,
int
prediction_resistance
,
...
...
@@ -284,6 +305,9 @@ int FIPS_drbg_generate(DRBG_CTX *dctx, unsigned char *out, size_t outlen,
{
int
r
=
0
;
if
(
!
fips_drbg_check
(
dctx
))
return
0
;
if
(
dctx
->
status
!=
DRBG_STATUS_READY
&&
dctx
->
status
!=
DRBG_STATUS_RESEED
)
{
...
...
@@ -408,6 +432,11 @@ int FIPS_drbg_get_strength(DRBG_CTX *dctx)
return
dctx
->
strength
;
}
void
FIPS_drbg_set_check_interval
(
DRBG_CTX
*
dctx
,
int
interval
)
{
dctx
->
health_check_interval
=
interval
;
}
static
int
drbg_stick
=
0
;
void
FIPS_drbg_stick
(
void
)
...
...
fips/rand/fips_rand.h
浏览文件 @
14264b19
...
...
@@ -108,6 +108,7 @@ void *FIPS_drbg_get_app_data(DRBG_CTX *ctx);
void
FIPS_drbg_set_app_data
(
DRBG_CTX
*
ctx
,
void
*
app_data
);
size_t
FIPS_drbg_get_blocklength
(
DRBG_CTX
*
dctx
);
int
FIPS_drbg_get_strength
(
DRBG_CTX
*
dctx
);
void
FIPS_drbg_set_check_interval
(
DRBG_CTX
*
dctx
,
int
interval
);
DRBG_CTX
*
FIPS_get_default_drbg
(
void
);
const
RAND_METHOD
*
FIPS_drbg_method
(
void
);
...
...
fips/rand/fips_rand_lcl.h
浏览文件 @
14264b19
...
...
@@ -105,6 +105,8 @@ struct drbg_ctr_ctx_st
*/
#define DRBG_MAX_BLOCK EVP_MAX_MD_SIZE
#define DRBG_HEALTH_INTERVAL (1 << 24)
/* DRBG context structure */
struct
drbg_ctx_st
...
...
@@ -114,6 +116,8 @@ struct drbg_ctx_st
int
type
;
/* Various flags */
unsigned
int
flags
;
/* Used for periodic health checks */
int
health_check_cnt
,
health_check_interval
;
/* The following parameters are setup by mechanism drbg_init() call */
int
strength
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录