diff options
author | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2021-12-18 16:15:49 +0100 |
---|---|---|
committer | Dr. David von Oheimb <dev@ddvo.net> | 2021-12-21 12:11:49 +0100 |
commit | 79b2a2f2eedb9d6b24a3f6748332328cf54568fb (patch) | |
tree | 31d61a9636cccc6a378871407b11fc1fc89aa8c6 /test | |
parent | 0d4c52320d245be80bd69346fdda4b12b4961eae (diff) |
add OSSL_STACK_OF_X509_free() for commonly used pattern
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17307)
Diffstat (limited to 'test')
-rw-r--r-- | test/cmp_client_test.c | 2 | ||||
-rw-r--r-- | test/cmp_ctx_test.c | 2 | ||||
-rw-r--r-- | test/cmp_protect_test.c | 6 | ||||
-rw-r--r-- | test/crltest.c | 2 | ||||
-rw-r--r-- | test/danetest.c | 4 | ||||
-rw-r--r-- | test/sslapitest.c | 2 | ||||
-rw-r--r-- | test/testutil/load.c | 2 | ||||
-rw-r--r-- | test/verify_extra_test.c | 2 |
8 files changed, 11 insertions, 11 deletions
diff --git a/test/cmp_client_test.c b/test/cmp_client_test.c index f4f664a49e..70543b3b01 100644 --- a/test/cmp_client_test.c +++ b/test/cmp_client_test.c @@ -116,7 +116,7 @@ static int execute_exec_certrequest_ses_test(CMP_SES_TEST_FIXTURE *fixture) STACK_OF(X509) *caPubs = OSSL_CMP_CTX_get1_caPubs(fixture->cmp_ctx); int ret = TEST_int_eq(STACK_OF_X509_cmp(fixture->caPubs, caPubs), 0); - sk_X509_pop_free(caPubs, X509_free); + OSSL_STACK_OF_X509_free(caPubs); return ret; } return 1; diff --git a/test/cmp_ctx_test.c b/test/cmp_ctx_test.c index 71fa679ff4..1e0d6db538 100644 --- a/test/cmp_ctx_test.c +++ b/test/cmp_ctx_test.c @@ -59,7 +59,7 @@ static STACK_OF(X509) *sk_X509_new_1(void) static void sk_X509_pop_X509_free(STACK_OF(X509) *sk) { - sk_X509_pop_free(sk, X509_free); + OSSL_STACK_OF_X509_free(sk); } static int execute_CTX_reinit_test(OSSL_CMP_CTX_TEST_FIXTURE *fixture) diff --git a/test/cmp_protect_test.c b/test/cmp_protect_test.c index 9111b89423..a24acace2c 100644 --- a/test/cmp_protect_test.c +++ b/test/cmp_protect_test.c @@ -340,7 +340,7 @@ static int execute_cmp_build_cert_chain_test(CMP_PROTECT_TEST_FIXTURE *fixture) if (TEST_ptr(chain)) { /* Check whether chain built is equal to the expected one */ ret = TEST_int_eq(0, STACK_OF_X509_cmp(chain, fixture->chain)); - sk_X509_pop_free(chain, X509_free); + OSSL_STACK_OF_X509_free(chain); } if (!ret) return 0; @@ -355,7 +355,7 @@ static int execute_cmp_build_cert_chain_test(CMP_PROTECT_TEST_FIXTURE *fixture) if (ret && chain != NULL) { /* Check whether chain built is equal to the expected one */ ret = TEST_int_eq(0, STACK_OF_X509_cmp(chain, fixture->chain)); - sk_X509_pop_free(chain, X509_free); + OSSL_STACK_OF_X509_free(chain); } } X509_STORE_free(store); @@ -475,7 +475,7 @@ static int execute_X509_STORE_test(CMP_PROTECT_TEST_FIXTURE *fixture) res = 1; err: X509_STORE_free(store); - sk_X509_pop_free(sk, X509_free); + OSSL_STACK_OF_X509_free(sk); return res; } diff --git a/test/crltest.c b/test/crltest.c index 5d255d368a..3b76f4f0ae 100644 --- a/test/crltest.c +++ b/test/crltest.c @@ -264,7 +264,7 @@ static int verify(X509 *leaf, X509 *root, STACK_OF(X509_CRL) *crls, status = X509_verify_cert(ctx) == 1 ? X509_V_OK : X509_STORE_CTX_get_error(ctx); err: - sk_X509_pop_free(roots, X509_free); + OSSL_STACK_OF_X509_free(roots); sk_X509_CRL_pop_free(crls, X509_CRL_free); X509_VERIFY_PARAM_free(param); X509_STORE_CTX_free(ctx); diff --git a/test/danetest.c b/test/danetest.c index 0ed460039d..d7ef87b6d2 100644 --- a/test/danetest.c +++ b/test/danetest.c @@ -143,7 +143,7 @@ err: OPENSSL_free(name); OPENSSL_free(header); OPENSSL_free(data); - sk_X509_pop_free(chain, X509_free); + OSSL_STACK_OF_X509_free(chain); return NULL; } @@ -344,7 +344,7 @@ static int test_tlsafile(SSL_CTX *ctx, const char *base_name, } ok = verify_chain(ssl, chain); - sk_X509_pop_free(chain, X509_free); + OSSL_STACK_OF_X509_free(chain); err = SSL_get_verify_result(ssl); /* * Peek under the hood, normally TLSA match data is hidden when diff --git a/test/sslapitest.c b/test/sslapitest.c index 29c125004a..6e0da6299a 100644 --- a/test/sslapitest.c +++ b/test/sslapitest.c @@ -8038,7 +8038,7 @@ static int cert_cb(SSL *s, void *arg) EVP_PKEY_free(pkey); X509_free(x509); X509_free(rootx); - sk_X509_pop_free(chain, X509_free); + OSSL_STACK_OF_X509_free(chain); return ret; } diff --git a/test/testutil/load.c b/test/testutil/load.c index d776a7f167..982e0a39a9 100644 --- a/test/testutil/load.c +++ b/test/testutil/load.c @@ -49,7 +49,7 @@ STACK_OF(X509) *load_certs_pem(const char *file) do { x = PEM_read_bio_X509(bio, NULL, 0, NULL); if (x != NULL && !sk_X509_push(certs, x)) { - sk_X509_pop_free(certs, X509_free); + OSSL_STACK_OF_X509_free(certs); BIO_free(bio); return NULL; } else if (x == NULL) { diff --git a/test/verify_extra_test.c b/test/verify_extra_test.c index 6ab779671f..d03dc0c71d 100644 --- a/test/verify_extra_test.c +++ b/test/verify_extra_test.c @@ -94,7 +94,7 @@ static int test_alt_chains_cert_forgery(void) err: X509_STORE_CTX_free(sctx); X509_free(x); - sk_X509_pop_free(untrusted, X509_free); + OSSL_STACK_OF_X509_free(untrusted); X509_STORE_free(store); return ret; } |