forked from wolfSSL/wolfssl
Add support for SSL_CTX_set0_chain
This commit is contained in:
21
tests/api.c
21
tests/api.c
@@ -4409,7 +4409,10 @@ static void test_wolfSSL_PKCS12(void)
|
||||
WOLFSSL_X509 *cert;
|
||||
WOLFSSL_X509 *x509;
|
||||
WOLFSSL_X509 *tmp;
|
||||
STACK_OF(WOLFSSL_X509) *ca;
|
||||
WOLFSSL_CTX *ctx;
|
||||
WOLFSSL *ssl;
|
||||
WOLF_STACK_OF(WOLFSSL_X509) *ca;
|
||||
WOLF_STACK_OF(WOLFSSL_X509) *tmp_ca = NULL;
|
||||
|
||||
printf(testingFmt, "wolfSSL_PKCS12()");
|
||||
|
||||
@@ -4450,6 +4453,22 @@ static void test_wolfSSL_PKCS12(void)
|
||||
AssertNotNull(cert);
|
||||
AssertNotNull(ca);
|
||||
|
||||
/* Check that SSL_CTX_set0_chain correctly sets the certChain buffer */
|
||||
#ifndef NO_WOLFSSL_CLIENT
|
||||
AssertNotNull(ctx = wolfSSL_CTX_new(wolfSSLv23_client_method()));
|
||||
#else
|
||||
AssertNotNull(ctx = wolfSSL_CTX_new(wolfSSLv23_server_method()));
|
||||
#endif
|
||||
AssertIntEQ(SSL_CTX_set0_chain(ctx, ca), 1);
|
||||
AssertIntEQ(wolfSSL_CTX_get_extra_chain_certs(ctx, &tmp_ca), 1);
|
||||
AssertNotNull(tmp_ca);
|
||||
/* First cert becomes the main certificate of the context */
|
||||
AssertIntEQ(sk_X509_num(tmp_ca), 1);
|
||||
/* Check that the main cert is also set */
|
||||
AssertNotNull(ssl = SSL_new(ctx));
|
||||
AssertNotNull(SSL_get_certificate(ssl));
|
||||
SSL_free(ssl);
|
||||
SSL_CTX_free(ctx);
|
||||
|
||||
/* should be 2 other certs on stack */
|
||||
tmp = sk_X509_pop(ca);
|
||||
|
Reference in New Issue
Block a user