diff options
author | Richard Levitte <levitte@openssl.org> | 2019-06-07 11:44:08 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2019-06-10 08:01:19 +0200 |
commit | 2ccb1b4ecab2c3ac1dc2ff81a48869a79afa7839 (patch) | |
tree | 6099885735867271e674fb4108203b084280dbc1 /crypto/core_fetch.c | |
parent | a08714e18131b1998faa0113e5bd4024044654ac (diff) |
EVP fetching: make operation_id part of the method identity
Because the operation identity wasn't integrated with the created
methods, the following code would give unexpected results:
EVP_MD *md = EVP_MD_fetch(NULL, "MD5", NULL);
EVP_CIPHER *cipher = EVP_CIPHER_fetch(NULL, "MD5", NULL);
if (md != NULL)
printf("MD5 is a digest\n");
if (cipher != NULL)
printf("MD5 is a cipher\n");
The message is that MD5 is both a digest and a cipher.
Partially fixes #9106
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/9109)
Diffstat (limited to 'crypto/core_fetch.c')
-rw-r--r-- | crypto/core_fetch.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/crypto/core_fetch.c b/crypto/core_fetch.c index a99f092486..56a3c5cadb 100644 --- a/crypto/core_fetch.c +++ b/crypto/core_fetch.c @@ -59,12 +59,12 @@ static int ossl_method_construct_this(OSSL_PROVIDER *provider, void *cbdata) * If we haven't been told not to store, * add to the global store */ - data->mcm->put(data->libctx, NULL, method, + data->mcm->put(data->libctx, NULL, method, data->operation_id, thismap->algorithm_name, thismap->property_definition, data->mcm_data); } - data->mcm->put(data->libctx, data->store, method, + data->mcm->put(data->libctx, data->store, method, data->operation_id, thismap->algorithm_name, thismap->property_definition, data->mcm_data); @@ -83,7 +83,8 @@ void *ossl_method_construct(OPENSSL_CTX *libctx, int operation_id, void *method = NULL; if ((method = - mcm->get(libctx, NULL, name, propquery, mcm_data)) == NULL) { + mcm->get(libctx, NULL, operation_id, name, propquery, mcm_data)) + == NULL) { struct construct_data_st cbdata; /* @@ -101,7 +102,8 @@ void *ossl_method_construct(OPENSSL_CTX *libctx, int operation_id, ossl_provider_forall_loaded(libctx, ossl_method_construct_this, &cbdata); - method = mcm->get(libctx, cbdata.store, name, propquery, mcm_data); + method = mcm->get(libctx, cbdata.store, operation_id, name, + propquery, mcm_data); mcm->dealloc_tmp_store(cbdata.store); } |