From 7b8fcf834b495d8722869cc989431d0d8bd24039 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Wed, 24 May 2017 14:37:29 +0200 Subject: [PATCH] crypto: remove root_cert_store from node_crypto.h root_cert_store is defined as extern in node_crypto.h but only used in node_crypto.cc. It is then set using SSL_CTX_set_cert_store. The only usages of SSL_CTX_get_cert_store are in node_crypto.cc which would all be accessing the same X509_STORE through the root_cert_store pointer as far as I can tell. Am I missing something here? This commit suggests removing it from the header and making it static in node_crypto.cc. PR-URL: https://github.com/nodejs/node/pull/13194 Reviewed-By: Colin Ihrig Reviewed-By: Ben Noordhuis Reviewed-By: Michael Dawson Reviewed-By: James M Snell Reviewed-By: Sam Roberts --- src/node_crypto.cc | 6 +++--- src/node_crypto.h | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 7eb18ad2020a32..aa2dafebc5cf81 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -120,13 +120,13 @@ static X509_NAME *cnnic_ev_name = static Mutex* mutexes; -const char* const root_certs[] = { +static const char* const root_certs[] = { #include "node_root_certs.h" // NOLINT(build/include_order) }; -std::string extra_root_certs_file; // NOLINT(runtime/string) +static std::string extra_root_certs_file; // NOLINT(runtime/string) -X509_STORE* root_cert_store; +static X509_STORE* root_cert_store; // Just to generate static methods template class SSLWrap; diff --git a/src/node_crypto.h b/src/node_crypto.h index 38f49ba5a05063..746c954b26fb43 100644 --- a/src/node_crypto.h +++ b/src/node_crypto.h @@ -63,8 +63,6 @@ enum CheckResult { extern int VerifyCallback(int preverify_ok, X509_STORE_CTX* ctx); -extern X509_STORE* root_cert_store; - extern void UseExtraCaCerts(const std::string& file); // Forward declaration