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 8e800481de00fb26b4de1dcc50da38e070796749..aea3db209272189e4e8fcd6638a3e3ed51048e10 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;