[openssl] OpenSSL_1_1_1-stable update

Dr. Paul Dale pauli at openssl.org
Wed Apr 8 00:58:20 UTC 2020


The branch OpenSSL_1_1_1-stable has been updated
       via  9cc834d966ea5afc38fb829bfe498aed4c5d498d (commit)
      from  163897267fab6d29dff1a4bf8247f8e02e158be8 (commit)


- Log -----------------------------------------------------------------
commit 9cc834d966ea5afc38fb829bfe498aed4c5d498d
Author: Patrick Steuer <patrick.steuer at de.ibm.com>
Date:   Sat Feb 22 01:20:09 2020 +0100

    AES CTR-DRGB: do not leak timing information
    
    Signed-off-by: Patrick Steuer <patrick.steuer at de.ibm.com>
    
    Reviewed-by: Tomas Mraz <tmraz at fedoraproject.org>
    Reviewed-by: Paul Dale <paul.dale at oracle.com>
    (Merged from https://github.com/openssl/openssl/pull/11147)
    
    (cherry picked from commit 069165d10646a22000c596095cc04d43bbf1f807)

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

Summary of changes:
 crypto/rand/drbg_ctr.c | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/crypto/rand/drbg_ctr.c b/crypto/rand/drbg_ctr.c
index 93b82f34ce..f41484e9d5 100644
--- a/crypto/rand/drbg_ctr.c
+++ b/crypto/rand/drbg_ctr.c
@@ -21,19 +21,15 @@
 
 static void inc_128(RAND_DRBG_CTR *ctr)
 {
-    int i;
-    unsigned char c;
-    unsigned char *p = &ctr->V[15];
-
-    for (i = 0; i < 16; i++, p--) {
-        c = *p;
-        c++;
-        *p = c;
-        if (c != 0) {
-            /* If we didn't wrap around, we're done. */
-            break;
-        }
-    }
+    unsigned char *p = &ctr->V[0];
+    u32 n = 16, c = 1;
+
+    do {
+        --n;
+        c += p[n];
+        p[n] = (u8)c;
+        c >>= 8;
+    } while (n);
 }
 
 static void ctr_XOR(RAND_DRBG_CTR *ctr, const unsigned char *in, size_t inlen)


More information about the openssl-commits mailing list