Only cache a method if we actually created one
authorMatt Caswell <matt@openssl.org>
Fri, 28 Jun 2019 13:29:34 +0000 (14:29 +0100)
committerMatt Caswell <matt@openssl.org>
Mon, 1 Jul 2019 09:07:52 +0000 (10:07 +0100)
We were attempting to cache a method after we failed to create it
which leads to an assertion failure.

Fixes #9264

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/9269)

crypto/evp/evp_fetch.c

index b039cc05478a9043e1c2f2beef572779e4dd8e11..e785474372881eb86c21c2a179cff758a0855559 100644 (file)
@@ -207,7 +207,7 @@ void *evp_generic_fetch(OPENSSL_CTX *libctx, int operation_id,
         mcmdata.destruct_method = free_method;
         if ((method = ossl_method_construct(libctx, operation_id, name,
                                             properties, 0 /* !force_cache */,
-                                            &mcm, &mcmdata)) == NULL) {
+                                            &mcm, &mcmdata)) != NULL) {
             /*
              * If construction did create a method for us, we know that
              * there is a correct nameid and methodid, since those have