mirror of
https://github.com/openssl/openssl.git
synced 2024-11-27 05:21:51 +08:00
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 <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/9979)
This commit is contained in:
parent
031873fe03
commit
4dc0d81a1a
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user