From 281053e9cc3bb65bee52012e868d1c0ef72d065d Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Tue, 13 Feb 2024 22:52:54 -0500 Subject: [PATCH] Remove some impossible null checks The CERT structure is never null. Change-Id: I92436e1ad6156a9f79d30f4f5e989022e8fd0e9d Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/66371 Reviewed-by: Bob Beck Commit-Queue: David Benjamin --- ssl/ssl_lib.cc | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/ssl/ssl_lib.cc b/ssl/ssl_lib.cc index 23fdccb38..81a980713 100644 --- a/ssl/ssl_lib.cc +++ b/ssl/ssl_lib.cc @@ -2509,21 +2509,13 @@ size_t SSL_get0_peer_delegation_algorithms(const SSL *ssl, EVP_PKEY *SSL_get_privatekey(const SSL *ssl) { if (!ssl->config) { assert(ssl->config); - return NULL; + return nullptr; } - if (ssl->config->cert != NULL) { - return ssl->config->cert->privatekey.get(); - } - - return NULL; + return ssl->config->cert->privatekey.get(); } EVP_PKEY *SSL_CTX_get0_privatekey(const SSL_CTX *ctx) { - if (ctx->cert != NULL) { - return ctx->cert->privatekey.get(); - } - - return NULL; + return ctx->cert->privatekey.get(); } const SSL_CIPHER *SSL_get_current_cipher(const SSL *ssl) {