Skip to content

Commit

Permalink
crypto: use CHECK instead in getSSLCiphers
Browse files Browse the repository at this point in the history
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: #16453
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
  • Loading branch information
jasnell committed Oct 26, 2017
1 parent 33021ba commit df8c6c3
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/node_crypto.cc
Expand Up @@ -5613,15 +5613,10 @@ void GetSSLCiphers(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args); Environment* env = Environment::GetCurrent(args);


SSL_CTX* ctx = SSL_CTX_new(TLSv1_server_method()); SSL_CTX* ctx = SSL_CTX_new(TLSv1_server_method());
if (ctx == nullptr) { CHECK_NE(ctx, nullptr);
return env->ThrowError("SSL_CTX_new() failed.");
}


SSL* ssl = SSL_new(ctx); SSL* ssl = SSL_new(ctx);
if (ssl == nullptr) { CHECK_NE(ssl, nullptr);
SSL_CTX_free(ctx);
return env->ThrowError("SSL_new() failed.");
}


Local<Array> arr = Array::New(env->isolate()); Local<Array> arr = Array::New(env->isolate());
STACK_OF(SSL_CIPHER)* ciphers = SSL_get_ciphers(ssl); STACK_OF(SSL_CIPHER)* ciphers = SSL_get_ciphers(ssl);
Expand Down

0 comments on commit df8c6c3

Please sign in to comment.