Fix bug in EDDSA speed test
authorShane Lontis <shane.lontis@oracle.com>
Fri, 25 Sep 2020 03:50:25 +0000 (13:50 +1000)
committerShane Lontis <shane.lontis@oracle.com>
Sat, 26 Sep 2020 08:17:31 +0000 (18:17 +1000)
The pkey created in one loop was being fed into the keygen of the next loop - since it was not set to NULL after the
free. This meant that the 2 EVP_MD_CTX objects that still had ref counts to this key were getting confused.

All other tests clear the key after freeing the key if they loop (some do this by declaring/initing the pkey inside the loop).
The offending code is a recent addition to the speed app.
This was found using the -async_jobs option.
Similar code was tried for an RSA key using 111 which resulted in the same issue.

Found while trying to test issue #128867 (It is not known if this will fix that issue yet).

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12975)

apps/speed.c

index 017c5a280ab79c10d64075cd732315222e8c6859..46187010d59b97625989f999019596758808fe76 100644 (file)
@@ -3426,6 +3426,7 @@ int speed_main(int argc, char **argv)
             }
 
             EVP_PKEY_free(ed_pkey);
+            ed_pkey = NULL;
         }
         if (st == 0) {
             BIO_printf(bio_err, "EdDSA failure.\n");