diff options
-rw-r--r-- | crypto/evp/p_lib.c | 4 | ||||
-rw-r--r-- | ssl/ssl_rsa.c | 23 |
2 files changed, 5 insertions, 22 deletions
diff --git a/crypto/evp/p_lib.c b/crypto/evp/p_lib.c index 66487054ae..f82e42c7e3 100644 --- a/crypto/evp/p_lib.c +++ b/crypto/evp/p_lib.c @@ -1154,7 +1154,7 @@ int EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey, pctx); } -static void find_md_nid(const char *mdname, void *data) +static void mdname2nid(const char *mdname, void *data) { int *nid = (int *)data; @@ -1199,7 +1199,7 @@ static int legacy_asn1_ctrl_to_param(EVP_PKEY *pkey, int op, * We have the namemap number - now we need to find the * associated nid */ - ossl_namemap_doall_names(namemap, mdnum, find_md_nid, &nid); + ossl_namemap_doall_names(namemap, mdnum, mdname2nid, &nid); *(int *)arg2 = nid; } return rv; diff --git a/ssl/ssl_rsa.c b/ssl/ssl_rsa.c index bfdd5ff43d..1c1053d316 100644 --- a/ssl/ssl_rsa.c +++ b/ssl/ssl_rsa.c @@ -124,26 +124,9 @@ static int ssl_set_pkey(CERT *c, EVP_PKEY *pkey) return 0; } - if (c->pkeys[i].x509 != NULL) { - EVP_PKEY *pktmp; - pktmp = X509_get0_pubkey(c->pkeys[i].x509); - if (pktmp == NULL) { - ERR_raise(ERR_LIB_SSL, ERR_R_MALLOC_FAILURE); - return 0; - } - /* - * The return code from EVP_PKEY_copy_parameters is deliberately - * ignored. Some EVP_PKEY types cannot do this. - */ - EVP_PKEY_copy_parameters(pktmp, pkey); - ERR_clear_error(); - - if (!X509_check_private_key(c->pkeys[i].x509, pkey)) { - X509_free(c->pkeys[i].x509); - c->pkeys[i].x509 = NULL; - return 0; - } - } + if (c->pkeys[i].x509 != NULL + && !X509_check_private_key(c->pkeys[i].x509, pkey)) + return 0; EVP_PKEY_free(c->pkeys[i].privatekey); EVP_PKEY_up_ref(pkey); |