@@ -28412,6 +28412,46 @@ 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+ X509_STORE *store = NULL;
28420+ WOLFSSL_CTX *ctx = NULL;
28421+ WOLFSSL_METHOD *method = NULL;
28422+ X509 *cert = NULL;
28423+ const char caCert[] = "./certs/ca-cert.pem";
28424+
28425+ /* Create a new X509_STORE */
28426+ ExpectNotNull(store = X509_STORE_new());
28427+
28428+ /* Load a certificate */
28429+ ExpectNotNull(cert = wolfSSL_X509_load_certificate_file(caCert,
28430+ SSL_FILETYPE_PEM));
28431+
28432+ /* Add the certificate to the store */
28433+ ExpectIntEQ(X509_STORE_add_cert(store, cert), SSL_SUCCESS);
28434+ ExpectNotNull(store->certs);
28435+
28436+ /* Create a new SSL_CTX */
28437+ ExpectNotNull(method = wolfSSLv23_server_method());
28438+ ExpectNotNull(ctx = wolfSSL_CTX_new(method));
28439+
28440+ /* Set the store in the SSL_CTX */
28441+ wolfSSL_CTX_set_cert_store(ctx, store);
28442+
28443+ /* Verify that the certs member of the store is null */
28444+ ExpectNull(store->certs);
28445+
28446+ /* Clean up */
28447+ wolfSSL_CTX_free(ctx);
28448+ X509_free(cert);
28449+
28450+ #endif
28451+ return EXPECT_RESULT();
28452+ }
28453+
28454+
2841528455static int test_wolfSSL_X509_STORE(void)
2841628456{
2841728457 EXPECT_DECLS;
@@ -67156,6 +67196,7 @@ TEST_CASE testCases[] = {
6715667196 TEST_DECL(test_wolfSSL_X509_VERIFY_PARAM_set1_ip),
6715767197 TEST_DECL(test_wolfSSL_X509_STORE_CTX_get0_store),
6715867198 TEST_DECL(test_wolfSSL_X509_STORE),
67199+ TEST_DECL(test_wolfSSL_CTX_set_cert_store_null_certs),
6715967200 TEST_DECL(test_wolfSSL_X509_STORE_load_locations),
6716067201 TEST_DECL(test_X509_STORE_get0_objects),
6716167202 TEST_DECL(test_wolfSSL_X509_load_crl_file),
0 commit comments