Fix for crypto callback without HMAC and DEBUG_CRYPTOCB. Fix guards on crypto cb hashing.

This commit is contained in:
David Garske
2025-03-27 16:42:24 -07:00
parent 1c56a2674a
commit e1ec90a886
2 changed files with 6 additions and 1 deletions

View File

@ -207,6 +207,8 @@ WOLFSSL_API void wc_CryptoCb_InfoString(wc_CryptoInfo* info)
info->cipher.type, info->cipher.ctx); info->cipher.type, info->cipher.ctx);
} }
#endif /* !NO_AES || !NO_DES3 */ #endif /* !NO_AES || !NO_DES3 */
#if !defined(NO_SHA) || !defined(NO_SHA256) || \
defined(WOLFSSL_SHA512) || defined(WOLFSSL_SHA384) || defined(WOLFSSL_SHA3)
else if (info->algo_type == WC_ALGO_TYPE_HASH) { else if (info->algo_type == WC_ALGO_TYPE_HASH) {
printf("Crypto CB: %s %s (%d) (%p ctx) %s\n", printf("Crypto CB: %s %s (%d) (%p ctx) %s\n",
GetAlgoTypeStr(info->algo_type), GetAlgoTypeStr(info->algo_type),
@ -214,6 +216,8 @@ WOLFSSL_API void wc_CryptoCb_InfoString(wc_CryptoInfo* info)
info->hash.type, info->hash.ctx, info->hash.type, info->hash.ctx,
(info->hash.in != NULL) ? "Update" : "Final"); (info->hash.in != NULL) ? "Update" : "Final");
} }
#endif
#ifndef NO_HMAC
else if (info->algo_type == WC_ALGO_TYPE_HMAC) { else if (info->algo_type == WC_ALGO_TYPE_HMAC) {
printf("Crypto CB: %s %s (%d) (%p ctx) %s\n", printf("Crypto CB: %s %s (%d) (%p ctx) %s\n",
GetAlgoTypeStr(info->algo_type), GetAlgoTypeStr(info->algo_type),
@ -221,6 +225,7 @@ WOLFSSL_API void wc_CryptoCb_InfoString(wc_CryptoInfo* info)
info->hmac.macType, info->hmac.hmac, info->hmac.macType, info->hmac.hmac,
(info->hmac.in != NULL) ? "Update" : "Final"); (info->hmac.in != NULL) ? "Update" : "Final");
} }
#endif
#ifdef WOLFSSL_CMAC #ifdef WOLFSSL_CMAC
else if (info->algo_type == WC_ALGO_TYPE_CMAC) { else if (info->algo_type == WC_ALGO_TYPE_CMAC) {
printf("Crypto CB: %s %s (%d) (%p ctx) %s %s %s\n", printf("Crypto CB: %s %s (%d) (%p ctx) %s %s %s\n",

View File

@ -375,7 +375,7 @@ typedef struct wc_CryptoInfo {
} cipher; } cipher;
#endif /* !NO_AES || !NO_DES3 */ #endif /* !NO_AES || !NO_DES3 */
#if !defined(NO_SHA) || !defined(NO_SHA256) || \ #if !defined(NO_SHA) || !defined(NO_SHA256) || \
defined(WOLFSSL_SHA512) || defined(WOLFSSL_SHA384) defined(WOLFSSL_SHA384) || defined(WOLFSSL_SHA512) || defined(WOLFSSL_SHA3)
struct { struct {
int type; /* enum wc_HashType */ int type; /* enum wc_HashType */
const byte* in; const byte* in;