Merge pull request #2179 from kojo1/X509_STORE_CTX

X509_STORE_CTX_free compatibility
This commit is contained in:
JacobBarthelmeh
2019-03-27 17:17:26 -06:00
committed by GitHub
2 changed files with 11 additions and 2 deletions

View File

@@ -19080,8 +19080,6 @@ void wolfSSL_X509_STORE_CTX_free(WOLFSSL_X509_STORE_CTX* ctx)
if (ctx->current_cert != NULL)
wolfSSL_FreeX509(ctx->current_cert);
#endif
if (ctx->chain != NULL)
wolfSSL_sk_X509_free(ctx->chain);
#ifdef OPENSSL_EXTRA
if (ctx->param != NULL){
XFREE(ctx->param,NULL,DYNAMIC_TYPE_OPENSSL);

View File

@@ -18529,6 +18529,9 @@ static void test_wolfSSL_X509_STORE_CTX(void)
X509_STORE_CTX* ctx;
X509_STORE* str;
X509* x509;
#ifdef OPENSSL_ALL
STACK_OF(X509)* sk;
#endif
printf(testingFmt, "wolfSSL_X509_STORE_CTX()");
AssertNotNull(ctx = X509_STORE_CTX_new());
@@ -18536,12 +18539,20 @@ static void test_wolfSSL_X509_STORE_CTX(void)
AssertNotNull((x509 =
wolfSSL_X509_load_certificate_file(svrCertFile, SSL_FILETYPE_PEM)));
AssertIntEQ(X509_STORE_add_cert(str, x509), SSL_SUCCESS);
#ifdef OPENSSL_ALL
AssertNotNull(sk = sk_X509_new());
AssertIntEQ(X509_STORE_CTX_init(ctx, str, x509, sk), SSL_SUCCESS);
#else
AssertIntEQ(X509_STORE_CTX_init(ctx, str, x509, NULL), SSL_SUCCESS);
#endif
AssertIntEQ(SSL_get_ex_data_X509_STORE_CTX_idx(), 0);
X509_STORE_CTX_set_error(ctx, -5);
X509_STORE_CTX_set_error(NULL, -5);
X509_STORE_CTX_free(ctx);
#ifdef OPENSSL_ALL
sk_X509_free(sk);
#endif
#ifdef WOLFSSL_KEEP_STORE_CERTS
X509_STORE_free(str);
X509_free(x509);