Repository navigation
Commonize TLS groups configuration between TLS, DTLS and QUIC #68004
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
pimterry
wants to merge
2
commits into
nodejs:main
Choose a base branch
from
pimterry:commonize-groups
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+368
−57
Draft
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| 'use strict'; | ||
|
|
||
| const { | ||
| StringPrototypeTrim, | ||
| } = primordials; | ||
|
|
||
| const { | ||
| codes: { | ||
| ERR_INVALID_ARG_VALUE, | ||
| }, | ||
| } = require('internal/errors'); | ||
|
|
||
| const { | ||
| validateString, | ||
| } = require('internal/validators'); | ||
|
|
||
| // The process-wide default for every (D)TLS and QUIC context. It can be | ||
| // changed at runtime, so is read when each context is created. | ||
| function getDefaultEcdhCurve() { | ||
| return require('tls').DEFAULT_ECDH_CURVE || 'auto'; | ||
| } | ||
|
|
||
| // The option's value, or the process-wide default when it is omitted. OpenSSL | ||
| // accepts an empty list, leaving no groups and so no key exchange; only | ||
| // node:tls, for compatibility, passes allowEmpty. | ||
| function resolveGroups(groups, name, allowEmpty = false) { | ||
| if (groups === undefined) { | ||
| groups = getDefaultEcdhCurve(); | ||
| name = 'tls.DEFAULT_ECDH_CURVE'; | ||
| } | ||
| validateString(groups, name); | ||
| if (!allowEmpty && StringPrototypeTrim(groups) === '') | ||
| throw new ERR_INVALID_ARG_VALUE(name, groups, 'must name at least one group'); | ||
| return groups; | ||
| } | ||
|
|
||
| module.exports = { | ||
| resolveGroups, | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| #include "crypto/crypto_tls_negotiation.h" | ||
|
|
||
| #include <cstring> | ||
|
|
||
| namespace node::crypto { | ||
|
|
||
| bool SetGroups(const ncrypto::SSLCtxPointer& ctx, const char* groups) { | ||
| if (strcmp(groups, "auto") == 0) return true; | ||
| return SSL_CTX_set1_groups_list(ctx.get(), groups) == 1; | ||
| } | ||
|
|
||
| } // namespace node::crypto |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| #ifndef SRC_CRYPTO_CRYPTO_TLS_NEGOTIATION_H_ | ||
| #define SRC_CRYPTO_CRYPTO_TLS_NEGOTIATION_H_ | ||
|
|
||
| #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS | ||
|
|
||
| #include "ncrypto.h" | ||
|
|
||
| namespace node::crypto { | ||
|
|
||
| // Set the supported key exchange groups. "auto" keeps OpenSSL's default list. | ||
| bool SetGroups(const ncrypto::SSLCtxPointer& ctx, const char* groups); | ||
|
|
||
| } // namespace node::crypto | ||
|
|
||
| #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS | ||
| #endif // SRC_CRYPTO_CRYPTO_TLS_NEGOTIATION_H_ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Plan here is a later breaking change to stop
node:tlsaccepting''as a valid value at all, so they're all consistent, but not today)