WOLF_CRYPTO_CB && WOLFSSL_SHA3: add FIPS gating to wc_CryptoCb_Sha3Hash() and test routine myCryptoDevCb().

This commit is contained in:
Daniel Pouzzner
2024-06-22 11:20:53 -05:00
parent 0cf5421e5a
commit b4e15d028c
2 changed files with 3 additions and 3 deletions

View File

@ -1606,7 +1606,7 @@ int wc_CryptoCb_Sha512Hash(wc_Sha512* sha512, const byte* in,
} }
#endif /* WOLFSSL_SHA512 */ #endif /* WOLFSSL_SHA512 */
#ifdef WOLFSSL_SHA3 #if defined(WOLFSSL_SHA3) && (!defined(HAVE_FIPS) || FIPS_VERSION_GE(6, 0))
int wc_CryptoCb_Sha3Hash(wc_Sha3* sha3, int type, const byte* in, int wc_CryptoCb_Sha3Hash(wc_Sha3* sha3, int type, const byte* in,
word32 inSz, byte* digest) word32 inSz, byte* digest)
{ {
@ -1638,7 +1638,7 @@ int wc_CryptoCb_Sha3Hash(wc_Sha3* sha3, int type, const byte* in,
return wc_CryptoCb_TranslateErrorCode(ret); return wc_CryptoCb_TranslateErrorCode(ret);
} }
#endif /* WOLFSSL_SHA3 */ #endif /* WOLFSSL_SHA3 && (!HAVE_FIPS || FIPS_VERSION_GE(6, 0)) */
#ifndef NO_HMAC #ifndef NO_HMAC
int wc_CryptoCb_Hmac(Hmac* hmac, int macType, const byte* in, word32 inSz, int wc_CryptoCb_Hmac(Hmac* hmac, int macType, const byte* in, word32 inSz,

View File

@ -54802,7 +54802,7 @@ static int myCryptoDevCb(int devIdArg, wc_CryptoInfo* info, void* ctx)
} }
else else
#endif #endif
#ifdef WOLFSSL_SHA3 #if defined(WOLFSSL_SHA3) && (!defined(HAVE_FIPS) || FIPS_VERSION_GE(6, 0))
if (info->hash.type == WC_HASH_TYPE_SHA3_224) { if (info->hash.type == WC_HASH_TYPE_SHA3_224) {
if (info->hash.sha3 == NULL) if (info->hash.sha3 == NULL)
return NOT_COMPILED_IN; return NOT_COMPILED_IN;