From 0d158fc6632bb82afdc969f0ad664cdad3e09a0b Mon Sep 17 00:00:00 2001 From: Bill Phipps Date: Tue, 24 Sep 2024 12:06:19 -0400 Subject: [PATCH] Updates due to peer review --- wolfcrypt/src/cmac.c | 7 +++++-- wolfssl/wolfcrypt/cmac.h | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/wolfcrypt/src/cmac.c b/wolfcrypt/src/cmac.c index 2b8eaae306..821ff0c2d6 100644 --- a/wolfcrypt/src/cmac.c +++ b/wolfcrypt/src/cmac.c @@ -297,9 +297,11 @@ int wc_CmacFinalNoFree(Cmac* cmac, byte* out, word32* outSz) ret = wc_CryptoCb_Cmac(cmac, NULL, 0, NULL, 0, out, outSz, cmac->type, NULL); if (ret != WC_NO_ERR_TRACE(CRYPTOCB_UNAVAILABLE)) return ret; + /* Clear CRYPTOCB_UNAVAILABLE return code */ + ret = 0; + /* fall-through when unavailable */ } - ret = 0; #endif switch (cmac->type) { #if !defined(NO_AES) && defined(WOLFSSL_AES_DIRECT) @@ -343,7 +345,8 @@ int wc_CmacFinalNoFree(Cmac* cmac, byte* out, word32* outSz) return ret; } -int wc_CmacFinal(Cmac* cmac, byte* out, word32* outSz) { +int wc_CmacFinal(Cmac* cmac, byte* out, word32* outSz) +{ int ret = 0; if (cmac == NULL) diff --git a/wolfssl/wolfcrypt/cmac.h b/wolfssl/wolfcrypt/cmac.h index 6db3326523..63e33f9493 100644 --- a/wolfssl/wolfcrypt/cmac.h +++ b/wolfssl/wolfcrypt/cmac.h @@ -27,7 +27,9 @@ #ifdef WOLFSSL_CMAC +#ifndef NO_AES #include +#endif #if defined(HAVE_FIPS) && \ defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)