From 5050fd5b3b7d18eec966469726180efb6c72c594 Mon Sep 17 00:00:00 2001 From: Tomas Mraz Date: Fri, 26 Mar 2021 17:57:16 +0100 Subject: Avoid going through NID when unnecessary Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/14703) --- crypto/pem/pem_info.c | 4 ++-- crypto/pem/pem_lib.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'crypto/pem') diff --git a/crypto/pem/pem_info.c b/crypto/pem/pem_info.c index c615d24ed0..54e29ab41f 100644 --- a/crypto/pem/pem_info.c +++ b/crypto/pem/pem_info.c @@ -282,7 +282,7 @@ int PEM_X509_INFO_write_bio(BIO *bp, const X509_INFO *xi, EVP_CIPHER *enc, const unsigned char *iv = NULL; if (enc != NULL) { - objstr = OBJ_nid2sn(EVP_CIPHER_nid(enc)); + objstr = EVP_CIPHER_name(enc); if (objstr == NULL /* * Check "Proc-Type: 4,Encrypted\nDEK-Info: objstr,hex-iv\n" @@ -317,7 +317,7 @@ int PEM_X509_INFO_write_bio(BIO *bp, const X509_INFO *xi, EVP_CIPHER *enc, * than what the user has passed us ... as we have to match * exactly for some strange reason */ - objstr = OBJ_nid2sn(EVP_CIPHER_nid(xi->enc_cipher.cipher)); + objstr = EVP_CIPHER_name(xi->enc_cipher.cipher); if (objstr == NULL) { ERR_raise(ERR_LIB_PEM, PEM_R_UNSUPPORTED_CIPHER); goto err; diff --git a/crypto/pem/pem_lib.c b/crypto/pem/pem_lib.c index c8e0b264da..16b65fa945 100644 --- a/crypto/pem/pem_lib.c +++ b/crypto/pem/pem_lib.c @@ -323,7 +323,7 @@ int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, unsigned char iv[EVP_MAX_IV_LENGTH]; if (enc != NULL) { - objstr = OBJ_nid2sn(EVP_CIPHER_nid(enc)); + objstr = EVP_CIPHER_name(enc); if (objstr == NULL || EVP_CIPHER_iv_length(enc) == 0 || EVP_CIPHER_iv_length(enc) > (int)sizeof(iv) /* -- cgit v1.2.3