Fix Decoder, Encoder and Store loader fetching

Attempting to fetch one of the above and providing a query string was
failing with an internal assertion error. We must ensure that we give the
provider when calling ossl_method_store_cache_set()

Fixes #17456

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17459)
This commit is contained in:
Matt Caswell 2022-01-10 14:45:16 +00:00 committed by Pauli
parent 254217a4a0
commit cd1981a0dc
3 changed files with 9 additions and 6 deletions

View File

@ -375,13 +375,14 @@ inner_ossl_decoder_fetch(struct decoder_data_st *methdata, int id,
construct_decoder,
destruct_decoder
};
OSSL_PROVIDER *prov = NULL;
methdata->id = id;
methdata->names = name;
methdata->propquery = properties;
methdata->flag_construct_error_occurred = 0;
if ((method = ossl_method_construct(methdata->libctx, OSSL_OP_DECODER,
NULL, 0 /* !force_cache */,
&prov, 0 /* !force_cache */,
&mcm, methdata)) != NULL) {
/*
* If construction did create a method for us, we know that
@ -392,7 +393,7 @@ inner_ossl_decoder_fetch(struct decoder_data_st *methdata, int id,
if (id == 0 && name != NULL)
id = ossl_namemap_name2num(namemap, name);
if (id != 0)
ossl_method_store_cache_set(store, NULL, id, properties, method,
ossl_method_store_cache_set(store, prov, id, properties, method,
up_ref_decoder, free_decoder);
}

View File

@ -385,13 +385,14 @@ inner_ossl_encoder_fetch(struct encoder_data_st *methdata, int id,
construct_encoder,
destruct_encoder
};
OSSL_PROVIDER *prov = NULL;
methdata->id = id;
methdata->names = name;
methdata->propquery = properties;
methdata->flag_construct_error_occurred = 0;
if ((method = ossl_method_construct(methdata->libctx, OSSL_OP_ENCODER,
NULL, 0 /* !force_cache */,
&prov, 0 /* !force_cache */,
&mcm, methdata)) != NULL) {
/*
* If construction did create a method for us, we know that
@ -401,7 +402,7 @@ inner_ossl_encoder_fetch(struct encoder_data_st *methdata, int id,
*/
if (id == 0)
id = ossl_namemap_name2num(namemap, name);
ossl_method_store_cache_set(store, NULL, id, properties, method,
ossl_method_store_cache_set(store, prov, id, properties, method,
up_ref_encoder, free_encoder);
}

View File

@ -317,13 +317,14 @@ inner_loader_fetch(struct loader_data_st *methdata, int id,
construct_loader,
destruct_loader
};
OSSL_PROVIDER *prov = NULL;
methdata->scheme_id = id;
methdata->scheme = scheme;
methdata->propquery = properties;
methdata->flag_construct_error_occurred = 0;
if ((method = ossl_method_construct(methdata->libctx, OSSL_OP_STORE,
NULL, 0 /* !force_cache */,
&prov, 0 /* !force_cache */,
&mcm, methdata)) != NULL) {
/*
* If construction did create a method for us, we know that there
@ -332,7 +333,7 @@ inner_loader_fetch(struct loader_data_st *methdata, int id,
*/
if (id == 0)
id = ossl_namemap_name2num(namemap, scheme);
ossl_method_store_cache_set(store, NULL, id, properties, method,
ossl_method_store_cache_set(store, prov, id, properties, method,
up_ref_loader, free_loader);
}