From 4dc0d81a1a7b58a0a61102d875eb2cb712fe6a4b Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Tue, 24 Sep 2019 03:42:18 +0200 Subject: [PATCH] evp_generic_do_all(): fix passing of method data Method data was passed down as provider to ossl_algorithm_do_all(), which causes trouble as soon a it's non-NULL. Pass it via the data structure instead. Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/9979) --- crypto/evp/evp_fetch.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crypto/evp/evp_fetch.c b/crypto/evp/evp_fetch.c index e2039df3ef..907091fced 100644 --- a/crypto/evp/evp_fetch.c +++ b/crypto/evp/evp_fetch.c @@ -411,6 +411,7 @@ struct do_all_data_st { void *user_arg; void *(*new_method)(const int name_id, const OSSL_DISPATCH *fns, OSSL_PROVIDER *prov, void *method_data); + void *method_data; void (*free_method)(void *); }; @@ -425,7 +426,7 @@ static void do_one(OSSL_PROVIDER *provider, const OSSL_ALGORITHM *algo, if (name_id != 0) method = data->new_method(name_id, algo->implementation, provider, - NULL); + data->method_data); if (method != NULL) { data->user_fn(method, data->user_arg); @@ -446,10 +447,11 @@ void evp_generic_do_all(OPENSSL_CTX *libctx, int operation_id, struct do_all_data_st data; data.new_method = new_method; + data.method_data = method_data; data.free_method = free_method; data.user_fn = user_fn; data.user_arg = user_arg; - ossl_algorithm_do_all(libctx, operation_id, method_data, do_one, &data); + ossl_algorithm_do_all(libctx, operation_id, NULL, do_one, &data); } const char *evp_first_name(OSSL_PROVIDER *prov, int name_id) -- 2.25.1