diff --git a/crypto/aes/aes_cbc.c b/crypto/aes/aes_cbc.c index e43135e8a022440dd10d58bae06147f40992f515..41d538f2b52780ce854db2dc0adff8fddf7f8ed1 100644 --- a/crypto/aes/aes_cbc.c +++ b/crypto/aes/aes_cbc.c @@ -82,11 +82,10 @@ void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, } if (len) { for(n=0; n < len; ++n) - tmp[n] = in[n] ^ iv[n]; + out[n] = in[n] ^ iv[n]; for(n=len; n < AES_BLOCK_SIZE; ++n) - tmp[n] = iv[n]; - AES_encrypt(tmp, tmp, key); - memcpy(out, tmp, AES_BLOCK_SIZE); + out[n] = iv[n]; + AES_encrypt(out, out, key); iv = out; } memcpy(ivec,iv,AES_BLOCK_SIZE);