Only cache a method if we actually created one

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)
This commit is contained in:
Matt Caswell 2019-06-28 14:29:34 +01:00
parent 68756b12f5
commit 08607613d5

View file

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