summaryrefslogtreecommitdiffstats
path: root/test/ssl_test_ctx.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2017-03-15 16:07:07 +0000
committerDr. Stephen Henson <steve@openssl.org>2017-03-16 18:07:19 +0000
commit2e21539b2b57df9926d165243efb60480f546ba7 (patch)
tree83a2e1fab84479ce9020147b72f70e70cec3ca63 /test/ssl_test_ctx.c
parentf8f16d8ea48fd331d384dad3027a925e7dc90f0b (diff)
Add ExpectedClientCANames
Add ExpectedClientCANames: for client auth this checks to see if the list of certificate authorities supplied by the server matches the expected value. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2969)
Diffstat (limited to 'test/ssl_test_ctx.c')
-rw-r--r--test/ssl_test_ctx.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ssl_test_ctx.c b/test/ssl_test_ctx.c
index 3e3be9e058..7189777b78 100644
--- a/test/ssl_test_ctx.c
+++ b/test/ssl_test_ctx.c
@@ -535,6 +535,22 @@ __owur static int parse_expected_client_sign_hash(SSL_TEST_CTX *test_ctx,
value);
}
+__owur static int parse_expected_ca_names(STACK_OF(X509_NAME) **pnames,
+ const char *value)
+{
+ if (value == NULL)
+ return 0;
+ if (!strcmp(value, "empty"))
+ *pnames = sk_X509_NAME_new_null();
+ else
+ *pnames = SSL_load_client_CA_file(value);
+ return *pnames != NULL;
+}
+__owur static int parse_expected_client_ca_names(SSL_TEST_CTX *test_ctx,
+ const char *value)
+{
+ return parse_expected_ca_names(&test_ctx->expected_client_ca_names, value);
+}
/* Known test options and their corresponding parse methods. */
@@ -567,6 +583,7 @@ static const ssl_test_ctx_option ssl_test_ctx_options[] = {
{ "ExpectedClientCertType", &parse_expected_client_cert_type },
{ "ExpectedClientSignHash", &parse_expected_client_sign_hash },
{ "ExpectedClientSignType", &parse_expected_client_sign_type },
+ { "ExpectedClientCANames", &parse_expected_client_ca_names },
};
/* Nested client options. */
@@ -644,6 +661,7 @@ void SSL_TEST_CTX_free(SSL_TEST_CTX *ctx)
ssl_test_ctx_free_extra_data(ctx);
OPENSSL_free(ctx->expected_npn_protocol);
OPENSSL_free(ctx->expected_alpn_protocol);
+ sk_X509_NAME_pop_free(ctx->expected_client_ca_names, X509_NAME_free);
OPENSSL_free(ctx);
}