summaryrefslogtreecommitdiff
path: root/crypto/pem
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2021-03-26 17:57:16 +0100
committerTomas Mraz <tomas@openssl.org>2021-04-01 14:39:54 +0200
commit5050fd5b3b7d18eec966469726180efb6c72c594 (patch)
treee053f3428efc6a235a8a5aadea37cb4a1dade30a /crypto/pem
parentb064eebb5080178de9641a0520e2f22b5846e0f3 (diff)
downloadopenssl-new-5050fd5b3b7d18eec966469726180efb6c72c594.tar.gz
Avoid going through NID when unnecessary
Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14703)
Diffstat (limited to 'crypto/pem')
-rw-r--r--crypto/pem/pem_info.c4
-rw-r--r--crypto/pem/pem_lib.c2
2 files changed, 3 insertions, 3 deletions
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)
/*