Skip to content

Commit d4c4f77

Browse files
sam-githubaddaleax
authored andcommitted
src: const_cast is necessary for 1.1.1, not 0.9.7
The const_cast used to be necessary for SSL_get_app_data() in OpenSSL 0.9.7, but node doesn't compile against OpenSSL versions that old. However, now it's needed for the recently introduced SSL_renegotiate_pending(), which is not const-correct as of 1.1.1a. PR-URL: #25861 Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
1 parent 4d0b56f commit d4c4f77

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/tls_wrap.cc

+2-3
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,9 @@ void TLSWrap::SSLInfoCallback(const SSL* ssl_, int where, int ret) {
209209
if (!(where & (SSL_CB_HANDSHAKE_START | SSL_CB_HANDSHAKE_DONE)))
210210
return;
211211

212-
// Be compatible with older versions of OpenSSL. SSL_get_app_data() wants
213-
// a non-const SSL* in OpenSSL <= 0.9.7e.
212+
// SSL_renegotiate_pending() should take `const SSL*`, but it does not.
214213
SSL* ssl = const_cast<SSL*>(ssl_);
215-
TLSWrap* c = static_cast<TLSWrap*>(SSL_get_app_data(ssl));
214+
TLSWrap* c = static_cast<TLSWrap*>(SSL_get_app_data(ssl_));
216215
Environment* env = c->env();
217216
HandleScope handle_scope(env->isolate());
218217
Context::Scope context_scope(env->context());

0 commit comments

Comments
 (0)