summaryrefslogtreecommitdiffstats
path: root/crypto/aes/aes_cbc.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2003-10-29 07:21:22 +0100
committerRichard Levitte <levitte@openssl.org>2003-10-29 07:21:22 +0100
commit4e952ae4fc33a1c3a39e082dcb139c5560128ce8 (patch)
tree85e72af71dd7b26d0c36571b7bb17dcaf8103111 /crypto/aes/aes_cbc.c
parentremove accidentally committed debugging cruft. (diff)
downloadopenssl-4e952ae4fc33a1c3a39e082dcb139c5560128ce8.tar.xz
openssl-4e952ae4fc33a1c3a39e082dcb139c5560128ce8.zip
Removing those memcpy()s also took away the possibility for in and out to
be the same. Therefore, the removed memcpy()s need to be restored.
Diffstat (limited to 'crypto/aes/aes_cbc.c')
-rw-r--r--crypto/aes/aes_cbc.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/crypto/aes/aes_cbc.c b/crypto/aes/aes_cbc.c
index 0a28ab8d34..1222a21002 100644
--- a/crypto/aes/aes_cbc.c
+++ b/crypto/aes/aes_cbc.c
@@ -91,20 +91,21 @@ void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
}
} else {
while (len >= AES_BLOCK_SIZE) {
+ memcpy(tmp, in, AES_BLOCK_SIZE);
AES_decrypt(in, out, key);
for(n=0; n < AES_BLOCK_SIZE; ++n)
out[n] ^= ivec[n];
- memcpy(ivec, in, AES_BLOCK_SIZE);
+ memcpy(ivec, tmp, AES_BLOCK_SIZE);
len -= AES_BLOCK_SIZE;
in += AES_BLOCK_SIZE;
out += AES_BLOCK_SIZE;
}
if (len) {
memcpy(tmp, in, AES_BLOCK_SIZE);
- AES_decrypt(in, tmp, key);
+ AES_decrypt(tmp, tmp, key);
for(n=0; n < len; ++n)
out[n] = tmp[n] ^ ivec[n];
- memcpy(ivec, in, AES_BLOCK_SIZE);
+ memcpy(ivec, tmp, AES_BLOCK_SIZE);
}
}
}