From 87a7defe55ba14ba36eef03d1e4d6f26688b8c30 Mon Sep 17 00:00:00 2001 From: Harshil Jain Date: Mon, 10 Oct 2022 10:51:21 +0530 Subject: [PATCH] crypto: fix ci failure --- doc/api/cli.md | 1 + src/crypto/crypto_context.cc | 4 +++- test/parallel/test-cli-node-options.js | 3 +++ test/parallel/test-cli-node-print-help.js | 3 ++- .../parallel/test-process-env-allowed-flags-are-documented.js | 1 + 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/doc/api/cli.md b/doc/api/cli.md index 484e3250b78f4e..d90abc4e5ad47d 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -1839,6 +1839,7 @@ Node.js options that are allowed are: * `--no-global-search-paths` * `--no-warnings` * `--node-memory-debug` +* `--node-use-system-ca` * `--openssl-config` * `--openssl-legacy-provider` * `--openssl-shared-config` diff --git a/src/crypto/crypto_context.cc b/src/crypto/crypto_context.cc index 1a928497e68bb5..5d428fc35fe49f 100644 --- a/src/crypto/crypto_context.cc +++ b/src/crypto/crypto_context.cc @@ -199,8 +199,9 @@ int SSL_CTX_use_certificate_chain(SSL_CTX* ctx, void ReadSystemStoreCertificates( std::vector* system_root_certificates) { +#ifdef _WIN32 const HCERTSTORE hStore = CertOpenSystemStoreW(0, L"ROOT"); - CHECK_NE(hStore, NULLPTR); + CHECK_NE(hStore, nullptr); auto cleanup = OnScopeLeave([hStore]() { CHECK_EQ(CertCloseStore(hStore, 0), TRUE); }); @@ -254,6 +255,7 @@ void ReadSystemStoreCertificates( system_root_certificates->emplace_back(std::move(base64_string_output)); } +#endif } X509_STORE* NewRootCertStore() { diff --git a/test/parallel/test-cli-node-options.js b/test/parallel/test-cli-node-options.js index 2d34a56e03c1a0..ddecbd2fc6514d 100644 --- a/test/parallel/test-cli-node-options.js +++ b/test/parallel/test-cli-node-options.js @@ -64,6 +64,9 @@ if (common.hasCrypto) { expectNoWorker('--use-bundled-ca', 'B\n'); if (!common.hasOpenSSL3) expectNoWorker('--openssl-config=_ossl_cfg', 'B\n'); + if (common.isWindows) { + expectNoWorker('--node-use-system-ca', 'B\n'); + } } // V8 options diff --git a/test/parallel/test-cli-node-print-help.js b/test/parallel/test-cli-node-print-help.js index 7e7c77f53e9657..3f45a9bd05864a 100644 --- a/test/parallel/test-cli-node-print-help.js +++ b/test/parallel/test-cli-node-print-help.js @@ -27,7 +27,8 @@ function validateNodePrintHelp() { { compileConstant: HAVE_OPENSSL, flags: [ '--openssl-config=...', '--tls-cipher-list=...', '--use-bundled-ca', '--use-openssl-ca', - '--enable-fips', '--force-fips' ] }, + '--enable-fips', '--force-fips', + common.isWindows ? '--node-use-system-ca' : '' ] }, { compileConstant: NODE_HAVE_I18N_SUPPORT, flags: [ '--icu-data-dir=...', 'NODE_ICU_DATA' ] }, { compileConstant: HAVE_INSPECTOR, diff --git a/test/parallel/test-process-env-allowed-flags-are-documented.js b/test/parallel/test-process-env-allowed-flags-are-documented.js index dc4c704b6f0b88..7d290a8f181b73 100644 --- a/test/parallel/test-process-env-allowed-flags-are-documented.js +++ b/test/parallel/test-process-env-allowed-flags-are-documented.js @@ -59,6 +59,7 @@ const conditionalOpts = [ common.hasOpenSSL3 ? '--openssl-shared-config' : '', '--tls-cipher-list', '--use-bundled-ca', + common.isWindows ? '--node-use-system-ca' : '', '--use-openssl-ca', '--secure-heap', '--secure-heap-min',