From 9f8c6e329b0422b9e32104daa996ea7c6fa25687 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Thu, 9 Mar 2023 12:33:59 +0000 Subject: [PATCH] crypto: remove ALPN_ENABLED This constant was likely introduced for feature detection, but it has been pointless for a long time. 1. I am not aware of any possible Node.js build configuration (on any recent/supported release line) that would have crypto.constants but not crypto.constants.ALPN_ENABLED. 2. There is no evidence of this constant being used for feature detection in the ecosystem. In fact, both internal and external type definitions for crypto.constants simply assume that the constant exists. 3. There is no good reason for any modern TLS stack to not support ALPN. It looks like ALPN might have been optional in much earlier versions of OpenSSL, but all recent versions of OpenSSL unconditionally support ALPN as far as I can tell. Refs: https://github.com/nodejs/node/pull/46956 --- doc/api/crypto.md | 4 ---- src/node_constants.cc | 3 --- typings/internalBinding/constants.d.ts | 1 - 3 files changed, 8 deletions(-) diff --git a/doc/api/crypto.md b/doc/api/crypto.md index 768d7e9725b58d..41f135fcbeef72 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -5980,10 +5980,6 @@ See the [list of SSL OP Flags][] for details. DH_NOT_SUITABLE_GENERATOR - - ALPN_ENABLED - - RSA_PKCS1_PADDING diff --git a/src/node_constants.cc b/src/node_constants.cc index 34496673a97072..6af450c281dd36 100644 --- a/src/node_constants.cc +++ b/src/node_constants.cc @@ -1032,9 +1032,6 @@ void DefineCryptoConstants(Local target) { NODE_DEFINE_CONSTANT(target, DH_NOT_SUITABLE_GENERATOR); #endif -#define ALPN_ENABLED 1 - NODE_DEFINE_CONSTANT(target, ALPN_ENABLED); - #ifdef RSA_PKCS1_PADDING NODE_DEFINE_CONSTANT(target, RSA_PKCS1_PADDING); #endif diff --git a/typings/internalBinding/constants.d.ts b/typings/internalBinding/constants.d.ts index 8baaebbfef8ea0..0b0fc90e264334 100644 --- a/typings/internalBinding/constants.d.ts +++ b/typings/internalBinding/constants.d.ts @@ -243,7 +243,6 @@ declare function InternalBinding(binding: 'constants'): { DH_CHECK_P_NOT_PRIME: 1; DH_UNABLE_TO_CHECK_GENERATOR: 4; DH_NOT_SUITABLE_GENERATOR: 8; - ALPN_ENABLED: 1; RSA_PKCS1_PADDING: 1; RSA_SSLV23_PADDING: 2; RSA_NO_PADDING: 3;