Always try to construct methods as new provider might be added
Otherwise optional properties can be incorrectly ignored.
Fixes
@@ -123,12 +123,20 @@ void *ossl_method_construct(OSSL_LIB_CTX *libctx, int operation_id,
OSSL_METHOD_CONSTRUCT_METHOD *mcm, void *mcm_data)
{
void *method = NULL;
-
- if ((method = mcm->get(NULL, (const OSSL_PROVIDER **)provider_rw,
- mcm_data)) == NULL) {
OSSL_PROVIDER *provider = provider_rw != NULL ? *provider_rw : NULL;
struct construct_data_st cbdata;
+ /*
+ * We might be tempted to try to look into the method store without
+ * constructing to see if we can find our method there already.
+ * Unfortunately that does not work well if the query contains
+ * optional properties as newly loaded providers can match them better.
+ * We trust that ossl_method_construct_precondition() and
+ * ossl_method_construct_postcondition() make sure that the
+ * ossl_algorithm_do_all() does very little when methods from
+ * a provider have already been constructed.
+ */
+
cbdata.store = NULL;
cbdata.force_store = force_store;
cbdata.mcm = mcm;
@@ -147,7 +155,6 @@ void *ossl_method_construct(OSSL_LIB_CTX *libctx, int operation_id,
/* If no method was found yet, try the global store */
if (method == NULL)
method = mcm->get(NULL, (const OSSL_PROVIDER **)provider_rw, mcm_data);
- }
return method;
}
