From f7fa648f77d7c087b5591ee709fc0272f7244f27 Mon Sep 17 00:00:00 2001 From: John Safranek Date: Thu, 12 Apr 2018 17:33:01 -0700 Subject: [PATCH] Test Fixes 1. Found a problem in AES-GCM encrypt where it could step on the ciphertext with the correct sized IV. --- wolfcrypt/src/aes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wolfcrypt/src/aes.c b/wolfcrypt/src/aes.c index 1eb69c813..b9579c30d 100644 --- a/wolfcrypt/src/aes.c +++ b/wolfcrypt/src/aes.c @@ -9041,11 +9041,11 @@ int wc_AesGcmEncrypt_ex(Aes* aes, byte* out, const byte* in, word32 sz, } if (ret == 0) { + XMEMCPY(ivOut, aes->reg, ivOutSz); ret = wc_AesGcmEncrypt(aes, out, in, sz, (byte*)aes->reg, ivOutSz, authTag, authTagSz, authIn, authInSz); - XMEMCPY(ivOut, aes->reg, ivOutSz); IncCtr((byte*)aes->reg, ivOutSz); }