speed: Correct handling of async_jobs for KEM and signature algos
authorIngo Franzki <ifranzki@linux.ibm.com>
Mon, 16 Oct 2023 12:07:05 +0000 (14:07 +0200)
committerMatt Caswell <matt@openssl.org>
Wed, 25 Oct 2023 08:24:29 +0000 (09:24 +0100)
Setup the loopargs array for all jobs, not only for the very first one.

It may fail with "Could not allocate 0 bytes for sig sign loop" and/or will
cause the loop functions to fail silently, because they operate on a NULL
PKEY context when "-async_jobs <n>" is specified.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Todd Short <todd.short@me.com>
(Merged from https://github.com/openssl/openssl/pull/22399)

apps/speed.c

index ac86d9e3a9a6761b0d372363ab3e91900e6176f1..57aeb67bf89c3cd74c27635b1ef5b08563c6efa4 100644 (file)
@@ -3830,7 +3830,7 @@ skip_hmac:
             loopargs[i].kem_rcv_secret[testnum] = rcv_secret;
             EVP_PKEY_free(pkey);
             pkey = NULL;
-            break;
+            continue;
 
         kem_err_break:
             ERR_print_errors(bio_err);
@@ -4010,7 +4010,7 @@ skip_hmac:
             loopargs[i].sig_sig[testnum] = sig;
             EVP_PKEY_free(pkey);
             pkey = NULL;
-            break;
+            continue;
 
         sig_err_break:
             ERR_print_errors(bio_err);