diff options
author | Richard Levitte <levitte@openssl.org> | 2019-09-21 20:57:51 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2019-09-23 09:13:25 +0200 |
commit | 320408382046db015c9a9cc04ae91c2bcd0e5c4c (patch) | |
tree | 46d9721a3d9ce06444f5052bedcd334f38d94315 /crypto/evp/evp_fetch.c | |
parent | 15dbf3a5a1ec27315753ef5a9148f6ad69277909 (diff) |
Rework cipher / digest fetching for legacy nids with multiple name support
With multiple names, it's no longer viable to just grab the "first" in
the set and use that to find the legacy NID. Instead, all names for
an algorithm must be checked, and if we encounter more than one NID
asssociated with those names, we consider it an error and make that
method unloadable.
This ensures that all methods that do have an internal NID associated
will get that NID in their structure, thereby ensuring that other
parts of libcrypto that haven't gone away from using NIDs for
comparison will continue to work as expected.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/9969)
Diffstat (limited to 'crypto/evp/evp_fetch.c')
-rw-r--r-- | crypto/evp/evp_fetch.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/crypto/evp/evp_fetch.c b/crypto/evp/evp_fetch.c index 6e31af79f2..cd2bacea5d 100644 --- a/crypto/evp/evp_fetch.c +++ b/crypto/evp/evp_fetch.c @@ -393,3 +393,13 @@ int evp_is_a(OSSL_PROVIDER *prov, int number, const char *name) return ossl_namemap_name2num(namemap, name) == number; } + +void evp_doall_names(OSSL_PROVIDER *prov, int number, + void (*fn)(const char *name, void *data), + void *data) +{ + OPENSSL_CTX *libctx = ossl_provider_library_context(prov); + OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx); + + ossl_namemap_doall_names(namemap, number, fn, data); +} |