Merge pull request #3586 from tmael/cc310_tests

Fix Cryptocell and revert test.c use of static const
This commit is contained in:
David Garske
2020-12-22 16:58:25 -08:00
committed by GitHub
4 changed files with 499 additions and 493 deletions

View File

@@ -196,7 +196,7 @@ AC_ARG_ENABLE([linuxkm-defaults],
if test "$ENABLED_LINUXKM_DEFAULTS" = "yes" if test "$ENABLED_LINUXKM_DEFAULTS" = "yes"
then then
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DH_CONST -DWOLFSSL_SP_MOD_WORD_RP -DWOLFSSL_OLD_PRIME_CHECK -DWOLFSSL_SP_DIV_64 -DWOLFSSL_SP_DIV_WORD_HALF" AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DH_CONST -DWOLFSSL_SP_MOD_WORD_RP -DWOLFSSL_OLD_PRIME_CHECK -DWOLFSSL_SP_DIV_64 -DWOLFSSL_SP_DIV_WORD_HALF -DWOLFSSL_SMALL_STACK_STATIC"
fi fi
AC_ARG_WITH([linux-source], AC_ARG_WITH([linux-source],

View File

@@ -4911,16 +4911,15 @@ static int wc_ecc_sign_hash_hw(const byte* in, word32 inlen,
return WC_HW_E; return WC_HW_E;
} }
#elif defined(WOLFSSL_CRYPTOCELL) #elif defined(WOLFSSL_CRYPTOCELL)
/* truncate if hash is longer than key size */
if (msgLenInBytes > keysize) {
msgLenInBytes = keysize;
}
hash_mode = cc310_hashModeECC(msgLenInBytes); hash_mode = cc310_hashModeECC(msgLenInBytes);
if (hash_mode == CRYS_ECPKI_HASH_OpModeLast) { if (hash_mode == CRYS_ECPKI_HASH_OpModeLast) {
hash_mode = cc310_hashModeECC(keysize); hash_mode = cc310_hashModeECC(keysize);
hash_mode = CRYS_ECPKI_HASH_SHA256_mode; hash_mode = CRYS_ECPKI_HASH_SHA256_mode;
}
/* truncate if hash is longer than key size */
if (msgLenInBytes > keysize) {
msgLenInBytes = keysize;
} }
/* create signature from an input buffer using a private key*/ /* create signature from an input buffer using a private key*/
@@ -6390,15 +6389,15 @@ int wc_ecc_verify_hash_ex(mp_int *r, mp_int *s, const byte* hash,
return err; return err;
} }
/* truncate if hash is longer than key size */
if (msgLenInBytes > keySz) {
msgLenInBytes = keySz;
}
hash_mode = cc310_hashModeECC(msgLenInBytes); hash_mode = cc310_hashModeECC(msgLenInBytes);
if (hash_mode == CRYS_ECPKI_HASH_OpModeLast) { if (hash_mode == CRYS_ECPKI_HASH_OpModeLast) {
/* hash_mode = */ cc310_hashModeECC(keySz); /* hash_mode = */ cc310_hashModeECC(keySz);
hash_mode = CRYS_ECPKI_HASH_SHA256_mode; hash_mode = CRYS_ECPKI_HASH_SHA256_mode;
} }
/* truncate if hash is longer than key size */
if (msgLenInBytes > keySz) {
msgLenInBytes = keySz;
}
/* verify the signature using the public key */ /* verify the signature using the public key */
err = CRYS_ECDSA_Verify(&sigCtxTemp, err = CRYS_ECDSA_Verify(&sigCtxTemp,

File diff suppressed because it is too large Load Diff

View File

@@ -2380,6 +2380,13 @@ extern void uITRON4_free(void *p) ;
#undef WOLFSSL_SMALL_STACK #undef WOLFSSL_SMALL_STACK
#endif #endif
#ifdef WOLFSSL_SMALL_STACK_STATIC
#undef WOLFSSL_SMALL_STACK_STATIC
#define WOLFSSL_SMALL_STACK_STATIC static
#else
#define WOLFSSL_SMALL_STACK_STATIC
#endif
/* The client session cache requires time for timeout */ /* The client session cache requires time for timeout */
#if defined(NO_ASN_TIME) && !defined(NO_SESSION_CACHE) #if defined(NO_ASN_TIME) && !defined(NO_SESSION_CACHE)
#define NO_SESSION_CACHE #define NO_SESSION_CACHE