-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ssl handshake failure v0.12 or v0.11 #4485
Comments
May I ask you which particular version of v0.12 you are using? Am I right that you don't expect it to work on v0.10, and it is the version that should be fixed? |
i test by nvm |
Confirmed looking into it. |
It looks like v5 should fail too, but for some reason it does not... Looking into it. |
It actually fails too, it is just emitting EPROTO instead of SSL error. Another problem with v0.12 is that it seems to be emitting SSL error on wrong socket. Will see how it should be fixed. |
@magicode may I ask you to test following patch for v0.12 ? diff --git a/src/tls_wrap.cc b/src/tls_wrap.cc
index 607f786..fa36a1d 100644
--- a/src/tls_wrap.cc
+++ b/src/tls_wrap.cc
@@ -56,6 +56,9 @@ using v8::Value;
size_t TLSCallbacks::error_off_;
char TLSCallbacks::error_buf_[1024];
+struct ClearErrorOnReturn {
+ ~ClearErrorOnReturn() { ERR_clear_error(); }
+};
TLSCallbacks::TLSCallbacks(Environment* env,
Kind kind,
@@ -451,6 +454,9 @@ void TLSCallbacks::ClearOut() {
if (eof_)
return;
+ ClearErrorOnReturn clear_error_on_return;
+ (void) &clear_error_on_return; // Silence compiler warning.
+
HandleScope handle_scope(env()->isolate());
Context::Scope context_scope(env()->context());
@@ -501,6 +507,9 @@ bool TLSCallbacks::ClearIn() {
if (!hello_parser_.IsEnded())
return false;
+ ClearErrorOnReturn clear_error_on_return;
+ (void) &clear_error_on_return; // Silence compiler warning.
+
int written = 0;
while (clear_in_->Length() > 0) {
size_t avail = 0;
@@ -590,6 +599,9 @@ int TLSCallbacks::DoWrite(WriteWrap* w,
return 0;
}
+ ClearErrorOnReturn clear_error_on_return;
+ (void) &clear_error_on_return; // Silence compiler warning.
+
int written = 0;
for (i = 0; i < count; i++) {
written = SSL_write(ssl_, bufs[i].base, bufs[i].len);
@@ -675,6 +687,9 @@ void TLSCallbacks::DoRead(uv_stream_t* handle,
int TLSCallbacks::DoShutdown(ShutdownWrap* req_wrap, uv_shutdown_cb cb) {
+ ClearErrorOnReturn clear_error_on_return;
+ (void) &clear_error_on_return; // Silence compiler warning.
+
if (SSL_shutdown(ssl_) == 0)
SSL_shutdown(ssl_);
shutdown_ = true;
Appears to be fixing problem for me. Thanks! |
Should be fixed by #4515 |
Adopt `MarkPopErrorOnReturn` from `node_crypto.cc`, and use it to clear errors after `SSL_read`/`SSL_write`/`SSL_shutdown` functions. See: nodejs#4485 PR-URL: nodejs#4515 Reviewed-By: Ben Noordhuis <[email protected]>
Adopt `MarkPopErrorOnReturn` from `node_crypto.cc`, and use it to clear errors after `SSL_read`/`SSL_write`/`SSL_shutdown` functions. See: #4485 PR-URL: #4515 Reviewed-By: Ben Noordhuis <[email protected]>
Adopt `MarkPopErrorOnReturn` from `node_crypto.cc`, and use it to clear errors after `SSL_read`/`SSL_write`/`SSL_shutdown` functions. See: nodejs#4485 PR-URL: nodejs#4515 Reviewed-By: Ben Noordhuis <[email protected]>
Should be fixed in v5.4.0. Please let us know if it isn't. |
I try patch for v0.12. it work well. thanks! |
Adopt `MarkPopErrorOnReturn` from `node_crypto.cc`, and use it to clear errors after `SSL_read`/`SSL_write`/`SSL_shutdown` functions. See: nodejs#4485 PR-URL: nodejs#4515 Reviewed-By: Ben Noordhuis <[email protected]>
Adopt `MarkPopErrorOnReturn` from `node_crypto.cc`, and use it to clear errors after `SSL_read`/`SSL_write`/`SSL_shutdown` functions. See: #4485 PR-URL: #4515 Reviewed-By: Ben Noordhuis <[email protected]> v4.x-staging Commit Metadata: PR-URL: #4709 Reviewed-By: James M Snell <[email protected]>
Adopt `MarkPopErrorOnReturn` from `node_crypto.cc`, and use it to clear errors after `SSL_read`/`SSL_write`/`SSL_shutdown` functions. See: #4485 PR-URL: #4515 Reviewed-By: Ben Noordhuis <[email protected]> v4.x-staging Commit Metadata: PR-URL: #4709 Reviewed-By: James M Snell <[email protected]>
Adopt `MarkPopErrorOnReturn` from `node_crypto.cc`, and use it to clear errors after `SSL_read`/`SSL_write`/`SSL_shutdown` functions. See: nodejs#4485 PR-URL: nodejs#4515 Reviewed-By: Ben Noordhuis <[email protected]>
Test Code
Output in node v0.12 or v.0.11
Output in node v0.10 , v4 , v5
The text was updated successfully, but these errors were encountered: