From 681a75da24bf7bc1407ecf94a7edc5abd629ccde Mon Sep 17 00:00:00 2001 From: JacobBarthelmeh Date: Wed, 12 Jul 2023 06:14:57 -0700 Subject: [PATCH] fix for AES-GCM use with petalinux --- wolfcrypt/src/aes.c | 2 +- wolfcrypt/src/port/af_alg/afalg_aes.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/wolfcrypt/src/aes.c b/wolfcrypt/src/aes.c index 2509627c13..36ace1f081 100644 --- a/wolfcrypt/src/aes.c +++ b/wolfcrypt/src/aes.c @@ -9802,7 +9802,7 @@ int wc_AesInit(Aes* aes, void* heap, int devId) aes->heap, devId); #endif /* WOLFSSL_ASYNC_CRYPT */ -#ifdef WOLFSSL_AFALG +#if defined(WOLFSSL_AFALG) || defined(WOLFSSL_AFALG_XILINX_AES) aes->alFd = WC_SOCK_NOTSET; aes->rdFd = WC_SOCK_NOTSET; #endif diff --git a/wolfcrypt/src/port/af_alg/afalg_aes.c b/wolfcrypt/src/port/af_alg/afalg_aes.c index baee2acde0..39a9ee6e6f 100644 --- a/wolfcrypt/src/port/af_alg/afalg_aes.c +++ b/wolfcrypt/src/port/af_alg/afalg_aes.c @@ -71,7 +71,11 @@ static int wc_AesSetup(Aes* aes, const char* type, const char* name, int ivSz, i aes->rdFd = WC_SOCK_NOTSET; return WC_AFALG_SOCK_E; } +#ifdef WOLFSSL_AFALG_XILINX_AES + ForceZero(key, sizeof(aes->msgBuf)); +#else ForceZero(key, sizeof(aes->key)); +#endif /* set up CMSG headers */ XMEMSET((byte*)&(aes->msg), 0, sizeof(struct msghdr));