Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
e5cadaf8
T
Third Party Openssl
项目概览
OpenHarmony
/
Third Party Openssl
接近 2 年 前同步成功
通知
12
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看板
提交
e5cadaf8
编写于
4月 01, 2011
作者:
D
Dr. Stephen Henson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Only zeroise sensitive parts of DRBG context, so the type and flags
are undisturbed. Allow setting of "rand" callbacks for DRBG.
上级
8cf88778
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
29 addition
and
5 deletion
+29
-5
fips/rand/fips_drbg_lib.c
fips/rand/fips_drbg_lib.c
+19
-2
fips/rand/fips_drbg_selftest.c
fips/rand/fips_drbg_selftest.c
+3
-3
fips/rand/fips_rand.h
fips/rand/fips_rand.h
+7
-0
未找到文件。
fips/rand/fips_drbg_lib.c
浏览文件 @
e5cadaf8
...
@@ -114,7 +114,7 @@ void FIPS_drbg_free(DRBG_CTX *dctx)
...
@@ -114,7 +114,7 @@ void FIPS_drbg_free(DRBG_CTX *dctx)
{
{
if
(
dctx
->
uninstantiate
)
if
(
dctx
->
uninstantiate
)
dctx
->
uninstantiate
(
dctx
);
dctx
->
uninstantiate
(
dctx
);
OPENSSL_cleanse
(
dctx
,
sizeof
(
DRBG_CTX
));
OPENSSL_cleanse
(
&
dctx
->
d
,
sizeof
(
dctx
->
d
));
OPENSSL_free
(
dctx
);
OPENSSL_free
(
dctx
);
}
}
...
@@ -403,7 +403,8 @@ int FIPS_drbg_uninstantiate(DRBG_CTX *dctx)
...
@@ -403,7 +403,8 @@ int FIPS_drbg_uninstantiate(DRBG_CTX *dctx)
/* Although we'd like to cleanse here we can't because we have to
/* Although we'd like to cleanse here we can't because we have to
* test the uninstantiate really zeroes the data.
* test the uninstantiate really zeroes the data.
*/
*/
memset
(
dctx
,
0
,
sizeof
(
DRBG_CTX
));
memset
(
&
dctx
->
d
,
0
,
sizeof
(
dctx
->
d
));
dctx
->
status
=
DRBG_STATUS_UNINITIALISED
;
/* If method has problems uninstantiating, return error */
/* If method has problems uninstantiating, return error */
return
rv
;
return
rv
;
}
}
...
@@ -425,6 +426,22 @@ int FIPS_drbg_set_callbacks(DRBG_CTX *dctx,
...
@@ -425,6 +426,22 @@ int FIPS_drbg_set_callbacks(DRBG_CTX *dctx,
return
1
;
return
1
;
}
}
int
FIPS_drbg_set_rand_callbacks
(
DRBG_CTX
*
dctx
,
size_t
(
*
get_adin
)(
DRBG_CTX
*
ctx
,
unsigned
char
**
pout
),
void
(
*
cleanup_adin
)(
DRBG_CTX
*
ctx
,
unsigned
char
*
out
,
size_t
olen
),
int
(
*
rand_seed_cb
)(
DRBG_CTX
*
ctx
,
const
void
*
buf
,
int
num
),
int
(
*
rand_add_cb
)(
DRBG_CTX
*
ctx
,
const
void
*
buf
,
int
num
,
double
entropy
))
{
if
(
dctx
->
status
!=
DRBG_STATUS_UNINITIALISED
)
return
0
;
dctx
->
get_adin
=
get_adin
;
dctx
->
cleanup_adin
=
cleanup_adin
;
dctx
->
rand_seed_cb
=
rand_seed_cb
;
dctx
->
rand_add_cb
=
rand_add_cb
;
return
1
;
}
void
*
FIPS_drbg_get_app_data
(
DRBG_CTX
*
dctx
)
void
*
FIPS_drbg_get_app_data
(
DRBG_CTX
*
dctx
)
{
{
return
dctx
->
app_data
;
return
dctx
->
app_data
;
...
...
fips/rand/fips_drbg_selftest.c
浏览文件 @
e5cadaf8
...
@@ -954,11 +954,11 @@ static int fips_drbg_health_check(DRBG_CTX *dctx, DRBG_SELFTEST_DATA *td)
...
@@ -954,11 +954,11 @@ static int fips_drbg_health_check(DRBG_CTX *dctx, DRBG_SELFTEST_DATA *td)
}
}
FIPS_drbg_uninstantiate
(
dctx
);
FIPS_drbg_uninstantiate
(
dctx
);
p
=
(
unsigned
char
*
)
dctx
;
p
=
(
unsigned
char
*
)
&
dctx
->
d
;
/* Standard says we have to check uninstantiate really zeroes
/* Standard says we have to check uninstantiate really zeroes
* the data...
* the data...
*/
*/
for
(
i
=
0
;
i
<
sizeof
(
DRBG_CTX
);
i
++
)
for
(
i
=
0
;
i
<
sizeof
(
dctx
->
d
);
i
++
)
{
{
if
(
*
p
!=
0
)
if
(
*
p
!=
0
)
{
{
...
@@ -980,7 +980,7 @@ static int fips_drbg_health_check(DRBG_CTX *dctx, DRBG_SELFTEST_DATA *td)
...
@@ -980,7 +980,7 @@ static int fips_drbg_health_check(DRBG_CTX *dctx, DRBG_SELFTEST_DATA *td)
return
0
;
return
0
;
}
}
int
fips_drbg_kat
(
DRBG_CTX
*
dctx
,
int
nid
,
unsigned
int
flags
)
int
fips_drbg_kat
(
DRBG_CTX
*
dctx
,
int
nid
,
unsigned
int
flags
)
{
{
...
...
fips/rand/fips_rand.h
浏览文件 @
e5cadaf8
...
@@ -97,6 +97,13 @@ int FIPS_drbg_set_callbacks(DRBG_CTX *dctx,
...
@@ -97,6 +97,13 @@ int FIPS_drbg_set_callbacks(DRBG_CTX *dctx,
int
entropy
,
size_t
min_len
,
size_t
max_len
),
int
entropy
,
size_t
min_len
,
size_t
max_len
),
void
(
*
cleanup_nonce
)(
DRBG_CTX
*
ctx
,
unsigned
char
*
out
,
size_t
olen
));
void
(
*
cleanup_nonce
)(
DRBG_CTX
*
ctx
,
unsigned
char
*
out
,
size_t
olen
));
int
FIPS_drbg_set_rand_callbacks
(
DRBG_CTX
*
dctx
,
size_t
(
*
get_adin
)(
DRBG_CTX
*
ctx
,
unsigned
char
**
pout
),
void
(
*
cleanup_adin
)(
DRBG_CTX
*
ctx
,
unsigned
char
*
out
,
size_t
olen
),
int
(
*
rand_seed_cb
)(
DRBG_CTX
*
ctx
,
const
void
*
buf
,
int
num
),
int
(
*
rand_add_cb
)(
DRBG_CTX
*
ctx
,
const
void
*
buf
,
int
num
,
double
entropy
));
void
*
FIPS_drbg_get_app_data
(
DRBG_CTX
*
ctx
);
void
*
FIPS_drbg_get_app_data
(
DRBG_CTX
*
ctx
);
void
FIPS_drbg_set_app_data
(
DRBG_CTX
*
ctx
,
void
*
app_data
);
void
FIPS_drbg_set_app_data
(
DRBG_CTX
*
ctx
,
void
*
app_data
);
size_t
FIPS_drbg_get_blocklength
(
DRBG_CTX
*
dctx
);
size_t
FIPS_drbg_get_blocklength
(
DRBG_CTX
*
dctx
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录