Ensure legacy_asn1_ctrl_to_param can handle MDs not in the OBJ database
authorMatt Caswell <matt@openssl.org>
Tue, 19 Jan 2021 11:36:24 +0000 (11:36 +0000)
committerMatt Caswell <matt@openssl.org>
Fri, 22 Jan 2021 09:30:45 +0000 (09:30 +0000)
commit5060cd5f3ed14a2dc4764cc1e042f76af6b44664
tree5e8a40c6d75ac52d8f41fad6bd8d716811fcaeb0
parentef161e7b8f61ea588c654c9600bde80b2e07588f
Ensure legacy_asn1_ctrl_to_param can handle MDs not in the OBJ database

The legacy_asn1_ctrl_to_param implementation of
ASN1_PKEY_CTRL_DEFAULT_MD_NID calls EVP_PKEY_get_default_digest_name()
which returns an mdname. Previously we were using OBJ_sn2nid/OBJ_ln2nid
to lookup that name in the OBJ database. However we might get an md name
back that only exists in the namemap, not in the OBJ database. In that
case we need to check the various aliases for the name, to see if one of
those matches the name we are looking for.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13899)
crypto/evp/p_lib.c