Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 19a7b1e

Browse filesBrowse files
joyeecheungaduh95
authored andcommitted
tls: load bundled and extra certificates off-thread
This patch makes the certificate pre-loading thread load the bundled and extra certificates from the other thread as well. PR-URL: #59856 Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 095e7a8 commit 19a7b1e
Copy full SHA for 19a7b1e

File tree

Expand file treeCollapse file tree

1 file changed

+21
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+21
-1
lines changed
Open diff view settings
Collapse file

‎src/crypto/crypto_context.cc‎

Copy file name to clipboardExpand all lines: src/crypto/crypto_context.cc
+21-1Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -836,6 +836,23 @@ static std::vector<X509*>& GetExtraCACertificates() {
836836
}
837837

838838
static void LoadCACertificates(void* data) {
839+
per_process::Debug(DebugCategory::CRYPTO,
840+
"Started loading bundled root certificates off-thread\n");
841+
GetBundledRootCertificates();
842+
843+
if (!extra_root_certs_file.empty()) {
844+
per_process::Debug(DebugCategory::CRYPTO,
845+
"Started loading extra root certificates off-thread\n");
846+
GetExtraCACertificates();
847+
}
848+
849+
{
850+
Mutex::ScopedLock cli_lock(node::per_process::cli_options_mutex);
851+
if (!per_process::cli_options->use_system_ca) {
852+
return;
853+
}
854+
}
855+
839856
per_process::Debug(DebugCategory::CRYPTO,
840857
"Started loading system root certificates off-thread\n");
841858
GetSystemStoreCACertificates();
@@ -854,9 +871,12 @@ void StartLoadingCertificatesOffThread(
854871
// Get*CACertificates() functions has a function-local static and any
855872
// actual user of it will wait for that to complete initialization.
856873

874+
// --use-openssl-ca is mutually exclusive with --use-bundled-ca and
875+
// --use-system-ca. If it's set, no need to optimize with off-thread
876+
// loading.
857877
{
858878
Mutex::ScopedLock cli_lock(node::per_process::cli_options_mutex);
859-
if (!per_process::cli_options->use_system_ca) {
879+
if (!per_process::cli_options->ssl_openssl_cert_store) {
860880
return;
861881
}
862882
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.