Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
crypto: clear openssl error stack when handled
Browse files Browse the repository at this point in the history
Clear OpenSSL's error stack on return from Connection::HandleSSLError().
This stops stale errors from popping up later in the lifecycle of the
SSL connection where they would cause spurious failures.

This commit causes a 1-2% performance regression on `make bench-tls`.
We'll address that in follow-up commits if possible but let's ensure
correctness first.

Backport of c6e2db2
  • Loading branch information
bnoordhuis authored and tjfontaine committed Oct 18, 2013
1 parent c421a5e commit 78fe7d0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/node_crypto.cc
Expand Up @@ -711,6 +711,9 @@ int Connection::HandleBIOError(BIO *bio, const char* func, int rv) {


int Connection::HandleSSLError(const char* func, int rv) {
ClearErrorOnReturn clear_error_on_return;
(void) &clear_error_on_return; // Silence unused variable warning.

if (rv >= 0) return rv;

int err = SSL_get_error(ssl_, rv);
Expand Down

0 comments on commit 78fe7d0

Please sign in to comment.