From: Richard Levitte Date: Thu, 30 May 2002 14:06:06 +0000 (+0000) Subject: Correct AES counter mode, which incorrectly incremented the counter before X-Git-Tag: OpenSSL_0_9_6e~26^2~123 X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff_plain;h=dbdc5d14d3301ed9dbab16db7e02f3c9518ac3f3 Correct AES counter mode, which incorrectly incremented the counter before using it. PR: 56 --- diff --git a/crypto/aes/aes_ctr.c b/crypto/aes/aes_ctr.c index 8e800481de..aea3db2092 100644 --- a/crypto/aes/aes_ctr.c +++ b/crypto/aes/aes_ctr.c @@ -106,8 +106,8 @@ void AES_ctr128_encrypt(const unsigned char *in, unsigned char *out, while (l--) { if (n == 0) { - AES_ctr128_inc(counter); AES_encrypt(counter, tmp, key); + AES_ctr128_inc(counter); } *(out++) = *(in++) ^ tmp[n]; n = (n+1) % AES_BLOCK_SIZE;