forked from wolfSSL/wolfssl
add selftest version for newer 4.1.0 validation
This commit is contained in:
26
configure.ac
26
configure.ac
@ -2531,13 +2531,29 @@ AS_IF([test "x$ENABLED_FIPS" = "xyes" && test "x$FIPS_VERSION" != "xrand"],
|
||||
AC_ARG_ENABLE([selftest],
|
||||
[AS_HELP_STRING([--enable-selftest],[Enable selftest, Will NOT work w/o CAVP selftest license (default: disabled)])],
|
||||
[ ENABLED_SELFTEST=$enableval ],
|
||||
[ ENABLED_SELFTEST=no ]
|
||||
[ ENABLED_SELFTEST="no" ]
|
||||
)
|
||||
|
||||
if test "x$ENABLED_SELFTEST" = "xyes"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DHAVE_SELFTEST"
|
||||
fi
|
||||
AS_CASE([$ENABLED_SELFTEST],
|
||||
["v2"],[
|
||||
# selftest v2 (wolfCrypt 4.1.0)
|
||||
ENABLED_SELFTEST="yes"
|
||||
SELFTEST_VERSION="v2"
|
||||
],
|
||||
["no"],[SELFTEST_VERSION="none"],
|
||||
[
|
||||
# selftest v1 (wolfCrypt 3.14.2)
|
||||
ENABLED_SELFTEST="yes"
|
||||
SELFTEST_VERSION="v1"
|
||||
])
|
||||
|
||||
AS_CASE([$SELFTEST_VERSION],
|
||||
["v2"],[
|
||||
AM_CFLAGS="$AM_CFLAGS -DHAVE_SELFTEST -DHAVE_SELFTEST_VERSION=2"
|
||||
],
|
||||
["v1"],[
|
||||
AM_CFLAGS="$AM_CFLAGS -DHAVE_SELFTEST"
|
||||
])
|
||||
|
||||
|
||||
# set sha224 default
|
||||
|
@ -128,9 +128,10 @@ extern int wc_InitRsaHw(RsaKey* key);
|
||||
|
||||
#define ERROR_OUT(err, eLabel) { ret = (err); goto eLabel; }
|
||||
|
||||
#if defined(HAVE_SELFTEST) || ( !defined(NO_SKID) && \
|
||||
( !defined(HAVE_FIPS) || \
|
||||
!defined(HAVE_FIPS_VERSION) ))
|
||||
#if !defined(NO_SKID) && (!defined(HAVE_FIPS) || !defined(HAVE_FIPS_VERSION))
|
||||
#if !defined(HAVE_SELFTEST) || (defined(HAVE_SELFTEST) && \
|
||||
(!defined(HAVE_SELFTEST_VERSION) || \
|
||||
HAVE_SELFTEST_VERSION < 2))
|
||||
#ifndef WOLFSSL_AES_KEY_SIZE_ENUM
|
||||
#define WOLFSSL_AES_KEY_SIZE_ENUM
|
||||
enum Asn_Misc {
|
||||
@ -140,6 +141,7 @@ extern int wc_InitRsaHw(RsaKey* key);
|
||||
AES_256_KEY_SIZE = 32
|
||||
};
|
||||
#endif
|
||||
#endif /* HAVE_SELFTEST */
|
||||
#endif
|
||||
#ifdef WOLFSSL_RENESAS_TSIP_TLS
|
||||
void tsip_inform_key_position(const word32 key_n_start,
|
||||
|
@ -11876,7 +11876,8 @@ static int rsa_pss_test(WC_RNG* rng, RsaKey* key)
|
||||
plainSz = ret;
|
||||
TEST_SLEEP();
|
||||
|
||||
#ifdef HAVE_SELFTEST
|
||||
#if defined(HAVE_SELFTEST) && \
|
||||
(!defined(HAVE_SELFTEST_VERSION) || (HAVE_SELFTEST_VERSION < 2))
|
||||
ret = wc_RsaPSS_CheckPadding_ex(digest, digestSz, plain, plainSz,
|
||||
hash[j], -1);
|
||||
#else
|
||||
@ -11951,7 +11952,8 @@ static int rsa_pss_test(WC_RNG* rng, RsaKey* key)
|
||||
WC_ASYNC_FLAG_CALL_AGAIN);
|
||||
#endif
|
||||
if (ret >= 0) {
|
||||
#ifdef HAVE_SELFTEST
|
||||
#if defined(HAVE_SELFTEST) && \
|
||||
(!defined(HAVE_SELFTEST_VERSION) || (HAVE_SELFTEST_VERSION < 2))
|
||||
ret = wc_RsaPSS_CheckPadding_ex(digest, digestSz, sig, plainSz,
|
||||
hash[0], 0);
|
||||
#else
|
||||
@ -11980,7 +11982,8 @@ static int rsa_pss_test(WC_RNG* rng, RsaKey* key)
|
||||
plainSz = ret;
|
||||
TEST_SLEEP();
|
||||
|
||||
#ifdef HAVE_SELFTEST
|
||||
#if defined(HAVE_SELFTEST) && \
|
||||
(!defined(HAVE_SELFTEST_VERSION) || (HAVE_SELFTEST_VERSION < 2))
|
||||
ret = wc_RsaPSS_CheckPadding_ex(digest, digestSz, plain, plainSz, hash[0],
|
||||
0);
|
||||
#else
|
||||
@ -12058,7 +12061,8 @@ static int rsa_pss_test(WC_RNG* rng, RsaKey* key)
|
||||
#else
|
||||
len = -3;
|
||||
#endif
|
||||
#ifdef HAVE_SELFTEST
|
||||
#if defined(HAVE_SELFTEST) && \
|
||||
(!defined(HAVE_SELFTEST_VERSION) || (HAVE_SELFTEST_VERSION < 2))
|
||||
ret = wc_RsaPSS_CheckPadding_ex(digest, digestSz, plain, plainSz, hash[0],
|
||||
len);
|
||||
#else
|
||||
@ -12072,7 +12076,8 @@ static int rsa_pss_test(WC_RNG* rng, RsaKey* key)
|
||||
#else
|
||||
len = plainSz - digestSz - 1;
|
||||
#endif
|
||||
#ifdef HAVE_SELFTEST
|
||||
#if defined(HAVE_SELFTEST) && \
|
||||
(!defined(HAVE_SELFTEST_VERSION) || (HAVE_SELFTEST_VERSION < 2))
|
||||
ret = wc_RsaPSS_CheckPadding_ex(digest, digestSz, plain, plainSz, hash[0],
|
||||
len);
|
||||
#else
|
||||
|
@ -1358,7 +1358,8 @@ enum Misc {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SELFTEST
|
||||
#if defined(HAVE_SELFTEST) && \
|
||||
(!defined(HAVE_SELFTEST_VERSION) || (HAVE_SELFTEST_VERSION < 2))
|
||||
#ifndef WOLFSSL_AES_KEY_SIZE_ENUM
|
||||
#define WOLFSSL_AES_KEY_SIZE_ENUM
|
||||
AES_IV_SIZE = 16,
|
||||
|
@ -154,8 +154,9 @@ enum Pkcs7_Misc {
|
||||
MAX_SEQ_SZ + ASN_NAME_MAX + MAX_SN_SZ +
|
||||
MAX_SEQ_SZ + MAX_ALGO_SZ + 1 + MAX_ENCRYPTED_KEY_SZ,
|
||||
#if (defined(HAVE_FIPS) && defined(HAVE_FIPS_VERSION) && \
|
||||
(HAVE_FIPS_VERSION >= 2)) || defined(HAVE_SELFTEST)
|
||||
/* In the event of fips cert 3389 or CAVP selftest build, these enums are
|
||||
(HAVE_FIPS_VERSION >= 2)) || (defined(HAVE_SELFTEST) && \
|
||||
(!defined(HAVE_SELFTEST_VERSION) || HAVE_SELFTEST_VERSION < 2))
|
||||
/* In the event of fips cert 3389 or CAVP selftest v1 build, these enums are
|
||||
* not in aes.h for use with pkcs7 so enumerate it here outside the fips
|
||||
* boundary */
|
||||
GCM_NONCE_MID_SZ = 12, /* The usual default nonce size for AES-GCM. */
|
||||
|
@ -58,7 +58,8 @@ enum {
|
||||
WC_SHA3_512_DIGEST_SIZE = 64,
|
||||
WC_SHA3_512_COUNT = 9,
|
||||
|
||||
#ifndef HAVE_SELFTEST
|
||||
#if !defined(HAVE_SELFTEST) || \
|
||||
defined(HAVE_SELFTEST_VERSION) && (HAVE_SELFTEST_VERSION >= 2)
|
||||
/* These values are used for HMAC, not SHA-3 directly.
|
||||
* They come from from FIPS PUB 202. */
|
||||
WC_SHA3_224_BLOCK_SIZE = 144,
|
||||
|
Reference in New Issue
Block a user