Skip to content

Commit

Permalink
crypto: remove ALPN_ENABLED
Browse files Browse the repository at this point in the history
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: #46956
PR-URL: #47028
Reviewed-By: Filip Skokan <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
  • Loading branch information
tniessen authored Mar 13, 2023
1 parent 1ef4faa commit c2e4b1f
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 8 deletions.
4 changes: 0 additions & 4 deletions doc/api/crypto.md
Original file line number Diff line number Diff line change
Expand Up @@ -5980,10 +5980,6 @@ See the [list of SSL OP Flags][] for details.
<td><code>DH_NOT_SUITABLE_GENERATOR</code></td>
<td></td>
</tr>
<tr>
<td><code>ALPN_ENABLED</code></td>
<td></td>
</tr>
<tr>
<td><code>RSA_PKCS1_PADDING</code></td>
<td></td>
Expand Down
3 changes: 0 additions & 3 deletions src/node_constants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1032,9 +1032,6 @@ void DefineCryptoConstants(Local<Object> 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
Expand Down
1 change: 0 additions & 1 deletion typings/internalBinding/constants.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c2e4b1f

Please sign in to comment.