diff options
author | Richard Levitte <levitte@openssl.org> | 2021-06-15 10:18:19 +0200 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2021-06-16 12:32:53 +0100 |
commit | 6882652e65d39310c98ba506ceb55a87c702d419 (patch) | |
tree | 018c57753bb219a0d59e40f28076952b9cdc4977 /crypto/encode_decode/encoder_meth.c | |
parent | 99325852207e3f8ae970799235de169b40eded75 (diff) |
CORE: Do a bit of cleanup of core fetching
Some data, like the library context, were passed both through higher
level callback structures and through arguments to those same higher
level callbacks. This is a bit unnecessary, so we rearrange the
callback arguments to simply pass that callback structure and rely on
the higher level fetching functionality to pick out what data they
need from that structure.
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15750)
Diffstat (limited to 'crypto/encode_decode/encoder_meth.c')
-rw-r--r-- | crypto/encode_decode/encoder_meth.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/crypto/encode_decode/encoder_meth.c b/crypto/encode_decode/encoder_meth.c index 9c17b3637e..823def8843 100644 --- a/crypto/encode_decode/encoder_meth.c +++ b/crypto/encode_decode/encoder_meth.c @@ -87,7 +87,6 @@ static const OSSL_LIB_CTX_METHOD encoder_store_method = { /* Data to be passed through ossl_method_construct() */ struct encoder_data_st { OSSL_LIB_CTX *libctx; - OSSL_METHOD_CONSTRUCT_METHOD *mcm; int id; /* For get_encoder_from_store() */ const char *names; /* For get_encoder_from_store() */ const char *propquery; /* For get_encoder_from_store() */ @@ -126,21 +125,20 @@ static OSSL_METHOD_STORE *get_encoder_store(OSSL_LIB_CTX *libctx) } /* Get encoder methods from a store, or put one in */ -static void *get_encoder_from_store(OSSL_LIB_CTX *libctx, void *store, - void *data) +static void *get_encoder_from_store(void *store, void *data) { struct encoder_data_st *methdata = data; void *method = NULL; int id; if ((id = methdata->id) == 0) { - OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx); + OSSL_NAMEMAP *namemap = ossl_namemap_stored(methdata->libctx); id = ossl_namemap_name2num(namemap, methdata->names); } if (store == NULL - && (store = get_encoder_store(libctx)) == NULL) + && (store = get_encoder_store(methdata->libctx)) == NULL) return NULL; if (!ossl_method_store_fetch(store, id, methdata->propquery, &method)) @@ -148,19 +146,20 @@ static void *get_encoder_from_store(OSSL_LIB_CTX *libctx, void *store, return method; } -static int put_encoder_in_store(OSSL_LIB_CTX *libctx, void *store, - void *method, const OSSL_PROVIDER *prov, - int operation_id, const char *names, - const char *propdef, void *unused) +static int put_encoder_in_store(void *store, void *method, + const OSSL_PROVIDER *prov, + const char *names, const char *propdef, + void *data) { + struct encoder_data_st *methdata = data; OSSL_NAMEMAP *namemap; int id; - if ((namemap = ossl_namemap_stored(libctx)) == NULL + if ((namemap = ossl_namemap_stored(methdata->libctx)) == NULL || (id = ossl_namemap_name2num(namemap, names)) == 0) return 0; - if (store == NULL && (store = get_encoder_store(libctx)) == NULL) + if (store == NULL && (store = get_encoder_store(methdata->libctx)) == NULL) return 0; return ossl_method_store_add(store, prov, id, propdef, method, @@ -360,7 +359,6 @@ inner_ossl_encoder_fetch(struct encoder_data_st *methdata, int id, destruct_encoder }; - methdata->mcm = &mcm; methdata->id = id; methdata->names = name; methdata->propquery = properties; |