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>
Thu, 28 Feb 2019 14:52:30 +0000 (14:52 +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 8fad350619e8cccb9f43f4d56f4ca743f5d069c2.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()) {