Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
8f331999
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看板
提交
8f331999
编写于
4月 14, 2011
作者:
D
Dr. Stephen Henson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Report each cipher used with CMAC tests.
Only add one error to error queue if a specific test type fails.
上级
9338f290
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
52 addition
and
20 deletion
+52
-20
fips/cmac/fips_cmac_selftest.c
fips/cmac/fips_cmac_selftest.c
+41
-17
fips/fips_test_suite.c
fips/fips_test_suite.c
+8
-1
fips/hmac/fips_hmac_selftest.c
fips/hmac/fips_hmac_selftest.c
+3
-2
未找到文件。
fips/cmac/fips_cmac_selftest.c
浏览文件 @
8f331999
...
@@ -114,39 +114,63 @@ int FIPS_selftest_cmac()
...
@@ -114,39 +114,63 @@ int FIPS_selftest_cmac()
const
EVP_CIPHER
*
cipher
;
const
EVP_CIPHER
*
cipher
;
CMAC_CTX
*
ctx
=
CMAC_CTX_new
();
CMAC_CTX
*
ctx
=
CMAC_CTX_new
();
const
CMAC_KAT
*
t
;
const
CMAC_KAT
*
t
;
int
do_corrupt
=
0
,
rv
=
0
;
int
subid
,
rv
=
1
;
if
(
!
fips_post_started
(
FIPS_TEST_CMAC
,
0
,
0
))
return
1
;
if
(
!
fips_post_corrupt
(
FIPS_TEST_CMAC
,
0
,
NULL
))
for
(
n
=
0
,
t
=
vector
;
n
<
sizeof
(
vector
)
/
sizeof
(
vector
[
0
]);
n
++
,
t
++
)
for
(
n
=
0
,
t
=
vector
;
n
<
sizeof
(
vector
)
/
sizeof
(
vector
[
0
]);
n
++
,
t
++
)
{
{
cipher
=
(
*
t
->
alg
)();
cipher
=
(
*
t
->
alg
)();
CMAC_Init
(
ctx
,
t
->
key
,
t
->
keysize
/
8
,
cipher
,
0
);
subid
=
M_EVP_CIPHER_nid
(
cipher
);
CMAC_Update
(
ctx
,
t
->
msg
,
t
->
msgsize
/
8
);
if
(
!
fips_post_started
(
FIPS_TEST_CMAC
,
subid
,
0
))
if
(
do_corrupt
)
continue
;
CMAC_Update
(
ctx
,
t
->
msg
,
1
);
if
(
!
CMAC_Init
(
ctx
,
t
->
key
,
t
->
keysize
/
8
,
cipher
,
0
))
CMAC_Final
(
ctx
,
out
,
&
outlen
);
{
rv
=
-
1
;
goto
err
;
}
if
(
!
CMAC_Update
(
ctx
,
t
->
msg
,
t
->
msgsize
/
8
))
{
rv
=
-
1
;
goto
err
;
}
if
(
!
fips_post_corrupt
(
FIPS_TEST_CMAC
,
subid
,
NULL
))
{
if
(
!
CMAC_Update
(
ctx
,
t
->
msg
,
1
))
{
rv
=
-
1
;
goto
err
;
}
}
if
(
!
CMAC_Final
(
ctx
,
out
,
&
outlen
))
{
rv
=
-
1
;
goto
err
;
}
CMAC_CTX_cleanup
(
ctx
);
CMAC_CTX_cleanup
(
ctx
);
if
(
outlen
<
t
->
macsize
/
8
||
memcmp
(
out
,
t
->
mac
,
t
->
macsize
/
8
))
if
(
outlen
<
t
->
macsize
/
8
||
memcmp
(
out
,
t
->
mac
,
t
->
macsize
/
8
))
{
{
FIPSerr
(
FIPS_F_FIPS_SELFTEST_CMAC
,
FIPS_R_SELFTEST_FAILED
);
fips_post_failed
(
FIPS_TEST_CMAC
,
subid
,
NULL
);
goto
err
;
rv
=
0
;
}
}
else
if
(
!
fips_post_success
(
FIPS_TEST_CMAC
,
subid
,
NULL
))
{
rv
=
0
;
goto
err
;
}
}
}
rv
=
1
;
err:
err:
CMAC_CTX_free
(
ctx
);
CMAC_CTX_free
(
ctx
);
if
(
rv
==
0
)
if
(
rv
==
-
1
)
{
{
fips_post_failed
(
FIPS_TEST_CMAC
,
0
,
NULL
);
fips_post_failed
(
FIPS_TEST_CMAC
,
subid
,
NULL
);
r
eturn
0
;
r
v
=
0
;
}
}
if
(
!
rv
)
FIPSerr
(
FIPS_F_FIPS_SELFTEST_CMAC
,
FIPS_R_SELFTEST_FAILED
);
return
fips_post_success
(
FIPS_TEST_CMAC
,
0
,
NULL
)
;
return
rv
;
}
}
#endif
#endif
fips/fips_test_suite.c
浏览文件 @
8f331999
...
@@ -682,7 +682,11 @@ POST_ID id_list[] = {
...
@@ -682,7 +682,11 @@ POST_ID id_list[] = {
{
EVP_PKEY_RSA
,
"RSA"
},
{
EVP_PKEY_RSA
,
"RSA"
},
{
EVP_PKEY_DSA
,
"DSA"
},
{
EVP_PKEY_DSA
,
"DSA"
},
{
EVP_PKEY_EC
,
"ECDSA"
},
{
EVP_PKEY_EC
,
"ECDSA"
},
{
NID_aes_128_cbc
,
"AES-128-CBC"
},
{
NID_aes_192_cbc
,
"AES-192-CBC"
},
{
NID_aes_256_cbc
,
"AES-256-CBC"
},
{
NID_aes_128_ecb
,
"AES-128-ECB"
},
{
NID_aes_128_ecb
,
"AES-128-ECB"
},
{
NID_des_ede3_cbc
,
"DES-EDE3-CBC"
},
{
NID_des_ede3_ecb
,
"DES-EDE3-ECB"
},
{
NID_des_ede3_ecb
,
"DES-EDE3-ECB"
},
{
0
,
NULL
}
{
0
,
NULL
}
};
};
...
@@ -696,7 +700,7 @@ static const char *lookup_id(int id)
...
@@ -696,7 +700,7 @@ static const char *lookup_id(int id)
if
(
n
->
id
==
id
)
if
(
n
->
id
==
id
)
return
n
->
name
;
return
n
->
name
;
}
}
sprintf
(
out
,
"ID=%d
\n
"
,
id
);
sprintf
(
out
,
"ID=%d"
,
id
);
return
out
;
return
out
;
}
}
...
@@ -741,6 +745,7 @@ static int post_cb(int op, int id, int subid, void *ex)
...
@@ -741,6 +745,7 @@ static int post_cb(int op, int id, int subid, void *ex)
case
FIPS_TEST_CMAC
:
case
FIPS_TEST_CMAC
:
idstr
=
"CMAC"
;
idstr
=
"CMAC"
;
exstr
=
lookup_id
(
subid
);
break
;
break
;
case
FIPS_TEST_GCM
:
case
FIPS_TEST_GCM
:
...
@@ -873,6 +878,8 @@ int main(int argc,char **argv)
...
@@ -873,6 +878,8 @@ int main(int argc,char **argv)
fail_id
=
FIPS_TEST_DIGEST
;
fail_id
=
FIPS_TEST_DIGEST
;
}
else
if
(
!
strcmp
(
argv
[
1
],
"hmac"
))
{
}
else
if
(
!
strcmp
(
argv
[
1
],
"hmac"
))
{
fail_id
=
FIPS_TEST_HMAC
;
fail_id
=
FIPS_TEST_HMAC
;
}
else
if
(
!
strcmp
(
argv
[
1
],
"cmac"
))
{
fail_id
=
FIPS_TEST_CMAC
;
}
else
if
(
!
strcmp
(
argv
[
1
],
"drbg"
))
{
}
else
if
(
!
strcmp
(
argv
[
1
],
"drbg"
))
{
FIPS_corrupt_drbg
();
FIPS_corrupt_drbg
();
}
else
if
(
!
strcmp
(
argv
[
1
],
"rng"
))
{
}
else
if
(
!
strcmp
(
argv
[
1
],
"rng"
))
{
...
...
fips/hmac/fips_hmac_selftest.c
浏览文件 @
8f331999
...
@@ -156,11 +156,10 @@ int FIPS_selftest_hmac()
...
@@ -156,11 +156,10 @@ int FIPS_selftest_hmac()
if
(
memcmp
(
out
,
t
->
kaval
,
outlen
))
if
(
memcmp
(
out
,
t
->
kaval
,
outlen
))
{
{
FIPSerr
(
FIPS_F_FIPS_SELFTEST_HMAC
,
FIPS_R_SELFTEST_FAILED
);
fips_post_failed
(
FIPS_TEST_HMAC
,
subid
,
NULL
);
fips_post_failed
(
FIPS_TEST_HMAC
,
subid
,
NULL
);
rv
=
0
;
rv
=
0
;
}
}
if
(
!
fips_post_success
(
FIPS_TEST_HMAC
,
subid
,
NULL
))
else
if
(
!
fips_post_success
(
FIPS_TEST_HMAC
,
subid
,
NULL
))
goto
err
;
goto
err
;
}
}
...
@@ -171,6 +170,8 @@ int FIPS_selftest_hmac()
...
@@ -171,6 +170,8 @@ int FIPS_selftest_hmac()
fips_post_failed
(
FIPS_TEST_HMAC
,
subid
,
NULL
);
fips_post_failed
(
FIPS_TEST_HMAC
,
subid
,
NULL
);
rv
=
0
;
rv
=
0
;
}
}
if
(
!
rv
)
FIPSerr
(
FIPS_F_FIPS_SELFTEST_HMAC
,
FIPS_R_SELFTEST_FAILED
);
return
rv
;
return
rv
;
}
}
#endif
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录