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 <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
  • 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
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit df8c6c3

Please sign in to comment.