[openssl-commits] [openssl] master update

Andy Polyakov appro at openssl.org
Fri Nov 25 16:23:00 UTC 2016


The branch master has been updated
       via  76f572ed0469a277d92378848250b7a9705d3071 (commit)
       via  b47f116b1e02d20b1f8a7488be5a04f7cf5bc712 (commit)
      from  90fc4832a392f60d2da2f5684d8d20ac8d91cebd (commit)


- Log -----------------------------------------------------------------
commit 76f572ed0469a277d92378848250b7a9705d3071
Author: Andy Polyakov <appro at openssl.org>
Date:   Sun Nov 20 23:38:12 2016 +0100

    modes/ctr128.c: fix false carry in counter increment procedure.
    
    GH issue #1916 affects only big-endian platforms. TLS is not affected,
    because TLS fragment is never big enough.
    
    Reviewed-by: Matt Caswell <matt at openssl.org>

commit b47f116b1e02d20b1f8a7488be5a04f7cf5bc712
Author: Andy Polyakov <appro at openssl.org>
Date:   Sun Nov 20 23:32:24 2016 +0100

    test/evptests.txt: add regression test for false carry in ctr128.c.
    
    GH issue #1916 affects only big-endian platforms. TLS is not affected,
    because TLS fragment is never big enough.
    
    Reviewed-by: Matt Caswell <matt at openssl.org>

-----------------------------------------------------------------------

Summary of changes:
 crypto/modes/ctr128.c | 2 +-
 test/evptests.txt     | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/crypto/modes/ctr128.c b/crypto/modes/ctr128.c
index b7ffb73..03920b4 100644
--- a/crypto/modes/ctr128.c
+++ b/crypto/modes/ctr128.c
@@ -52,7 +52,7 @@ static void ctr128_inc_aligned(unsigned char *counter)
         --n;
         d = data[n] += c;
         /* did addition carry? */
-        c = ((d - c) ^ d) >> (sizeof(size_t) * 8 - 1);
+        c = ((d - c) & ~d) >> (sizeof(size_t) * 8 - 1);
     } while (n);
 }
 #endif
diff --git a/test/evptests.txt b/test/evptests.txt
index 173f0df..6db6cf7 100644
--- a/test/evptests.txt
+++ b/test/evptests.txt
@@ -842,6 +842,14 @@ Plaintext = 000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F2021
 Ciphertext = EB6C52821D0BBBF7CE7594462ACA4FAAB407DF866569FD07F48CC0B583D6071F1EC0E6B8
 
 
+# Self-generated vector to trigger false carry on big-endian platforms
+Cipher = aes-128-ctr
+Key = 7E24067817FAE0D743D6CE1F32539163
+IV = 00000000000000007FFFFFFFFFFFFFFF
+Operation = ENCRYPT
+Plaintext = 000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F
+Ciphertext = A2D459477E6432BD74184B1B5370D2243CDC202BC43583B2A55D288CDBBD1E03
+
 # DES ECB tests (from destest)
 
 Cipher = DES-ECB


More information about the openssl-commits mailing list