@@ -67,6 +67,14 @@ namespace crypto {
67
67
68
68
using namespace v8 ;
69
69
70
+ // Forcibly clear OpenSSL's error stack on return. This stops stale errors
71
+ // from popping up later in the lifecycle of crypto operations where they
72
+ // would cause spurious failures. It's a rather blunt method, though.
73
+ // ERR_clear_error() isn't necessarily cheap either.
74
+ struct ClearErrorOnReturn {
75
+ ~ClearErrorOnReturn () { ERR_clear_error (); }
76
+ };
77
+
70
78
static Persistent<String> errno_symbol;
71
79
static Persistent<String> syscall_symbol;
72
80
static Persistent<String> subject_symbol;
@@ -908,13 +916,6 @@ int Connection::HandleBIOError(BIO *bio, const char* func, int rv) {
908
916
909
917
910
918
int Connection::HandleSSLError (const char * func, int rv, ZeroStatus zs) {
911
- // Forcibly clear OpenSSL's error stack on return. This stops stale errors
912
- // from popping up later in the lifecycle of the SSL connection where they
913
- // would cause spurious failures. It's a rather blunt method, though.
914
- // ERR_clear_error() isn't necessarily cheap either.
915
- struct ClearErrorOnReturn {
916
- ~ClearErrorOnReturn () { ERR_clear_error (); }
917
- };
918
919
ClearErrorOnReturn clear_error_on_return;
919
920
(void ) &clear_error_on_return; // Silence unused variable warning.
920
921
@@ -3603,6 +3604,8 @@ class DiffieHellman : public ObjectWrap {
3603
3604
return ThrowException (Exception::Error (String::New (" Not initialized" )));
3604
3605
}
3605
3606
3607
+ ClearErrorOnReturn clear_error_on_return;
3608
+ (void ) &clear_error_on_return; // Silence compiler warning.
3606
3609
BIGNUM* key = 0 ;
3607
3610
3608
3611
if (args.Length () == 0 ) {
0 commit comments