Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
947ff113
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看板
提交
947ff113
编写于
2月 18, 2011
作者:
D
Dr. Stephen Henson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add ECDSA POST
上级
acf254f8
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
81 addition
and
2 deletion
+81
-2
crypto/fips_err.h
crypto/fips_err.h
+1
-0
fips/ecdsa/Makefile
fips/ecdsa/Makefile
+2
-2
fips/ecdsa/fips_ecdsa_selftest.c
fips/ecdsa/fips_ecdsa_selftest.c
+71
-0
fips/fips.c
fips/fips.c
+1
-0
fips/fips.h
fips/fips.h
+3
-0
fips/fips_test_suite.c
fips/fips_test_suite.c
+3
-0
未找到文件。
crypto/fips_err.h
浏览文件 @
947ff113
...
...
@@ -90,6 +90,7 @@ static ERR_STRING_DATA FIPS_str_functs[]=
{
ERR_FUNC
(
FIPS_F_FIPS_SELFTEST_AES_GCM
),
"FIPS_selftest_aes_gcm"
},
{
ERR_FUNC
(
FIPS_F_FIPS_SELFTEST_DES
),
"FIPS_selftest_des"
},
{
ERR_FUNC
(
FIPS_F_FIPS_SELFTEST_DSA
),
"FIPS_selftest_dsa"
},
{
ERR_FUNC
(
FIPS_F_FIPS_SELFTEST_ECDSA
),
"FIPS_selftest_ecdsa"
},
{
ERR_FUNC
(
FIPS_F_FIPS_SELFTEST_HMAC
),
"FIPS_selftest_hmac"
},
{
ERR_FUNC
(
FIPS_F_FIPS_SELFTEST_RNG
),
"FIPS_selftest_rng"
},
{
ERR_FUNC
(
FIPS_F_FIPS_SELFTEST_SHA1
),
"FIPS_selftest_sha1"
},
...
...
fips/ecdsa/Makefile
浏览文件 @
947ff113
...
...
@@ -22,8 +22,8 @@ TEST= fips_ecdsavs.c
APPS
=
LIB
=
$(TOP)
/libcrypto.a
LIBSRC
=
fips_ecdsa_lib.c fips_ecdsa_sign.c
LIBOBJ
=
fips_ecdsa_lib.o fips_ecdsa_sign.o
LIBSRC
=
fips_ecdsa_lib.c fips_ecdsa_sign.c
fips_ecdsa_selftest.c
LIBOBJ
=
fips_ecdsa_lib.o fips_ecdsa_sign.o
fips_ecdsa_selftest.o
SRC
=
$(LIBSRC)
...
...
fips/ecdsa/fips_ecdsa_selftest.c
0 → 100644
浏览文件 @
947ff113
/* fips/ecdsa/fips_ecdsa_selftest.c */
#define OPENSSL_FIPSAPI
#include <string.h>
#include <openssl/crypto.h>
#include <openssl/ec.h>
#include <openssl/ecdsa.h>
#include <openssl/fips.h>
#include <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/bn.h>
#ifdef OPENSSL_FIPS
static
const
unsigned
char
str1
[]
=
"12345678901234567890"
;
static
int
corrupt_ecdsa
=
0
;
void
FIPS_corrupt_ecdsa
()
{
corrupt_ecdsa
=
1
;
}
int
FIPS_selftest_ecdsa
()
{
EC_KEY
*
ec
=
NULL
;
int
ret
=
0
;
EVP_MD_CTX
mctx
;
ECDSA_SIG
*
esig
=
NULL
;
FIPS_md_ctx_init
(
&
mctx
);
ec
=
EC_KEY_new_by_curve_name
(
NID_secp384r1
);
if
(
ec
==
NULL
)
goto
err
;
EC_KEY_generate_key
(
ec
);
if
(
!
FIPS_digestinit
(
&
mctx
,
EVP_sha512
()))
goto
err
;
if
(
!
FIPS_digestupdate
(
&
mctx
,
str1
,
20
))
goto
err
;
esig
=
FIPS_ecdsa_sign_ctx
(
ec
,
&
mctx
);
if
(
!
esig
)
goto
err
;
if
(
corrupt_ecdsa
)
BN_add_word
(
esig
->
r
,
1
);
if
(
!
FIPS_digestinit
(
&
mctx
,
EVP_sha512
()))
goto
err
;
if
(
!
FIPS_digestupdate
(
&
mctx
,
str1
,
20
))
goto
err
;
if
(
FIPS_ecdsa_verify_ctx
(
ec
,
&
mctx
,
esig
)
!=
1
)
goto
err
;
ret
=
1
;
err:
FIPS_md_ctx_cleanup
(
&
mctx
);
if
(
ec
)
EC_KEY_free
(
ec
);
if
(
esig
)
FIPS_ecdsa_sig_free
(
esig
);
if
(
ret
==
0
)
FIPSerr
(
FIPS_F_FIPS_SELFTEST_ECDSA
,
FIPS_R_SELFTEST_FAILED
);
return
ret
;
}
#endif
fips/fips.c
浏览文件 @
947ff113
...
...
@@ -178,6 +178,7 @@ int FIPS_selftest(void)
&&
FIPS_selftest_aes_gcm
()
&&
FIPS_selftest_des
()
&&
FIPS_selftest_rsa
()
&&
FIPS_selftest_ecdsa
()
&&
FIPS_selftest_dsa
();
}
...
...
fips/fips.h
浏览文件 @
947ff113
...
...
@@ -86,6 +86,8 @@ int FIPS_selftest_rsa(void);
void
FIPS_corrupt_dsa
(
void
);
void
FIPS_corrupt_dsa_keygen
(
void
);
int
FIPS_selftest_dsa
(
void
);
int
FIPS_selftest_ecdsa
(
void
);
void
FIPS_corrupt_ecdsa
(
void
);
void
FIPS_corrupt_ec_keygen
(
void
);
void
FIPS_corrupt_rng
(
void
);
void
FIPS_rng_stick
(
void
);
...
...
@@ -195,6 +197,7 @@ void ERR_load_FIPS_strings(void);
#define FIPS_F_FIPS_SELFTEST_AES_GCM 130
#define FIPS_F_FIPS_SELFTEST_DES 111
#define FIPS_F_FIPS_SELFTEST_DSA 112
#define FIPS_F_FIPS_SELFTEST_ECDSA 131
#define FIPS_F_FIPS_SELFTEST_HMAC 113
#define FIPS_F_FIPS_SELFTEST_RNG 114
#define FIPS_F_FIPS_SELFTEST_SHA1 115
...
...
fips/fips_test_suite.c
浏览文件 @
947ff113
...
...
@@ -490,6 +490,9 @@ int main(int argc,char **argv)
}
else
if
(
!
strcmp
(
argv
[
1
],
"dsa"
))
{
FIPS_corrupt_dsa
();
printf
(
"DSA key generation and signature validation with corrupted KAT...
\n
"
);
}
else
if
(
!
strcmp
(
argv
[
1
],
"ecdsa"
))
{
FIPS_corrupt_ecdsa
();
printf
(
"ECDSA key generation and signature validation with corrupted KAT...
\n
"
);
}
else
if
(
!
strcmp
(
argv
[
1
],
"rsa"
))
{
FIPS_corrupt_rsa
();
printf
(
"RSA key generation and signature validation with corrupted KAT...
\n
"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录