@@ -133,24 +133,17 @@ template int SSLWrap<TLSWrap>::NewSessionCallback(SSL* s,
133133template void SSLWrap<TLSWrap>::OnClientHello(
134134 void * arg,
135135 const ClientHelloParser::ClientHello& hello);
136-
137- #ifdef NODE__HAVE_TLSEXT_STATUS_CB
138136template int SSLWrap<TLSWrap>::TLSExtStatusCallback(SSL* s, void * arg);
139- #endif
140-
141137template void SSLWrap<TLSWrap>::DestroySSL();
142138template int SSLWrap<TLSWrap>::SSLCertCallback(SSL* s, void * arg);
143139template void SSLWrap<TLSWrap>::WaitForCertCb(CertCb cb, void * arg);
144-
145- #ifdef TLSEXT_TYPE_application_layer_protocol_negotiation
146140template int SSLWrap<TLSWrap>::SelectALPNCallback(
147141 SSL* s,
148142 const unsigned char ** out,
149143 unsigned char * outlen,
150144 const unsigned char * in,
151145 unsigned int inlen,
152146 void * arg);
153- #endif // TLSEXT_TYPE_application_layer_protocol_negotiation
154147
155148
156149static int PasswordCallback (char * buf, int size, int rwflag, void * u) {
@@ -1387,11 +1380,9 @@ void SSLWrap<Base>::AddMethods(Environment* env, Local<FunctionTemplate> t) {
13871380
13881381template <class Base >
13891382void SSLWrap<Base>::ConfigureSecureContext(SecureContext* sc) {
1390- #ifdef NODE__HAVE_TLSEXT_STATUS_CB
13911383 // OCSP stapling
13921384 SSL_CTX_set_tlsext_status_cb (sc->ctx_ .get (), TLSExtStatusCallback);
13931385 SSL_CTX_set_tlsext_status_arg (sc->ctx_ .get (), nullptr );
1394- #endif // NODE__HAVE_TLSEXT_STATUS_CB
13951386}
13961387
13971388
@@ -2019,7 +2010,6 @@ void SSLWrap<Base>::NewSessionDone(const FunctionCallbackInfo<Value>& args) {
20192010
20202011template <class Base >
20212012void SSLWrap<Base>::SetOCSPResponse(const FunctionCallbackInfo<Value>& args) {
2022- #ifdef NODE__HAVE_TLSEXT_STATUS_CB
20232013 Base* w;
20242014 ASSIGN_OR_RETURN_UNWRAP (&w, args.Holder ());
20252015 Environment* env = w->env ();
@@ -2030,18 +2020,15 @@ void SSLWrap<Base>::SetOCSPResponse(const FunctionCallbackInfo<Value>& args) {
20302020 THROW_AND_RETURN_IF_NOT_BUFFER (env, args[0 ], " OCSP response" );
20312021
20322022 w->ocsp_response_ .Reset (args.GetIsolate (), args[0 ].As <Object>());
2033- #endif // NODE__HAVE_TLSEXT_STATUS_CB
20342023}
20352024
20362025
20372026template <class Base >
20382027void SSLWrap<Base>::RequestOCSP(const FunctionCallbackInfo<Value>& args) {
2039- #ifdef NODE__HAVE_TLSEXT_STATUS_CB
20402028 Base* w;
20412029 ASSIGN_OR_RETURN_UNWRAP (&w, args.Holder ());
20422030
20432031 SSL_set_tlsext_status_type (w->ssl_ .get (), TLSEXT_STATUSTYPE_ocsp);
2044- #endif // NODE__HAVE_TLSEXT_STATUS_CB
20452032}
20462033
20472034
@@ -2226,7 +2213,6 @@ void SSLWrap<Base>::GetProtocol(const FunctionCallbackInfo<Value>& args) {
22262213}
22272214
22282215
2229- #ifdef TLSEXT_TYPE_application_layer_protocol_negotiation
22302216template <class Base >
22312217int SSLWrap<Base>::SelectALPNCallback(SSL* s,
22322218 const unsigned char ** out,
@@ -2256,13 +2242,11 @@ int SSLWrap<Base>::SelectALPNCallback(SSL* s,
22562242 return status == OPENSSL_NPN_NEGOTIATED ? SSL_TLSEXT_ERR_OK
22572243 : SSL_TLSEXT_ERR_NOACK;
22582244}
2259- #endif // TLSEXT_TYPE_application_layer_protocol_negotiation
22602245
22612246
22622247template <class Base >
22632248void SSLWrap<Base>::GetALPNNegotiatedProto(
22642249 const FunctionCallbackInfo<Value>& args) {
2265- #ifdef TLSEXT_TYPE_application_layer_protocol_negotiation
22662250 Base* w;
22672251 ASSIGN_OR_RETURN_UNWRAP (&w, args.Holder ());
22682252
@@ -2276,13 +2260,11 @@ void SSLWrap<Base>::GetALPNNegotiatedProto(
22762260
22772261 args.GetReturnValue ().Set (
22782262 OneByteString (args.GetIsolate (), alpn_proto, alpn_proto_len));
2279- #endif // TLSEXT_TYPE_application_layer_protocol_negotiation
22802263}
22812264
22822265
22832266template <class Base >
22842267void SSLWrap<Base>::SetALPNProtocols(const FunctionCallbackInfo<Value>& args) {
2285- #ifdef TLSEXT_TYPE_application_layer_protocol_negotiation
22862268 Base* w;
22872269 ASSIGN_OR_RETURN_UNWRAP (&w, args.Holder ());
22882270 Environment* env = w->env ();
@@ -2306,11 +2288,9 @@ void SSLWrap<Base>::SetALPNProtocols(const FunctionCallbackInfo<Value>& args) {
23062288 SelectALPNCallback,
23072289 nullptr );
23082290 }
2309- #endif // TLSEXT_TYPE_application_layer_protocol_negotiation
23102291}
23112292
23122293
2313- #ifdef NODE__HAVE_TLSEXT_STATUS_CB
23142294template <class Base >
23152295int SSLWrap<Base>::TLSExtStatusCallback(SSL* s, void * arg) {
23162296 Base* w = static_cast <Base*>(SSL_get_app_data (s));
@@ -2354,7 +2334,6 @@ int SSLWrap<Base>::TLSExtStatusCallback(SSL* s, void* arg) {
23542334 return SSL_TLSEXT_ERR_OK;
23552335 }
23562336}
2357- #endif // NODE__HAVE_TLSEXT_STATUS_CB
23582337
23592338
23602339template <class Base >
@@ -2396,11 +2375,7 @@ int SSLWrap<Base>::SSLCertCallback(SSL* s, void* arg) {
23962375 info->Set (context, env->servername_string (), str).FromJust ();
23972376 }
23982377
2399- bool ocsp = false ;
2400- #ifdef NODE__HAVE_TLSEXT_STATUS_CB
2401- ocsp = SSL_get_tlsext_status_type (s) == TLSEXT_STATUSTYPE_ocsp;
2402- #endif
2403-
2378+ const bool ocsp = (SSL_get_tlsext_status_type (s) == TLSEXT_STATUSTYPE_ocsp);
24042379 info->Set (context, env->ocsp_request_string (),
24052380 Boolean::New (env->isolate (), ocsp)).FromJust ();
24062381
0 commit comments