Make aes_ctr.c 64-bit savvy.
authorAndy Polyakov <appro@openssl.org>
Mon, 23 Aug 2004 22:19:51 +0000 (22:19 +0000)
committerAndy Polyakov <appro@openssl.org>
Mon, 23 Aug 2004 22:19:51 +0000 (22:19 +0000)
crypto/aes/aes_ctr.c

index 2487d83fb15cfd50e24c235306875da9e05c9ec3..f36982be1e26e2c07b3c2116ab598af4a80442f8 100644 (file)
@@ -68,7 +68,7 @@ static void AES_ctr128_inc(unsigned char *counter) {
 
        /* Grab bottom dword of counter and increment */
        c = GETU32(counter + 12);
-       c++;
+       c++;    c &= 0xFFFFFFFF;
        PUTU32(counter + 12, c);
 
        /* if no overflow, we're done */
@@ -77,7 +77,7 @@ static void AES_ctr128_inc(unsigned char *counter) {
 
        /* Grab 1st dword of counter and increment */
        c = GETU32(counter +  8);
-       c++;
+       c++;    c &= 0xFFFFFFFF;
        PUTU32(counter +  8, c);
 
        /* if no overflow, we're done */
@@ -86,7 +86,7 @@ static void AES_ctr128_inc(unsigned char *counter) {
 
        /* Grab 2nd dword of counter and increment */
        c = GETU32(counter +  4);
-       c++;
+       c++;    c &= 0xFFFFFFFF;
        PUTU32(counter +  4, c);
 
        /* if no overflow, we're done */
@@ -95,7 +95,7 @@ static void AES_ctr128_inc(unsigned char *counter) {
 
        /* Grab top dword of counter and increment */
        c = GETU32(counter +  0);
-       c++;
+       c++;    c &= 0xFFFFFFFF;
        PUTU32(counter +  0, c);
 }