diff --git a/wolfcrypt/src/aes.c b/wolfcrypt/src/aes.c index e8a8b2b28..a8cba6d70 100755 --- a/wolfcrypt/src/aes.c +++ b/wolfcrypt/src/aes.c @@ -2375,7 +2375,7 @@ int wc_AesSetIV(Aes* aes, const byte* iv) CRYP_IVStructInit(&AES_CRYP_IVInitStructure); /* if input and output same will overwrite input iv */ - XMEMCPY(aes->tmp, in + len - AES_BLOCK_SIZE, AES_BLOCK_SIZE); + XMEMCPY(aes->tmp, in + sz - AES_BLOCK_SIZE, AES_BLOCK_SIZE); /* reset registers to their default values */ CRYP_DeInit();