From df8c6c3651d29602601310a9219e777084d0d3a9 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Tue, 24 Oct 2017 11:39:36 -0700 Subject: [PATCH] crypto: use CHECK instead in getSSLCiphers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous throws should never happen, and if they do, they signal a larger issue in core. Make these checks rather than throws. PR-URL: https://github.com/nodejs/node/pull/16453 Reviewed-By: Matteo Collina Reviewed-By: Ben Noordhuis Reviewed-By: Tobias Nießen --- src/node_crypto.cc | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 45d703cba161a1..3d114d73d2c309 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -5613,15 +5613,10 @@ void GetSSLCiphers(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); SSL_CTX* ctx = SSL_CTX_new(TLSv1_server_method()); - if (ctx == nullptr) { - return env->ThrowError("SSL_CTX_new() failed."); - } + CHECK_NE(ctx, nullptr); SSL* ssl = SSL_new(ctx); - if (ssl == nullptr) { - SSL_CTX_free(ctx); - return env->ThrowError("SSL_new() failed."); - } + CHECK_NE(ssl, nullptr); Local arr = Array::New(env->isolate()); STACK_OF(SSL_CIPHER)* ciphers = SSL_get_ciphers(ssl);