diff options
author | Richard Levitte <levitte@openssl.org> | 2021-03-10 12:58:53 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2021-04-18 10:10:24 +0200 |
commit | ad57a13bb86949a9e9adc7a2960e3f39e3e5b284 (patch) | |
tree | 67bfce29a5498715b5979c7b8f19baa3f313ddd8 /crypto/dh | |
parent | TEST: Modify how the retrieved digest name for SM2 digestsign is checked (diff) | |
download | openssl-ad57a13bb86949a9e9adc7a2960e3f39e3e5b284.tar.xz openssl-ad57a13bb86949a9e9adc7a2960e3f39e3e5b284.zip |
Modify OBJ_nid2sn(OBJ_obj2nid(...)) occurences to use OBJ_obj2txt()
The intention is to allow for OIDs for which libcrypto has no
information, but are still fetchable for OSSL_ALGORITHM
implementations that specify an OID amongst their names.
Fixes #14278
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14498)
Diffstat (limited to 'crypto/dh')
-rw-r--r-- | crypto/dh/dh_kdf.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/crypto/dh/dh_kdf.c b/crypto/dh/dh_kdf.c index d18e24eccb..619571537a 100644 --- a/crypto/dh/dh_kdf.c +++ b/crypto/dh/dh_kdf.c @@ -66,16 +66,11 @@ int DH_KDF_X9_42(unsigned char *out, size_t outlen, ASN1_OBJECT *key_oid, const unsigned char *ukm, size_t ukmlen, const EVP_MD *md) { - int nid; - const char *key_alg = NULL; + char key_alg[OSSL_MAX_NAME_SIZE]; const OSSL_PROVIDER *prov = EVP_MD_provider(md); OSSL_LIB_CTX *libctx = ossl_provider_libctx(prov); - nid = OBJ_obj2nid(key_oid); - if (nid == NID_undef) - return 0; - key_alg = OBJ_nid2sn(nid); - if (key_alg == NULL) + if (!OBJ_obj2txt(key_alg, sizeof(key_alg), key_oid, 0)) return 0; return ossl_dh_kdf_X9_42_asn1(out, outlen, Z, Zlen, key_alg, |