-
Notifications
You must be signed in to change notification settings - Fork 30k
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
src: modify SecureContext::SetCACert to not create root certificate store #56301
Open
ShenHongFei
wants to merge
1
commit into
nodejs:main
Choose a base branch
from
ShenHongFei:fix-set-ca-cert
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.
+85
−3
Conversation
This file contains 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
Review requested:
|
nodejs-github-bot
added
c++
Issues and PRs that require attention from people who are familiar with C++.
crypto
Issues and PRs related to the crypto subsystem.
needs-ci
PRs that need a full CI run.
labels
Dec 18, 2024
ShenHongFei
force-pushed
the
fix-set-ca-cert
branch
2 times, most recently
from
December 18, 2024 08:00
13674e5
to
f61b98f
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #56301 +/- ##
=======================================
Coverage 88.54% 88.54%
=======================================
Files 657 657
Lines 190290 190323 +33
Branches 36533 36547 +14
=======================================
+ Hits 168488 168525 +37
+ Misses 14984 14981 -3
+ Partials 6818 6817 -1
|
meixg
added
the
performance
Issues and PRs related to the performance of Node.js.
label
Dec 18, 2024
ShenHongFei
force-pushed
the
fix-set-ca-cert
branch
4 times, most recently
from
December 18, 2024 18:15
db9d305
to
79172cf
Compare
node.exe D:/1/nodejs/benchmark/compare.js --old T:/node.v23.4.0.exe --new D:/1/nodejs/node.exe --runs 20 --filter create-secure-context tls
const common = require('../common.js');
const fixtures = require('../../test/common/fixtures');
const tls = require('tls');
const bench = common.createBenchmark(main, {
n: [1, 5],
ca: [0, 1],
});
function main(conf) {
const n = conf.n;
const options = {
key: fixtures.readKey('rsa_private.pem'),
cert: fixtures.readKey('rsa_cert.crt'),
ca: conf.ca === 1 ? [fixtures.readKey('rsa_ca.crt')] : undefined,
};
bench.start();
tls.createSecureContext(options);
bench.end(n);
} |
ShenHongFei
force-pushed
the
fix-set-ca-cert
branch
2 times, most recently
from
December 19, 2024 02:46
6b87eab
to
15e8061
Compare
addaleax
reviewed
Dec 19, 2024
ShenHongFei
force-pushed
the
fix-set-ca-cert
branch
from
December 19, 2024 18:28
15e8061
to
5efa9aa
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
c++
Issues and PRs that require attention from people who are familiar with C++.
crypto
Issues and PRs related to the crypto subsystem.
needs-ci
PRs that need a full CI run.
performance
Issues and PRs related to the performance of Node.js.
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.
This modification is mainly to optimize the startup performance of http2 and https servers (or may be tls clients's first connection?) When the user specifies a ca, it skips loading more than 100 root certificates built into node.js, and the startup speed is 15 ms faster.
In
SecureContext::SetCACert
funciton we cound get the existing cert store from the SSL context instead ofGetCertStoreOwnedByThisSecureContext()
(in which calls NewRootCertStore()) to avoid creating X509_STORE based on root_certs (more than 130), which is very slow.According to the documentation, when passing in the ca option, you do not add it to the node.js built-in root certificates but replace them, so you do not need to use the built-in root certificate to initialize the x509 store.
node/doc/api/tls.md
Lines 1984 to 2004 in 8253290
The slow loading of root certificates is a known issue of openssl3 (openssl/openssl#16871) and has not been fixed. @mhdawson
There are also related issues in node.js:
before optimization
after optimization
cc @nodejs/crypto @nodejs/tls
If anyone can help me benchmark it, I'd be very grateful.