Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
tls: simplify errors in SetKey
  • Loading branch information
tniessen committed Jan 21, 2020
commit b18725078c731e747455d5838fb3b45186cdc3e4
9 changes: 2 additions & 7 deletions src/node_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -733,19 +733,14 @@ void SecureContext::SetKey(const FunctionCallbackInfo<Value>& args) {

if (!key) {
unsigned long err = ERR_get_error(); // NOLINT(runtime/int)
if (!err) {
return env->ThrowError("PEM_read_bio_PrivateKey");
}
return ThrowCryptoError(env, err);
return ThrowCryptoError(env, err, "PEM_read_bio_PrivateKey");
}

int rv = SSL_CTX_use_PrivateKey(sc->ctx_.get(), key.get());

if (!rv) {
unsigned long err = ERR_get_error(); // NOLINT(runtime/int)
if (!err)
return env->ThrowError("SSL_CTX_use_PrivateKey");
return ThrowCryptoError(env, err);
return ThrowCryptoError(env, err, "SSL_CTX_use_PrivateKey");
}
}

Expand Down