Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
8857b380
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看板
提交
8857b380
编写于
3月 09, 2011
作者:
D
Dr. Stephen Henson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add ECDH to validated module.
上级
a6de7133
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
530 addition
and
6 deletion
+530
-6
CHANGES
CHANGES
+3
-0
Makefile.fips
Makefile.fips
+4
-2
Makefile.org
Makefile.org
+2
-0
crypto/ecdh/ech_key.c
crypto/ecdh/ech_key.c
+2
-0
crypto/ecdh/ech_ossl.c
crypto/ecdh/ech_ossl.c
+13
-0
fips/Makefile
fips/Makefile
+1
-1
fips/ecdh/Makefile
fips/ecdh/Makefile
+78
-0
fips/ecdh/fips_ecdhvs.c
fips/ecdh/fips_ecdhvs.c
+418
-0
fips/fips.h
fips/fips.h
+1
-0
test/Makefile
test/Makefile
+8
-3
未找到文件。
CHANGES
浏览文件 @
8857b380
...
@@ -4,6 +4,9 @@
...
@@ -4,6 +4,9 @@
Changes between 1.0.1 and 1.1.0 [xx XXX xxxx]
Changes between 1.0.1 and 1.1.0 [xx XXX xxxx]
*) Add ECDH code to fips module and fips_ecdhvs for primitives only testing.
[Steve Henson]
*) New algorithm test program fips_dhvs to handle DH primitives only testing.
*) New algorithm test program fips_dhvs to handle DH primitives only testing.
[Steve Henson]
[Steve Henson]
...
...
Makefile.fips
浏览文件 @
8857b380
...
@@ -148,13 +148,13 @@ SHLIBDIRS= crypto
...
@@ -148,13 +148,13 @@ SHLIBDIRS= crypto
SDIRS
=
\
SDIRS
=
\
sha hmac des aes modes
\
sha hmac des aes modes
\
bn ec rsa dsa ecdsa dh
\
bn ec rsa dsa ecdsa dh
\
buffer rand evp
# ecdh
cmac
buffer rand evp
ecdh
#
cmac
# keep in mind that the above list is adjusted by ./Configure
# keep in mind that the above list is adjusted by ./Configure
# according to no-xxx arguments...
# according to no-xxx arguments...
LINKDIRS
=
\
LINKDIRS
=
\
objects sha hmac des aes modes
\
objects sha hmac des aes modes
\
bn ec rsa dsa ecd
sa dh ec
dh engine
\
bn ec rsa dsa ecd
h ecdsa
dh engine
\
buffer bio stack lhash rand err
\
buffer bio stack lhash rand err
\
evp asn1 ui cmac
evp asn1 ui cmac
...
@@ -325,6 +325,8 @@ FIPS_EX_OBJ= ../crypto/aes/aes_cfb.o \
...
@@ -325,6 +325,8 @@ FIPS_EX_OBJ= ../crypto/aes/aes_cfb.o \
../crypto/ec/ecp_smpl.o
\
../crypto/ec/ecp_smpl.o
\
../crypto/ec/ec2_mult.o
\
../crypto/ec/ec2_mult.o
\
../crypto/ec/ec2_smpl.o
\
../crypto/ec/ec2_smpl.o
\
../crypto/ecdh/ech_key.o
\
../crypto/ecdh/ech_ossl.o
\
../crypto/ecdsa/ecs_ossl.o
\
../crypto/ecdsa/ecs_ossl.o
\
../crypto/evp/e_aes.o
\
../crypto/evp/e_aes.o
\
../crypto/evp/e_des3.o
\
../crypto/evp/e_des3.o
\
...
...
Makefile.org
浏览文件 @
8857b380
...
@@ -319,6 +319,8 @@ FIPS_EX_OBJ= ../crypto/aes/aes_cfb.o \
...
@@ -319,6 +319,8 @@ FIPS_EX_OBJ= ../crypto/aes/aes_cfb.o \
../crypto/ec/ecp_smpl.o
\
../crypto/ec/ecp_smpl.o
\
../crypto/ec/ec2_mult.o
\
../crypto/ec/ec2_mult.o
\
../crypto/ec/ec2_smpl.o
\
../crypto/ec/ec2_smpl.o
\
../crypto/ecdh/ech_key.o
\
../crypto/ecdh/ech_ossl.o
\
../crypto/ecdsa/ecs_ossl.o
\
../crypto/ecdsa/ecs_ossl.o
\
../crypto/evp/e_aes.o
\
../crypto/evp/e_aes.o
\
../crypto/evp/e_des3.o
\
../crypto/evp/e_des3.o
\
...
...
crypto/ecdh/ech_key.c
浏览文件 @
8857b380
...
@@ -67,6 +67,8 @@
...
@@ -67,6 +67,8 @@
*
*
*/
*/
#define OPENSSL_FIPSAPI
#include "ech_locl.h"
#include "ech_locl.h"
#ifndef OPENSSL_NO_ENGINE
#ifndef OPENSSL_NO_ENGINE
#include <openssl/engine.h>
#include <openssl/engine.h>
...
...
crypto/ecdh/ech_ossl.c
浏览文件 @
8857b380
...
@@ -67,6 +67,7 @@
...
@@ -67,6 +67,7 @@
*
*
*/
*/
#define OPENSSL_FIPSAPI
#include <string.h>
#include <string.h>
#include <limits.h>
#include <limits.h>
...
@@ -213,3 +214,15 @@ err:
...
@@ -213,3 +214,15 @@ err:
if
(
buf
)
OPENSSL_free
(
buf
);
if
(
buf
)
OPENSSL_free
(
buf
);
return
(
ret
);
return
(
ret
);
}
}
#ifdef OPENSSL_FIPSCANISTER
/* FIPS stanadlone version of ecdh_check: just return FIPS method */
ECDH_DATA
*
fips_ecdh_check
(
EC_KEY
*
key
)
{
static
ECDH_DATA
rv
=
{
0
,
0
,
0
,
&
openssl_ecdh_meth
};
return
&
rv
;
}
#endif
fips/Makefile
浏览文件 @
8857b380
...
@@ -35,7 +35,7 @@ AFLAGS=$(ASFLAGS)
...
@@ -35,7 +35,7 @@ AFLAGS=$(ASFLAGS)
LIBS
=
LIBS
=
FDIRS
=
sha rand des aes dsa ecdsa rsa dh hmac utl
FDIRS
=
sha rand des aes dsa ecd
h ecd
sa rsa dh hmac utl
GENERAL
=
Makefile README fips-lib.com install.com
GENERAL
=
Makefile README fips-lib.com install.com
...
...
fips/ecdh/Makefile
0 → 100644
浏览文件 @
8857b380
#
# OpenSSL/fips/ecdh/Makefile
#
DIR
=
ecdh
TOP
=
../..
CC
=
cc
INCLUDES
=
CFLAG
=
-g
INSTALL_PREFIX
=
OPENSSLDIR
=
/usr/local/ssl
INSTALLTOP
=
/usr/local/ssl
MAKEDEPPROG
=
makedepend
MAKEDEPEND
=
$(TOP)
/util/domd
$(TOP)
-MD
$(MAKEDEPPROG)
MAKEFILE
=
Makefile
AR
=
ar r
CFLAGS
=
$(INCLUDES)
$(CFLAG)
GENERAL
=
Makefile
TEST
=
fips_ecdhvs.c
APPS
=
LIB
=
$(TOP)
/libcrypto.a
LIBSRC
=
LIBOBJ
=
SRC
=
$(LIBSRC)
EXHEADER
=
HEADER
=
$(EXHEADER)
ALL
=
$(GENERAL)
$(SRC)
$(HEADER)
top
:
(
cd
$(TOP)
;
$(MAKE)
DIRS
=
fips
FDIRS
=
$(DIR)
sub_all
)
all
:
lib
lib
:
$(LIBOBJ)
@
echo
$(LIBOBJ)
>
lib
files
:
$(PERL)
$(TOP)
/util/files.pl Makefile
>>
$(TOP)
/MINFO
links
:
@
$(PERL)
$(TOP)
/util/mklink.pl
$(TOP)
/include/openssl
$(EXHEADER)
@
$(PERL)
$(TOP)
/util/mklink.pl
$(TOP)
/test
$(TEST)
@
$(PERL)
$(TOP)
/util/mklink.pl
$(TOP)
/apps
$(APPS)
install
:
@
headerlist
=
"
$(EXHEADER)
"
;
for
i
in
$$
headerlist
;
\
do
\
(
cp
$$
i
$(INSTALL_PREFIX)$(INSTALLTOP)
/include/openssl/
$$
i
;
\
chmod
644
$(INSTALL_PREFIX)$(INSTALLTOP)
/include/openssl/
$$
i
)
;
\
done
tags
:
ctags
$(SRC)
tests
:
fips_test
:
lint
:
lint
-DLINT
$(INCLUDES)
$(SRC)
>
fluff
depend
:
$(MAKEDEPEND)
--
$(CFLAG)
$(INCLUDES)
$(DEPFLAG)
--
$(SRC)
$(TEST)
dclean
:
$(PERL)
-pe
'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}'
$(MAKEFILE)
>
Makefile.new
mv
-f
Makefile.new
$(MAKEFILE)
clean
:
rm
-f
*
.o
*
.obj lib tags core .pure .nfs
*
*
.old
*
.bak fluff
# DO NOT DELETE THIS LINE -- make depend depends on it.
fips/ecdh/fips_ecdhvs.c
0 → 100644
浏览文件 @
8857b380
/* fips/ecdh/fips_ecdhvs.c */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
*/
/* ====================================================================
* Copyright (c) 2011 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* licensing@OpenSSL.org.
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*/
#define OPENSSL_FIPSAPI
#include <openssl/opensslconf.h>
#ifndef OPENSSL_FIPS
#include <stdio.h>
int
main
(
int
argc
,
char
**
argv
)
{
printf
(
"No FIPS ECDH support
\n
"
);
return
(
0
);
}
#else
#include <openssl/crypto.h>
#include <openssl/bn.h>
#include <openssl/ecdh.h>
#include <openssl/fips.h>
#include <openssl/err.h>
#include <openssl/evp.h>
#include <string.h>
#include <ctype.h>
#include "fips_utl.h"
static
const
EVP_MD
*
parse_md
(
char
*
line
)
{
char
*
p
;
if
(
line
[
0
]
!=
'['
||
line
[
1
]
!=
'E'
)
return
NULL
;
p
=
strchr
(
line
,
'-'
);
if
(
!
p
)
return
NULL
;
line
=
p
+
1
;
p
=
strchr
(
line
,
']'
);
if
(
!
p
)
return
NULL
;
*
p
=
0
;
p
=
line
;
while
(
isspace
(
*
p
))
p
++
;
if
(
!
strcmp
(
p
,
"SHA1"
))
return
EVP_sha1
();
else
if
(
!
strcmp
(
p
,
"SHA224"
))
return
EVP_sha224
();
else
if
(
!
strcmp
(
p
,
"SHA256"
))
return
EVP_sha256
();
else
if
(
!
strcmp
(
p
,
"SHA384"
))
return
EVP_sha384
();
else
if
(
!
strcmp
(
p
,
"SHA512"
))
return
EVP_sha512
();
else
return
NULL
;
}
static
int
lookup_curve
(
char
*
cname
)
{
char
*
p
;
p
=
strchr
(
cname
,
':'
);
if
(
!
p
)
{
fprintf
(
stderr
,
"Parse error: missing :
\n
"
);
return
NID_undef
;
}
cname
=
p
+
1
;
while
(
isspace
(
*
cname
))
cname
++
;
p
=
strchr
(
cname
,
']'
);
if
(
!
p
)
{
fprintf
(
stderr
,
"Parse error: missing ]
\n
"
);
return
NID_undef
;
}
*
p
=
0
;
if
(
!
strcmp
(
cname
,
"B-163"
))
return
NID_sect163r2
;
if
(
!
strcmp
(
cname
,
"B-233"
))
return
NID_sect233r1
;
if
(
!
strcmp
(
cname
,
"B-283"
))
return
NID_sect283r1
;
if
(
!
strcmp
(
cname
,
"B-409"
))
return
NID_sect409r1
;
if
(
!
strcmp
(
cname
,
"B-571"
))
return
NID_sect571r1
;
if
(
!
strcmp
(
cname
,
"K-163"
))
return
NID_sect163k1
;
if
(
!
strcmp
(
cname
,
"K-233"
))
return
NID_sect233k1
;
if
(
!
strcmp
(
cname
,
"K-283"
))
return
NID_sect283k1
;
if
(
!
strcmp
(
cname
,
"K-409"
))
return
NID_sect409k1
;
if
(
!
strcmp
(
cname
,
"K-571"
))
return
NID_sect571k1
;
if
(
!
strcmp
(
cname
,
"P-192"
))
return
NID_X9_62_prime192v1
;
if
(
!
strcmp
(
cname
,
"P-224"
))
return
NID_secp224r1
;
if
(
!
strcmp
(
cname
,
"P-256"
))
return
NID_X9_62_prime256v1
;
if
(
!
strcmp
(
cname
,
"P-384"
))
return
NID_secp384r1
;
if
(
!
strcmp
(
cname
,
"P-521"
))
return
NID_secp521r1
;
fprintf
(
stderr
,
"Unknown Curve name %s
\n
"
,
cname
);
return
NID_undef
;
}
static
EC_POINT
*
make_peer
(
EC_GROUP
*
group
,
BIGNUM
*
x
,
BIGNUM
*
y
)
{
EC_POINT
*
peer
;
int
rv
;
BN_CTX
*
c
;
peer
=
EC_POINT_new
(
group
);
if
(
!
peer
)
return
NULL
;
c
=
BN_CTX_new
();
if
(
EC_METHOD_get_field_type
(
EC_GROUP_method_of
(
group
))
==
NID_X9_62_characteristic_two_field
)
rv
=
EC_POINT_set_affine_coordinates_GF2m
(
group
,
peer
,
x
,
y
,
c
);
else
rv
=
EC_POINT_set_affine_coordinates_GFp
(
group
,
peer
,
x
,
y
,
c
);
BN_CTX_free
(
c
);
if
(
rv
)
return
peer
;
EC_POINT_free
(
peer
);
return
NULL
;
}
static
int
ec_print_pubkey
(
FILE
*
out
,
EC_KEY
*
key
)
{
const
EC_POINT
*
pt
;
const
EC_GROUP
*
grp
;
const
EC_METHOD
*
meth
;
int
rv
;
BIGNUM
*
tx
,
*
ty
;
BN_CTX
*
ctx
;
ctx
=
BN_CTX_new
();
if
(
!
ctx
)
return
0
;
tx
=
BN_CTX_get
(
ctx
);
ty
=
BN_CTX_get
(
ctx
);
if
(
!
tx
||
!
ty
)
return
0
;
grp
=
EC_KEY_get0_group
(
key
);
pt
=
EC_KEY_get0_public_key
(
key
);
meth
=
EC_GROUP_method_of
(
grp
);
if
(
EC_METHOD_get_field_type
(
meth
)
==
NID_X9_62_prime_field
)
rv
=
EC_POINT_get_affine_coordinates_GFp
(
grp
,
pt
,
tx
,
ty
,
ctx
);
else
rv
=
EC_POINT_get_affine_coordinates_GF2m
(
grp
,
pt
,
tx
,
ty
,
ctx
);
do_bn_print_name
(
out
,
"QeIUTx"
,
tx
);
do_bn_print_name
(
out
,
"QeIUTy"
,
ty
);
BN_CTX_free
(
ctx
);
return
rv
;
}
static
void
ec_output_Zhash
(
FILE
*
out
,
int
exout
,
EC_GROUP
*
group
,
BIGNUM
*
ix
,
BIGNUM
*
iy
,
BIGNUM
*
id
,
BIGNUM
*
cx
,
BIGNUM
*
cy
,
const
EVP_MD
*
md
,
unsigned
char
*
rhash
,
size_t
rhashlen
)
{
EC_KEY
*
ec
=
NULL
;
EC_POINT
*
peerkey
=
NULL
;
unsigned
char
*
Z
;
unsigned
char
chash
[
EVP_MAX_MD_SIZE
];
int
Zlen
;
ec
=
EC_KEY_new
();
EC_KEY_set_group
(
ec
,
group
);
peerkey
=
make_peer
(
group
,
cx
,
cy
);
if
(
rhash
==
NULL
)
{
rhashlen
=
M_EVP_MD_size
(
md
);
EC_KEY_generate_key
(
ec
);
ec_print_pubkey
(
out
,
ec
);
}
else
{
EC_KEY_set_public_key_affine_coordinates
(
ec
,
ix
,
iy
);
EC_KEY_set_private_key
(
ec
,
id
);
}
Zlen
=
(
EC_GROUP_get_degree
(
group
)
+
7
)
/
8
;
Z
=
OPENSSL_malloc
(
Zlen
);
if
(
!
Z
)
exit
(
1
);
ECDH_compute_key
(
Z
,
Zlen
,
peerkey
,
ec
,
0
);
if
(
exout
)
OutputValue
(
"Z"
,
Z
,
Zlen
,
out
,
0
);
FIPS_digest
(
Z
,
Zlen
,
chash
,
NULL
,
md
);
OutputValue
(
rhash
?
"IUTHashZZ"
:
"HashZZ"
,
chash
,
rhashlen
,
out
,
0
);
if
(
rhash
)
{
fprintf
(
out
,
"Result = %s
\n
"
,
memcmp
(
chash
,
rhash
,
rhashlen
)
?
"F"
:
"P"
);
}
OPENSSL_cleanse
(
Z
,
Zlen
);
OPENSSL_free
(
Z
);
EC_KEY_free
(
ec
);
EC_POINT_free
(
peerkey
);
}
int
main
(
int
argc
,
char
**
argv
)
{
char
**
args
=
argv
+
1
;
int
argn
=
argc
-
1
;
FILE
*
in
,
*
out
;
char
buf
[
2048
],
lbuf
[
2048
];
unsigned
char
*
rhash
;
long
rhashlen
;
BIGNUM
*
cx
=
NULL
,
*
cy
=
NULL
;
BIGNUM
*
id
=
NULL
,
*
ix
=
NULL
,
*
iy
=
NULL
;
const
EVP_MD
*
md
=
NULL
;
EC_GROUP
*
group
=
NULL
;
char
*
keyword
=
NULL
,
*
value
=
NULL
;
int
do_verify
=
-
1
,
exout
=
0
;
int
curve_nids
[
5
]
=
{
0
,
0
,
0
,
0
,
0
};
int
param_set
=
-
1
;
fips_set_error_print
();
if
(
!
FIPS_mode_set
(
1
))
exit
(
1
);
if
(
argn
&&
!
strcmp
(
*
args
,
"ecdhver"
))
{
do_verify
=
1
;
args
++
;
argn
--
;
}
else
if
(
argn
&&
!
strcmp
(
*
args
,
"ecdhgen"
))
{
do_verify
=
0
;
args
++
;
argn
--
;
}
if
(
argn
&&
!
strcmp
(
*
args
,
"-exout"
))
{
exout
=
1
;
args
++
;
argn
--
;
}
if
(
do_verify
==
-
1
)
{
fprintf
(
stderr
,
"%s [ecdhver|ecdhgen|] [-exout] (infile outfile)
\n
"
,
argv
[
0
]);
exit
(
1
);
}
if
(
argn
==
2
)
{
in
=
fopen
(
*
args
,
"r"
);
if
(
!
in
)
{
fprintf
(
stderr
,
"Error opening input file
\n
"
);
exit
(
1
);
}
out
=
fopen
(
args
[
1
],
"w"
);
if
(
!
out
)
{
fprintf
(
stderr
,
"Error opening output file
\n
"
);
exit
(
1
);
}
}
else
if
(
argn
==
0
)
{
in
=
stdin
;
out
=
stdout
;
}
else
{
fprintf
(
stderr
,
"%s [dhver|dhgen|] [-exout] (infile outfile)
\n
"
,
argv
[
0
]);
exit
(
1
);
}
while
(
fgets
(
buf
,
sizeof
(
buf
),
in
)
!=
NULL
)
{
fputs
(
buf
,
out
);
if
(
buf
[
0
]
==
'['
&&
buf
[
1
]
==
'E'
)
{
int
c
=
buf
[
2
];
if
(
c
<
'A'
||
c
>
'E'
)
goto
parse_error
;
param_set
=
c
-
'A'
;
/* If just [E?] then initial paramset */
if
(
buf
[
3
]
==
']'
)
continue
;
if
(
group
)
EC_GROUP_free
(
group
);
group
=
EC_GROUP_new_by_curve_name
(
curve_nids
[
c
-
'A'
]);
}
if
(
strlen
(
buf
)
>
10
&&
!
strncmp
(
buf
,
"[Curve"
,
6
))
{
int
nid
;
if
(
param_set
==
-
1
)
goto
parse_error
;
nid
=
lookup_curve
(
buf
);
if
(
nid
==
NID_undef
)
goto
parse_error
;
curve_nids
[
param_set
]
=
nid
;
}
if
(
strlen
(
buf
)
>
6
&&
!
strncmp
(
buf
,
"[E"
,
2
))
{
md
=
parse_md
(
buf
);
if
(
md
==
NULL
)
goto
parse_error
;
continue
;
}
if
(
!
parse_line
(
&
keyword
,
&
value
,
lbuf
,
buf
))
continue
;
if
(
!
strcmp
(
keyword
,
"QeCAVSx"
))
{
if
(
!
do_hex2bn
(
&
cx
,
value
))
goto
parse_error
;
}
else
if
(
!
strcmp
(
keyword
,
"QeCAVSy"
))
{
if
(
!
do_hex2bn
(
&
cy
,
value
))
goto
parse_error
;
if
(
do_verify
==
0
)
ec_output_Zhash
(
out
,
exout
,
group
,
NULL
,
NULL
,
NULL
,
cx
,
cy
,
md
,
rhash
,
rhashlen
);
}
else
if
(
!
strcmp
(
keyword
,
"deIUT"
))
{
if
(
!
do_hex2bn
(
&
id
,
value
))
goto
parse_error
;
}
else
if
(
!
strcmp
(
keyword
,
"QeIUTx"
))
{
if
(
!
do_hex2bn
(
&
ix
,
value
))
goto
parse_error
;
}
else
if
(
!
strcmp
(
keyword
,
"QeIUTy"
))
{
if
(
!
do_hex2bn
(
&
iy
,
value
))
goto
parse_error
;
}
else
if
(
!
strcmp
(
keyword
,
"CAVSHashZZ"
))
{
if
(
!
md
)
goto
parse_error
;
rhash
=
hex2bin_m
(
value
,
&
rhashlen
);
if
(
!
rhash
||
rhashlen
!=
M_EVP_MD_size
(
md
))
goto
parse_error
;
ec_output_Zhash
(
out
,
exout
,
group
,
ix
,
iy
,
id
,
cx
,
cy
,
md
,
rhash
,
rhashlen
);
}
}
return
0
;
parse_error:
fprintf
(
stderr
,
"Error Parsing request file
\n
"
);
exit
(
1
);
}
#endif
fips/fips.h
浏览文件 @
8857b380
...
@@ -165,6 +165,7 @@ void FIPS_set_locking_callbacks(void (*func)(int mode, int type,
...
@@ -165,6 +165,7 @@ void FIPS_set_locking_callbacks(void (*func)(int mode, int type,
#define ECDSA_SIG_free FIPS_ecdsa_sig_free
#define ECDSA_SIG_free FIPS_ecdsa_sig_free
#define ecdsa_check fips_ecdsa_check
#define ecdsa_check fips_ecdsa_check
#define ecdh_check fips_ecdh_check
#endif
#endif
...
...
test/Makefile
浏览文件 @
8857b380
...
@@ -76,6 +76,7 @@ FIPS_DSSVS= fips_dssvs
...
@@ -76,6 +76,7 @@ FIPS_DSSVS= fips_dssvs
FIPS_RNGVS
=
fips_rngvs
FIPS_RNGVS
=
fips_rngvs
FIPS_DRBGVS
=
fips_drbgvs
FIPS_DRBGVS
=
fips_drbgvs
FIPS_DHVS
=
fips_dhvs
FIPS_DHVS
=
fips_dhvs
FIPS_ECDHVS
=
fips_ecdhvs
FIPS_ECDSAVS
=
fips_ecdsavs
FIPS_ECDSAVS
=
fips_ecdsavs
FIPS_TEST_SUITE
=
fips_test_suite
FIPS_TEST_SUITE
=
fips_test_suite
...
@@ -98,7 +99,8 @@ FIPSEXE=$(FIPS_SHATEST)$(EXE_EXT) $(FIPS_DESTEST)$(EXE_EXT) \
...
@@ -98,7 +99,8 @@ FIPSEXE=$(FIPS_SHATEST)$(EXE_EXT) $(FIPS_DESTEST)$(EXE_EXT) \
$(FIPS_DSSVS)$(EXE_EXT)
$(FIPS_DSATEST)$(EXE_EXT)
\
$(FIPS_DSSVS)$(EXE_EXT)
$(FIPS_DSATEST)$(EXE_EXT)
\
$(FIPS_RNGVS)$(EXE_EXT)
$(FIPS_DRBGVS)$(EXE_EXT)
\
$(FIPS_RNGVS)$(EXE_EXT)
$(FIPS_DRBGVS)$(EXE_EXT)
\
$(FIPS_DHVS)$(EXE_EXT)
$(FIPS_TEST_SUITE)$(EXE_EXT)
\
$(FIPS_DHVS)$(EXE_EXT)
$(FIPS_TEST_SUITE)$(EXE_EXT)
\
$(FIPS_GCMTEST)$(EXE_EXT)
$(FIPS_ECDSAVS)$(EXE_EXT)
$(FIPS_GCMTEST)$(EXE_EXT)
$(FIPS_ECDSAVS)$(EXE_EXT)
\
$(FIPS_ECDHVS)$(EXE_EXT)
# $(METHTEST)$(EXE_EXT)
# $(METHTEST)$(EXE_EXT)
...
@@ -115,7 +117,7 @@ OBJ= $(BNTEST).o $(ECTEST).o $(ECDSATEST).o $(ECDHTEST).o $(IDEATEST).o \
...
@@ -115,7 +117,7 @@ OBJ= $(BNTEST).o $(ECTEST).o $(ECDSATEST).o $(ECDHTEST).o $(IDEATEST).o \
$(FIPS_RSASTEST)
.o
$(FIPS_RSAGTEST)
.o
$(FIPS_GCMTEST)
.o
\
$(FIPS_RSASTEST)
.o
$(FIPS_RSAGTEST)
.o
$(FIPS_GCMTEST)
.o
\
$(FIPS_DSSVS)
.o
$(FIPS_DSATEST)
.o
$(FIPS_RNGVS)
.o
$(FIPS_DRBGVS)
.o
\
$(FIPS_DSSVS)
.o
$(FIPS_DSATEST)
.o
$(FIPS_RNGVS)
.o
$(FIPS_DRBGVS)
.o
\
$(FIPS_TEST_SUITE)
.o
$(FIPS_DHVS)
.o
$(FIPS_ECDSAVS)
.o
\
$(FIPS_TEST_SUITE)
.o
$(FIPS_DHVS)
.o
$(FIPS_ECDSAVS)
.o
\
$(EVPTEST)
.o
$(IGETEST)
.o
$(JPAKETEST)
.o
$(
FIPS_ECDHVS)
.o
$(
EVPTEST)
.o
$(IGETEST)
.o
$(JPAKETEST)
.o
SRC
=
$(BNTEST)
.c
$(ECTEST)
.c
$(ECDSATEST)
.c
$(ECDHTEST)
.c
$(IDEATEST)
.c
\
SRC
=
$(BNTEST)
.c
$(ECTEST)
.c
$(ECDSATEST)
.c
$(ECDHTEST)
.c
$(IDEATEST)
.c
\
$(MD2TEST)
.c
$(MD4TEST)
.c
$(MD5TEST)
.c
\
$(MD2TEST)
.c
$(MD4TEST)
.c
$(MD5TEST)
.c
\
$(HMACTEST)
.c
$(WPTEST)
.c
\
$(HMACTEST)
.c
$(WPTEST)
.c
\
...
@@ -128,7 +130,7 @@ SRC= $(BNTEST).c $(ECTEST).c $(ECDSATEST).c $(ECDHTEST).c $(IDEATEST).c \
...
@@ -128,7 +130,7 @@ SRC= $(BNTEST).c $(ECTEST).c $(ECDSATEST).c $(ECDHTEST).c $(IDEATEST).c \
$(FIPS_RSASTEST)
.c
$(FIPS_RSAGTEST)
.c
$(FIPS_GCMTEST)
.c
\
$(FIPS_RSASTEST)
.c
$(FIPS_RSAGTEST)
.c
$(FIPS_GCMTEST)
.c
\
$(FIPS_DSSVS)
.c
$(FIPS_DSATEST)
.c
$(FIPS_RNGVS)
.c
$(FIPS_DRBGVS)
.c
\
$(FIPS_DSSVS)
.c
$(FIPS_DSATEST)
.c
$(FIPS_RNGVS)
.c
$(FIPS_DRBGVS)
.c
\
$(FIPS_TEST_SUITE)
.c
$(FIPS_DHVS)
.c
$(FIPS_ECDSAVS)
.c
\
$(FIPS_TEST_SUITE)
.c
$(FIPS_DHVS)
.c
$(FIPS_ECDSAVS)
.c
\
$(EVPTEST)
.c
$(IGETEST)
.c
$(JPAKETEST)
.c
$(
FIPS_ECDHVS)
.c
$(
EVPTEST)
.c
$(IGETEST)
.c
$(JPAKETEST)
.c
EXHEADER
=
EXHEADER
=
HEADER
=
$(EXHEADER)
HEADER
=
$(EXHEADER)
...
@@ -476,6 +478,9 @@ $(FIPS_DSSVS)$(EXE_EXT): $(FIPS_DSSVS).o $(DLIBCRYPTO)
...
@@ -476,6 +478,9 @@ $(FIPS_DSSVS)$(EXE_EXT): $(FIPS_DSSVS).o $(DLIBCRYPTO)
$(FIPS_DHVS)$(EXE_EXT)
:
$(FIPS_DHVS).o $(DLIBCRYPTO)
$(FIPS_DHVS)$(EXE_EXT)
:
$(FIPS_DHVS).o $(DLIBCRYPTO)
@
target
=
$(FIPS_DHVS)
;
$(FIPS_BUILD_CMD)
@
target
=
$(FIPS_DHVS)
;
$(FIPS_BUILD_CMD)
$(FIPS_ECDHVS)$(EXE_EXT)
:
$(FIPS_ECDHVS).o $(DLIBCRYPTO)
@
target
=
$(FIPS_ECDHVS)
;
$(FIPS_BUILD_CMD)
$(FIPS_ECDSAVS)$(EXE_EXT)
:
$(FIPS_ECDSAVS).o $(DLIBCRYPTO)
$(FIPS_ECDSAVS)$(EXE_EXT)
:
$(FIPS_ECDSAVS).o $(DLIBCRYPTO)
@
target
=
$(FIPS_ECDSAVS)
;
$(FIPS_BUILD_CMD)
@
target
=
$(FIPS_ECDSAVS)
;
$(FIPS_BUILD_CMD)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录