Correct AES counter mode, which incorrectly incremented the counter before
authorRichard Levitte <levitte@openssl.org>
Thu, 30 May 2002 14:06:06 +0000 (14:06 +0000)
committerRichard Levitte <levitte@openssl.org>
Thu, 30 May 2002 14:06:06 +0000 (14:06 +0000)
using it.
PR: 56

crypto/aes/aes_ctr.c

index 8e80048..aea3db2 100644 (file)
@@ -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;