In provider implemented methods, save the name number, not the name string
authorRichard Levitte <levitte@openssl.org>
Sat, 14 Sep 2019 14:22:19 +0000 (16:22 +0200)
committerRichard Levitte <levitte@openssl.org>
Thu, 19 Sep 2019 12:58:17 +0000 (14:58 +0200)
commitf7c16d48a945e80f22f6f02550ee3fe14edb52fa
treeb6ec900293f5a14213aa1836c916ea4e11f7c260
parentf8c0218f09e190a2efb28302f6c9737efe151d27
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 <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9897)
18 files changed:
crypto/core_fetch.c
crypto/core_namemap.c
crypto/evp/digest.c
crypto/evp/evp_enc.c
crypto/evp/evp_fetch.c
crypto/evp/evp_lib.c
crypto/evp/evp_locl.h
crypto/evp/exchange.c
crypto/evp/kdf_lib.c
crypto/evp/kdf_meth.c
crypto/evp/keymgmt_meth.c
crypto/evp/mac_meth.c
crypto/evp/pmeth_fn.c
crypto/include/internal/evp_int.h
doc/internal/man3/evp_generic_fetch.pod
doc/internal/man3/ossl_method_construct.pod
include/internal/core.h
include/internal/namemap.h