Permalink
Browse files

crypto: use CHECK instead in getSSLCiphers

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 24, 2017
1 parent 33021ba commit df8c6c3651d29602601310a9219e777084d0d3a9
Showing with 2 additions and 7 deletions.
  1. +2 −7 src/node_crypto.cc
View
@@ -5613,15 +5613,10 @@ void GetSSLCiphers(const FunctionCallbackInfo<Value>& 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<Array> arr = Array::New(env->isolate());
STACK_OF(SSL_CIPHER)* ciphers = SSL_get_ciphers(ssl);

0 comments on commit df8c6c3

Please sign in to comment.