From 0ce6cbd4c495837e56fc35893d4d30352d0f16fd Mon Sep 17 00:00:00 2001 From: David Garske Date: Thu, 12 Jul 2018 13:22:21 -0700 Subject: [PATCH] Added API unit test for `wolfSSL_CTX_use_certificate_chain_file_format`. --- tests/api.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/api.c b/tests/api.c index 845a6be07..a0e354316 100644 --- a/tests/api.c +++ b/tests/api.c @@ -721,6 +721,25 @@ static void test_wolfSSL_CTX_load_verify_locations(void) #endif } + +static int test_wolfSSL_CTX_use_certificate_chain_file_format(void) +{ + int ret = 0; +#if !defined(NO_FILESYSTEM) && !defined(NO_CERTS) + const char* server_chain_der = "./certs/server-cert-chain.der"; + WOLFSSL_CTX* ctx; + + ctx = wolfSSL_CTX_new(wolfTLSv1_2_client_method()); + AssertNotNull(ctx); + + AssertIntEQ(wolfSSL_CTX_use_certificate_chain_file_format(ctx, + server_chain_der, WOLFSSL_FILETYPE_ASN1), WOLFSSL_SUCCESS); + + wolfSSL_CTX_free(ctx); +#endif + return ret; +} + static void test_wolfSSL_CTX_SetTmpDH_file(void) { #if !defined(NO_FILESYSTEM) && !defined(NO_CERTS) && !defined(NO_DH) && \ @@ -19894,6 +19913,7 @@ void ApiTest(void) AssertIntEQ(test_wolfSSL_CTX_use_certificate_buffer(), WOLFSSL_SUCCESS); test_wolfSSL_CTX_use_PrivateKey_file(); test_wolfSSL_CTX_load_verify_locations(); + test_wolfSSL_CTX_use_certificate_chain_file_format(); test_wolfSSL_CTX_trust_peer_cert(); test_wolfSSL_CTX_SetTmpDH_file(); test_wolfSSL_CTX_SetTmpDH_buffer();