diff --git a/wolfcrypt/src/port/af_alg/afalg_aes.c b/wolfcrypt/src/port/af_alg/afalg_aes.c index 66bbf9c027..baee2acde0 100644 --- a/wolfcrypt/src/port/af_alg/afalg_aes.c +++ b/wolfcrypt/src/port/af_alg/afalg_aes.c @@ -669,7 +669,7 @@ int wc_AesGcmEncrypt(Aes* aes, byte* out, const byte* in, word32 sz, XMEMSET(initalCounter, 0, AES_BLOCK_SIZE); XMEMCPY(initalCounter, iv, ivSz); initalCounter[AES_BLOCK_SIZE - 1] = 1; - GHASH(aes, authIn, authInSz, out, sz, authTag, authTagSz); + GHASH(&aes->gcm, authIn, authInSz, out, sz, authTag, authTagSz); ret = wc_AesEncryptDirect(aes, scratch, initalCounter); if (ret < 0) { return ret; @@ -822,7 +822,7 @@ int wc_AesGcmDecrypt(Aes* aes, byte* out, const byte* in, word32 sz, XMEMCPY(initalCounter, iv, ivSz); initalCounter[AES_BLOCK_SIZE - 1] = 1; tag = buf; - GHASH(aes, NULL, 0, in, sz, tag, AES_BLOCK_SIZE); + GHASH(&aes->gcm, NULL, 0, in, sz, tag, AES_BLOCK_SIZE); ret = wc_AesEncryptDirect(aes, scratch, initalCounter); if (ret < 0) return ret; @@ -874,7 +874,7 @@ int wc_AesGcmDecrypt(Aes* aes, byte* out, const byte* in, word32 sz, /* check on tag */ if (authIn != NULL && authInSz > 0) { - GHASH(aes, authIn, authInSz, in, sz, tag, AES_BLOCK_SIZE); + GHASH(&aes->gcm, authIn, authInSz, in, sz, tag, AES_BLOCK_SIZE); ret = wc_AesEncryptDirect(aes, scratch, initalCounter); if (ret < 0) return ret; diff --git a/wolfcrypt/src/port/arm/armv8-aes.c b/wolfcrypt/src/port/arm/armv8-aes.c index 52810e8a5d..1ba22cae3d 100644 --- a/wolfcrypt/src/port/arm/armv8-aes.c +++ b/wolfcrypt/src/port/arm/armv8-aes.c @@ -4721,13 +4721,13 @@ static void AesGcmInit_C(Aes* aes, const byte* iv, word32 ivSz) else { /* Counter is GHASH of IV. */ #ifdef OPENSSL_EXTRA - word32 aadTemp = aes->aadLen; - aes->aadLen = 0; + word32 aadTemp = aes->gcm.aadLen; + aes->gcm.aadLen = 0; #endif GHASH(&aes->gcm, NULL, 0, iv, ivSz, counter, AES_BLOCK_SIZE); GMULT(counter, aes->gcm.H); #ifdef OPENSSL_EXTRA - aes->aadLen = aadTemp; + aes->gcm.aadLen = aadTemp; #endif } @@ -4816,7 +4816,7 @@ static void AesGcmFinal_C(Aes* aes, byte* authTag, word32 authTagSz) xorbuf(authTag, AES_INITCTR(aes), authTagSz); #ifdef OPENSSL_EXTRA /* store AAD size for next call */ - aes->aadLen = aes->aSz; + aes->gcm.aadLen = aes->aSz; #endif /* Zeroize last block to protect sensitive data. */ ForceZero(AES_LASTBLOCK(aes), AES_BLOCK_SIZE); diff --git a/wolfcrypt/src/port/xilinx/xil-aesgcm.c b/wolfcrypt/src/port/xilinx/xil-aesgcm.c index 3367a02f96..bfcd010aa4 100644 --- a/wolfcrypt/src/port/xilinx/xil-aesgcm.c +++ b/wolfcrypt/src/port/xilinx/xil-aesgcm.c @@ -221,7 +221,7 @@ static WC_INLINE int handle_aad( Aes* aes, byte initalCounter[AES_BLOCK_SIZE] = { 0 }; XMEMCPY(initalCounter, iv, AEAD_NONCE_SZ); initalCounter[AES_BLOCK_SIZE - 1] = 1; - GHASH(aes, authIn, authInSz, data, sz, authTag, AES_GCM_AUTH_SZ); + GHASH(&aes->gcm, authIn, authInSz, data, sz, authTag, AES_GCM_AUTH_SZ); ret = wc_AesEncryptDirect(aes, scratch, initalCounter); if (ret == 0) xorbuf(authTag, scratch, AES_GCM_AUTH_SZ); @@ -558,7 +558,7 @@ int wc_AesGcmEncrypt(Aes* aes, byte* out, XMEMSET(initalCounter, 0, AES_BLOCK_SIZE); XMEMCPY(initalCounter, iv, ivSz); initalCounter[AES_BLOCK_SIZE - 1] = 1; - GHASH(aes, authIn, authInSz, out, sz, authTag, authTagSz); + GHASH(&aes->gcm, authIn, authInSz, out, sz, authTag, authTagSz); ret = wc_AesEncryptDirect(aes, scratch, initalCounter); if (ret < 0) return ret; @@ -597,7 +597,7 @@ int wc_AesGcmDecrypt(Aes* aes, byte* out, XMEMCPY(initalCounter, iv, ivSz); initalCounter[AES_BLOCK_SIZE - 1] = 1; tag = buf; - GHASH(aes, NULL, 0, in, sz, tag, AES_GCM_AUTH_SZ); + GHASH(&aes->gcm, NULL, 0, in, sz, tag, AES_GCM_AUTH_SZ); ret = wc_AesEncryptDirect(aes, scratch, initalCounter); if (ret < 0) return ret; @@ -614,7 +614,7 @@ int wc_AesGcmDecrypt(Aes* aes, byte* out, /* account for additional data */ if (authIn != NULL && authInSz > 0) { - GHASH(aes, authIn, authInSz, in, sz, tag, AES_GCM_AUTH_SZ); + GHASH(&aes->gcm, authIn, authInSz, in, sz, tag, AES_GCM_AUTH_SZ); ret = wc_AesEncryptDirect(aes, scratch, initalCounter); if (ret < 0) return ret;