Commit 69343d6 1 parent e57fd51 commit 69343d6 Copy full SHA for 69343d6
File tree 3 files changed +24
-16
lines changed
3 files changed +24
-16
lines changed Original file line number Diff line number Diff line change @@ -116,21 +116,6 @@ static X509_NAME *cnnic_ev_name =
116
116
d2i_X509_NAME (nullptr , &cnnic_ev_p,
117
117
sizeof (CNNIC_EV_ROOT_CA_SUBJECT_DATA)-1 );
118
118
119
- // Forcibly clear OpenSSL's error stack on return. This stops stale errors
120
- // from popping up later in the lifecycle of crypto operations where they
121
- // would cause spurious failures. It's a rather blunt method, though.
122
- // ERR_clear_error() isn't necessarily cheap either.
123
- struct ClearErrorOnReturn {
124
- ~ClearErrorOnReturn () { ERR_clear_error (); }
125
- };
126
-
127
- // Pop errors from OpenSSL's error stack that were added
128
- // between when this was constructed and destructed.
129
- struct MarkPopErrorOnReturn {
130
- MarkPopErrorOnReturn () { ERR_set_mark (); }
131
- ~MarkPopErrorOnReturn () { ERR_pop_to_mark (); }
132
- };
133
-
134
119
static uv_mutex_t * locks;
135
120
136
121
const char * const root_certs[] = {
Original file line number Diff line number Diff line change 39
39
namespace node {
40
40
namespace crypto {
41
41
42
+ // Forcibly clear OpenSSL's error stack on return. This stops stale errors
43
+ // from popping up later in the lifecycle of crypto operations where they
44
+ // would cause spurious failures. It's a rather blunt method, though.
45
+ // ERR_clear_error() isn't necessarily cheap either.
46
+ struct ClearErrorOnReturn {
47
+ ~ClearErrorOnReturn () { ERR_clear_error (); }
48
+ };
49
+
50
+ // Pop errors from OpenSSL's error stack that were added
51
+ // between when this was constructed and destructed.
52
+ struct MarkPopErrorOnReturn {
53
+ MarkPopErrorOnReturn () { ERR_set_mark (); }
54
+ ~MarkPopErrorOnReturn () { ERR_pop_to_mark (); }
55
+ };
56
+
42
57
enum CheckResult {
43
58
CHECK_CERT_REVOKED = 0 ,
44
59
CHECK_OK = 1
Original file line number Diff line number Diff line change @@ -31,7 +31,6 @@ using v8::Object;
31
31
using v8::String;
32
32
using v8::Value;
33
33
34
-
35
34
TLSWrap::TLSWrap (Environment* env,
36
35
Kind kind,
37
36
StreamBase* stream,
@@ -401,6 +400,8 @@ void TLSWrap::ClearOut() {
401
400
if (ssl_ == nullptr )
402
401
return ;
403
402
403
+ crypto::MarkPopErrorOnReturn mark_pop_error_on_return;
404
+
404
405
char out[kClearOutChunkSize ];
405
406
int read ;
406
407
for (;;) {
@@ -462,6 +463,8 @@ bool TLSWrap::ClearIn() {
462
463
if (ssl_ == nullptr )
463
464
return false ;
464
465
466
+ crypto::MarkPopErrorOnReturn mark_pop_error_on_return;
467
+
465
468
int written = 0 ;
466
469
while (clear_in_->Length () > 0 ) {
467
470
size_t avail = 0 ;
@@ -589,6 +592,8 @@ int TLSWrap::DoWrite(WriteWrap* w,
589
592
if (ssl_ == nullptr )
590
593
return UV_EPROTO;
591
594
595
+ crypto::MarkPopErrorOnReturn mark_pop_error_on_return;
596
+
592
597
int written = 0 ;
593
598
for (i = 0 ; i < count; i++) {
594
599
written = SSL_write (ssl_, bufs[i].base , bufs[i].len );
@@ -704,8 +709,11 @@ void TLSWrap::DoRead(ssize_t nread,
704
709
705
710
706
711
int TLSWrap::DoShutdown (ShutdownWrap* req_wrap) {
712
+ crypto::MarkPopErrorOnReturn mark_pop_error_on_return;
713
+
707
714
if (ssl_ != nullptr && SSL_shutdown (ssl_) == 0 )
708
715
SSL_shutdown (ssl_);
716
+
709
717
shutdown_ = true ;
710
718
EncOut ();
711
719
return stream_->DoShutdown (req_wrap);
You can’t perform that action at this time.
0 commit comments