[openssl-commits] [openssl] master update

Rich Salz rsalz at openssl.org
Tue Dec 5 23:16:41 UTC 2017


The branch master has been updated
       via  723a7c5af0733eb4165947064731570adfa7457a (commit)
      from  40866074c29dddd87a1436f2c7435f37dac425a7 (commit)


- Log -----------------------------------------------------------------
commit 723a7c5af0733eb4165947064731570adfa7457a
Author: Patrick Steuer <patrick.steuer at de.ibm.com>
Date:   Tue Dec 5 13:10:11 2017 +0100

    apps/speed.c: detect evp cipher 32-bit ctr overflow and reset iv
    
    Signed-off-by: Patrick Steuer <patrick.steuer at de.ibm.com>
    
    Reviewed-by: Andy Polyakov <appro at openssl.org>
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/4846)

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

Summary of changes:
 apps/speed.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/apps/speed.c b/apps/speed.c
index 271472e..8d671e7 100644
--- a/apps/speed.c
+++ b/apps/speed.c
@@ -872,16 +872,23 @@ static int EVP_Update_loop(void *args)
     loopargs_t *tempargs = *(loopargs_t **) args;
     unsigned char *buf = tempargs->buf;
     EVP_CIPHER_CTX *ctx = tempargs->ctx;
-    int outl, count;
+    int outl, count, rc;
 #ifndef SIGALRM
     int nb_iter = save_count * 4 * lengths[0] / lengths[testnum];
 #endif
-    if (decrypt)
-        for (count = 0; COND(nb_iter); count++)
-            EVP_DecryptUpdate(ctx, buf, &outl, buf, lengths[testnum]);
-    else
-        for (count = 0; COND(nb_iter); count++)
-            EVP_EncryptUpdate(ctx, buf, &outl, buf, lengths[testnum]);
+    if (decrypt) {
+        for (count = 0; COND(nb_iter); count++) {
+            rc = EVP_DecryptUpdate(ctx, buf, &outl, buf, lengths[testnum]);
+            if (rc != 1)
+                EVP_CipherInit_ex(ctx, NULL, NULL, NULL, iv, -1);
+        }
+    } else {
+        for (count = 0; COND(nb_iter); count++) {
+            rc = EVP_EncryptUpdate(ctx, buf, &outl, buf, lengths[testnum]);
+            if (rc != 1)
+                EVP_CipherInit_ex(ctx, NULL, NULL, NULL, iv, -1);
+        }
+    }
     if (decrypt)
         EVP_DecryptFinal_ex(ctx, buf, &outl);
     else


More information about the openssl-commits mailing list