@@ -28382,6 +28382,46 @@ static int test_wolfSSL_CTX_set_srp_password(void)
2838228382 return EXPECT_RESULT();
2838328383}
2838428384
28385+ static int test_wolfSSL_CTX_set_cert_store_null_certs(void)
28386+ {
28387+ EXPECT_DECLS;
28388+ #if defined(OPENSSL_EXTRA) && !defined(NO_RSA) && !defined(NO_TLS)
28389+ X509_STORE *store = NULL;
28390+ WOLFSSL_CTX *ctx = NULL;
28391+ WOLFSSL_METHOD *method = NULL;
28392+ X509 *cert = NULL;
28393+ const char caCert[] = "./certs/ca-cert.pem";
28394+
28395+ /* Create a new X509_STORE */
28396+ ExpectNotNull(store = X509_STORE_new());
28397+
28398+ /* Load a certificate */
28399+ ExpectNotNull(cert = wolfSSL_X509_load_certificate_file(caCert,
28400+ SSL_FILETYPE_PEM));
28401+
28402+ /* Add the certificate to the store */
28403+ ExpectIntEQ(X509_STORE_add_cert(store, cert), SSL_SUCCESS);
28404+ ExpectNotNull(store->certs);
28405+
28406+ /* Create a new SSL_CTX */
28407+ ExpectNotNull(method = wolfSSLv23_server_method());
28408+ ExpectNotNull(ctx = wolfSSL_CTX_new(method));
28409+
28410+ /* Set the store in the SSL_CTX */
28411+ wolfSSL_CTX_set_cert_store(ctx, store);
28412+
28413+ /* Verify that the certs member of the store is null */
28414+ ExpectNull(store->certs);
28415+
28416+ /* Clean up */
28417+ wolfSSL_CTX_free(ctx);
28418+ X509_free(cert);
28419+
28420+ #endif
28421+ return EXPECT_RESULT();
28422+ }
28423+
28424+
2838528425static int test_wolfSSL_X509_STORE(void)
2838628426{
2838728427 EXPECT_DECLS;
@@ -67086,6 +67126,7 @@ TEST_CASE testCases[] = {
6708667126 TEST_DECL(test_wolfSSL_X509_VERIFY_PARAM_set1_ip),
6708767127 TEST_DECL(test_wolfSSL_X509_STORE_CTX_get0_store),
6708867128 TEST_DECL(test_wolfSSL_X509_STORE),
67129+ TEST_DECL(test_wolfSSL_CTX_set_cert_store_null_certs),
6708967130 TEST_DECL(test_wolfSSL_X509_STORE_load_locations),
6709067131 TEST_DECL(test_X509_STORE_get0_objects),
6709167132 TEST_DECL(test_wolfSSL_X509_load_crl_file),
0 commit comments