From f5e6e17c7c97a25d54eb730c67e4f72b9e349568 Mon Sep 17 00:00:00 2001 From: Andrew Hutchings Date: Wed, 20 Nov 2024 06:41:58 +0000 Subject: [PATCH] Fix cryptodev debug output Cryptodev has two sections for the session info struct, cipher and hash. Our debug mode was using hash for the output even if we were using cipher, so would output random data. Simple 'if' statement to do the correct thing. --- wolfcrypt/src/port/devcrypto/wc_devcrypto.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/wolfcrypt/src/port/devcrypto/wc_devcrypto.c b/wolfcrypt/src/port/devcrypto/wc_devcrypto.c index 950e6c26c..90816e0be 100644 --- a/wolfcrypt/src/port/devcrypto/wc_devcrypto.c +++ b/wolfcrypt/src/port/devcrypto/wc_devcrypto.c @@ -175,8 +175,13 @@ int wc_DevCryptoCreate(WC_CRYPTODEV* ctx, int type, byte* key, word32 keySz) WOLFSSL_MSG("Error getting session info"); return WC_DEVCRYPTO_E; } - printf("Using %s with driver %s\n", sesInfo.hash_info.cra_name, - sesInfo.hash_info.cra_driver_name); + if (ctx->sess.cipher == 0) { + printf("Using %s with driver %s\n", sesInfo.hash_info.cra_name, + sesInfo.hash_info.cra_driver_name); + } else { + printf("Using %s with driver %s\n", sesInfo.cipher_info.cra_name, + sesInfo.cipher_info.cra_driver_name); + } #endif (void)key; (void)keySz;