diff options
author | Richard Levitte <levitte@openssl.org> | 2019-05-08 14:00:31 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2019-05-12 13:43:38 -0700 |
commit | 0211740fcc47a954be19cceb65fb57a6f7deb797 (patch) | |
tree | 6eaa2197081d55c35f53d97d2ebe1fdd3cc4e34e /doc/internal | |
parent | 1f79ddf5049ff53ad8a7cbab76e62d02d9ac099f (diff) |
EVP_FETCH: remove the need to transport the legacy NID through construction
Now that the legacy NID isn't used as a main index for fetched
algorithms, the legacy NID was just transported around unnecessarily.
This is removed, and the legacy NID is simply set by EVP_{API}_fetch()
after the construction process is done.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/8878)
Diffstat (limited to 'doc/internal')
-rw-r--r-- | doc/internal/man3/evp_generic_fetch.pod | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/doc/internal/man3/evp_generic_fetch.pod b/doc/internal/man3/evp_generic_fetch.pod index 8b0f542515..2679a7eba2 100644 --- a/doc/internal/man3/evp_generic_fetch.pod +++ b/doc/internal/man3/evp_generic_fetch.pod @@ -11,11 +11,10 @@ evp_generic_fetch - generic algorithm fetcher and method creator for EVP void *evp_generic_fetch(OPENSSL_CTX *libctx, int operation_id, const char *name, const char *properties, - void *(*new_method)(int nid, const OSSL_DISPATCH *fns, + void *(*new_method)(const OSSL_DISPATCH *fns, OSSL_PROVIDER *prov), int (*upref_method)(void *), - void (*free_method)(void *), - int (*nid_method)(void *)); + void (*free_method)(void *)); =head1 DESCRIPTION @@ -42,10 +41,6 @@ one. frees the given method. -=item nid_method() - -returns the nid associated with the given method. - =back =head1 RETURN VALUES @@ -80,7 +75,6 @@ And here's the implementation of the FOO method fetcher: /* typedef struct evp_foo_st EVP_FOO */ struct evp_foo_st { OSSL_PROVIDER *prov; - int nid; CRYPTO_REF_COUNT refcnt; OSSL_OP_foo_newctx_fn *newctx; OSSL_OP_foo_init_fn *init; @@ -93,7 +87,7 @@ And here's the implementation of the FOO method fetcher: * In this example, we have a public method creator and destructor. * It's not absolutely necessary, but is in the spirit of OpenSSL. */ - EVP_FOO *EVP_FOO_meth_from_dispatch(int foo_type, const OSSL_DISPATCH *fns, + EVP_FOO *EVP_FOO_meth_from_dispatch(const OSSL_DISPATCH *fns, OSSL_PROVIDER *prov) { EVP_FOO *foo = NULL; @@ -120,7 +114,6 @@ And here's the implementation of the FOO method fetcher: break; } } - foo->nid = foo_type; foo->prov = prov; if (prov) ossl_provider_upref(prov); @@ -138,10 +131,10 @@ And here's the implementation of the FOO method fetcher: } } - static void *foo_from_dispatch(int nid, const OSSL_DISPATCH *fns, + static void *foo_from_dispatch(const OSSL_DISPATCH *fns, OSSL_PROVIDER *prov) { - return EVP_FOO_meth_from_dispatch(nid, fns, prov); + return EVP_FOO_meth_from_dispatch(fns, prov); } static int foo_upref(void *vfoo) @@ -162,8 +155,18 @@ And here's the implementation of the FOO method fetcher: const char *name, const char *properties) { - return evp_generic_fetch(ctx, OSSL_OP_FOO, name, properties, - foo_from_dispatch, foo_upref, foo_free); + EVP_FOO *foo = + evp_generic_fetch(ctx, OSSL_OP_FOO, name, properties, + foo_from_dispatch, foo_upref, foo_free); + + /* + * If this method exists in legacy form, with a constant NID for the + * given |name|, this is the spot to find that NID and set it in + * the newly constructed EVP_FOO instance. + */ + + return foo; + } And finally, the library functions: |