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.
  • Loading branch information
jasnell committed Oct 26, 2017
1 parent 76b8803 commit 1ab7c6b
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/node_crypto.cc
Expand Up @@ -5618,15 +5618,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);
Expand Down

0 comments on commit 1ab7c6b

Please sign in to comment.