isaacpittman-hitachi / rpms / openssl

Forked from rpms/openssl 2 years ago
Clone
Blob Blame History Raw
diff -up openssl-3.0.0/apps/speed.c.beldmit openssl-3.0.0/apps/speed.c
--- openssl-3.0.0/apps/speed.c.beldmit	2021-12-21 15:14:04.210431584 +0100
+++ openssl-3.0.0/apps/speed.c	2021-12-21 15:46:05.554085125 +0100
@@ -547,6 +547,9 @@ static int EVP_MAC_loop(int algindex, vo
     for (count = 0; COND(c[algindex][testnum]); count++) {
         size_t outl;
 
+        if (mctx == NULL)
+            return -1;
+
         if (!EVP_MAC_init(mctx, NULL, 0, NULL)
             || !EVP_MAC_update(mctx, buf, lengths[testnum])
             || !EVP_MAC_final(mctx, mac, &outl, sizeof(mac)))
@@ -1922,8 +1925,10 @@ int speed_main(int argc, char **argv)
             if (loopargs[i].mctx == NULL)
                 goto end;
 
-            if (!EVP_MAC_CTX_set_params(loopargs[i].mctx, params))
-                goto end;
+            if (!EVP_MAC_CTX_set_params(loopargs[i].mctx, params)) {
+                EVP_MAC_CTX_free(loopargs[i].mctx);
+                loopargs[i].mctx = NULL;
+            }
         }
         for (testnum = 0; testnum < size_num; testnum++) {
             print_message(names[D_HMAC], c[D_HMAC][testnum], lengths[testnum],