From 8278184631424eaf0365d54fb81fd228af2dce38 Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Thu, 4 Dec 2014 16:26:47 -0500 Subject: Remove redundant checks in ssl_cert_dup. PR#3613 (Imported from upstream's fc3968a25ce0c16cab8730ec0d68a59856158029) We don't care about GOST, but removing redundant code is reasonable. Also switch that CRYPTO_add to EVP_PKEY_dup. Missed a spot. Change-Id: I768ec546d987fb3d8bc3decf7ebf1a5590fbb6c2 Reviewed-on: https://boringssl-review.googlesource.com/2477 Reviewed-by: Adam Langley --- ssl/ssl_cert.c | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/ssl/ssl_cert.c b/ssl/ssl_cert.c index 771ec67..f083920 100644 --- a/ssl/ssl_cert.c +++ b/ssl/ssl_cert.c @@ -247,29 +247,7 @@ CERT *ssl_cert_dup(CERT *cert) if (cpk->privatekey != NULL) { - rpk->privatekey = cpk->privatekey; - CRYPTO_add(&cpk->privatekey->references, 1, - CRYPTO_LOCK_EVP_PKEY); - - switch(i) - { - /* If there was anything special to do for - * certain types of keys, we'd do it here. - * (Nothing at the moment, I think.) */ - - case SSL_PKEY_RSA_ENC: - case SSL_PKEY_RSA_SIGN: - /* We have an RSA key. */ - break; - - case SSL_PKEY_ECC: - /* We have an ECC key */ - break; - - default: - /* Can't happen. */ - OPENSSL_PUT_ERROR(SSL, ssl_cert_dup, SSL_R_LIBRARY_BUG); - } + rpk->privatekey = EVP_PKEY_dup(cpk->privatekey); } if (cpk->chain) -- cgit v1.1