@@ -28412,6 +28412,47 @@ static int test_wolfSSL_CTX_set_srp_password(void)
2841228412 return EXPECT_RESULT();
2841328413}
2841428414
28415+ static int test_wolfSSL_CTX_set_cert_store_null_certs(void)
28416+ {
28417+ EXPECT_DECLS;
28418+ #if defined(OPENSSL_EXTRA) && !defined(NO_RSA) && !defined(NO_TLS) && \
28419+ !defined(NO_WOLFSSL_SERVER)
28420+ X509_STORE *store = NULL;
28421+ WOLFSSL_CTX *ctx = NULL;
28422+ WOLFSSL_METHOD *method = NULL;
28423+ X509 *cert = NULL;
28424+ const char caCert[] = "./certs/ca-cert.pem";
28425+
28426+ /* Create a new X509_STORE */
28427+ ExpectNotNull(store = X509_STORE_new());
28428+
28429+ /* Load a certificate */
28430+ ExpectNotNull(cert = wolfSSL_X509_load_certificate_file(caCert,
28431+ SSL_FILETYPE_PEM));
28432+
28433+ /* Add the certificate to the store */
28434+ ExpectIntEQ(X509_STORE_add_cert(store, cert), SSL_SUCCESS);
28435+ ExpectNotNull(store->certs);
28436+
28437+ /* Create a new SSL_CTX */
28438+ ExpectNotNull(method = wolfSSLv23_server_method());
28439+ ExpectNotNull(ctx = wolfSSL_CTX_new(method));
28440+
28441+ /* Set the store in the SSL_CTX */
28442+ wolfSSL_CTX_set_cert_store(ctx, store);
28443+
28444+ /* Verify that the certs member of the store is null */
28445+ ExpectNull(store->certs);
28446+
28447+ /* Clean up */
28448+ wolfSSL_CTX_free(ctx);
28449+ X509_free(cert);
28450+
28451+ #endif
28452+ return EXPECT_RESULT();
28453+ }
28454+
28455+
2841528456static int test_wolfSSL_X509_STORE(void)
2841628457{
2841728458 EXPECT_DECLS;
@@ -67156,6 +67197,7 @@ TEST_CASE testCases[] = {
6715667197 TEST_DECL(test_wolfSSL_X509_VERIFY_PARAM_set1_ip),
6715767198 TEST_DECL(test_wolfSSL_X509_STORE_CTX_get0_store),
6715867199 TEST_DECL(test_wolfSSL_X509_STORE),
67200+ TEST_DECL(test_wolfSSL_CTX_set_cert_store_null_certs),
6715967201 TEST_DECL(test_wolfSSL_X509_STORE_load_locations),
6716067202 TEST_DECL(test_X509_STORE_get0_objects),
6716167203 TEST_DECL(test_wolfSSL_X509_load_crl_file),
0 commit comments