AES-GCM streaming: EVP needs to set IV with wc_AesGcmInit

Store IV if it is small enough to fit in aes->reg - was a copy of the
aes->reg in the first place.
This commit is contained in:
Sean Parkinson
2023-03-23 09:28:22 +10:00
parent df4081ea5a
commit 1fa75a5503

View File

@ -8169,6 +8169,11 @@ int wc_AesGcmInit(Aes* aes, const byte* key, word32 len, const byte* iv,
}
if (ret == 0) {
/* Set the IV passed in if it is smaller than a block. */
if ((iv != NULL) && (ivSz <= AES_BLOCK_SIZE)) {
XMEMCPY((byte*)aes->reg, iv, ivSz);
aes->nonceSz = ivSz;
}
/* No IV passed in, check for cached IV. */
if ((iv == NULL) && (aes->nonceSz != 0)) {
/* Use the cached copy. */