tls: workaround handshakedone in renegotiation
authorShigeki Ohtsu <ohtsu@ohtsu.org>
Wed, 12 Sep 2018 08:34:24 +0000 (17:34 +0900)
committerJérémy Lal <kapouer@melix.org>
Fri, 25 Jan 2019 12:51:37 +0000 (12:51 +0000)
`SSL_CB_HANDSHAKE_START` and `SSL_CB_HANDSHAKE_DONE` are called
sending HelloRequest in OpenSSL-1.1.1.
We need to check whether this is in a renegotiation state or not.

Gbp-Pq: Topic ssl
Gbp-Pq: Name 8ceb260cc3e06a1ec43df9dbc63a3eb341b4559e.patch

src/tls_wrap.cc

index b5eff3835856bba908c8eba8e45c48da876f74e6..0ec66fc467e7993e5972aa8727cf45530f487c17 100644 (file)
@@ -221,7 +221,10 @@ void TLSWrap::SSLInfoCallback(const SSL* ssl_, int where, int ret) {
     }
   }
 
-  if (where & SSL_CB_HANDSHAKE_DONE) {
+  // SSL_CB_HANDSHAKE_START and SSL_CB_HANDSHAKE_DONE are called
+  // sending HelloRequest in OpenSSL-1.1.1.
+  // We need to check whether this is in a renegotiation state or not.
+  if (where & SSL_CB_HANDSHAKE_DONE && !SSL_renegotiate_pending(ssl)) {
     c->established_ = true;
     Local<Value> callback = object->Get(env->onhandshakedone_string());
     if (callback->IsFunction()) {