Skip to content

Commit df8c6c3

Browse files
committed
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 <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
1 parent 33021ba commit df8c6c3

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/node_crypto.cc

+2-7
Original file line numberDiff line numberDiff line change
@@ -5613,15 +5613,10 @@ void GetSSLCiphers(const FunctionCallbackInfo<Value>& args) {
56135613
Environment* env = Environment::GetCurrent(args);
56145614

56155615
SSL_CTX* ctx = SSL_CTX_new(TLSv1_server_method());
5616-
if (ctx == nullptr) {
5617-
return env->ThrowError("SSL_CTX_new() failed.");
5618-
}
5616+
CHECK_NE(ctx, nullptr);
56195617

56205618
SSL* ssl = SSL_new(ctx);
5621-
if (ssl == nullptr) {
5622-
SSL_CTX_free(ctx);
5623-
return env->ThrowError("SSL_new() failed.");
5624-
}
5619+
CHECK_NE(ssl, nullptr);
56255620

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

0 commit comments

Comments
 (0)