Skip to content

Commit be98f26

Browse files
danbevjasnell
authored andcommitted
src: exclude node_root_certs when use-def-ca-store
When configuring node with --openssl-use-def-ca-store the root certs from OpenSSL should be used and not the ones in src/node_root_certs.h. I noticed that src/node_root_certs.h is still included even when using --openssl-use-def-ca-store. This commit adds check and does not include node_root_certs.h if --openssl-use-def-ca-store is specified. PR-URL: #11939 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent f35e80d commit be98f26

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/node_crypto.cc

+4
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,11 @@ static X509_NAME *cnnic_ev_name =
141141

142142
static Mutex* mutexes;
143143

144+
#if !defined(NODE_OPENSSL_CERT_STORE)
144145
const char* const root_certs[] = {
145146
#include "node_root_certs.h" // NOLINT(build/include_order)
146147
};
148+
#endif
147149

148150
std::string extra_root_certs_file; // NOLINT(runtime/string)
149151

@@ -718,6 +720,7 @@ static int X509_up_ref(X509* cert) {
718720

719721

720722
static X509_STORE* NewRootCertStore() {
723+
#if !defined(NODE_OPENSSL_CERT_STORE)
721724
if (root_certs_vector.empty()) {
722725
for (size_t i = 0; i < arraysize(root_certs); i++) {
723726
BIO* bp = NodeBIO::NewFixed(root_certs[i], strlen(root_certs[i]));
@@ -730,6 +733,7 @@ static X509_STORE* NewRootCertStore() {
730733
root_certs_vector.push_back(x509);
731734
}
732735
}
736+
#endif
733737

734738
X509_STORE* store = X509_STORE_new();
735739
if (ssl_openssl_cert_store) {

0 commit comments

Comments
 (0)