From f7c16d48a945e80f22f6f02550ee3fe14edb52fa Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Sat, 14 Sep 2019 16:22:19 +0200 Subject: In provider implemented methods, save the name number, not the name string Multiple names per implementation is already supported in the namemap, but hasn't been used yet. However, as soon as we have multiple names, we will get an issue with what name should be saved in the method. The solution is to not save the name itself, but rather the number it's associated with. This number is supposed to be unique for each set of names, and we assume that algorithm names are globally unique, i.e. there can be no name overlap between different algorithm types. Incidently, it was also found that the 'get' function used by ossl_construct_method() doesn't need all the parameters it was given; most of what it needs, it can now get through the data structure given by the caller of ossl_construct_method(). As a consequence, ossl_construct_method() itself doesn't need all the parameters it was given either. There are some added internal functions that are expected to disappear as soon as legacy code is removed, such as evp_first_name() and ossl_namemap_num2name(). Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/9897) --- crypto/include/internal/evp_int.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'crypto/include/internal') diff --git a/crypto/include/internal/evp_int.h b/crypto/include/internal/evp_int.h index caf0ca1dd9..f1fb67207f 100644 --- a/crypto/include/internal/evp_int.h +++ b/crypto/include/internal/evp_int.h @@ -130,7 +130,7 @@ extern const EVP_PKEY_METHOD siphash_pkey_meth; struct evp_mac_st { OSSL_PROVIDER *prov; - char *name; + int name_id; CRYPTO_REF_COUNT refcnt; CRYPTO_RWLOCK *lock; @@ -152,7 +152,7 @@ struct evp_mac_st { struct evp_kdf_st { OSSL_PROVIDER *prov; - char *name; + int name_id; CRYPTO_REF_COUNT refcnt; CRYPTO_RWLOCK *lock; @@ -199,7 +199,7 @@ struct evp_md_st { /* New structure members */ /* TODO(3.0): Remove above comment when legacy has gone */ - char *name; + int name_id; OSSL_PROVIDER *prov; CRYPTO_REF_COUNT refcnt; CRYPTO_RWLOCK *lock; @@ -252,7 +252,7 @@ struct evp_cipher_st { /* New structure members */ /* TODO(3.0): Remove above comment when legacy has gone */ - char *name; + int name_id; OSSL_PROVIDER *prov; CRYPTO_REF_COUNT refcnt; CRYPTO_RWLOCK *lock; -- cgit v1.2.3