• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // This simulates specifying the configuration option --openssl-system-ca-path
2 // and setting it to a file that does not exist.
3 #define NODE_OPENSSL_SYSTEM_CERT_PATH "/missing/ca.pem"
4 
5 #include "crypto/crypto_context.h"
6 #include "node_options.h"
7 #include "openssl/err.h"
8 #include "gtest/gtest.h"
9 
10 /*
11  * This test verifies that a call to NewRootCertDir with the build time
12  * configuration option --openssl-system-ca-path set to an missing file, will
13  * not leave any OpenSSL errors on the OpenSSL error stack.
14  * See https://github.com/nodejs/node/issues/35456 for details.
15  */
TEST(NodeCrypto,NewRootCertStore)16 TEST(NodeCrypto, NewRootCertStore) {
17   node::per_process::cli_options->ssl_openssl_cert_store = true;
18   X509_STORE* store = node::crypto::NewRootCertStore();
19   ASSERT_TRUE(store);
20   ASSERT_EQ(ERR_peek_error(), 0UL) << "NewRootCertStore should not have left "
21                                       "any errors on the OpenSSL error stack\n";
22   X509_STORE_free(store);
23 }
24