From b02929802c1fc47daf268ec208ee113dcce3ed32 Mon Sep 17 00:00:00 2001 From: Emilia Kasper Date: Mon, 13 Jun 2016 17:46:12 +0200 Subject: SSL test: only write out server2 when testing SNI The SNI tests introduced a redundant "server2" section into every test configuration. Copy this automatically from "server" unless testing SNI, to reduce noise in the generated confs. Also remove duplicate SSL_TEST_CTX_create (merge conflict error). Reviewed-by: Rich Salz --- test/ssl_test.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'test/ssl_test.c') diff --git a/test/ssl_test.c b/test/ssl_test.c index 176f6a19ae..537d4b0e5a 100644 --- a/test/ssl_test.c +++ b/test/ssl_test.c @@ -176,11 +176,16 @@ static int execute_test(SSL_TEST_FIXTURE fixture) SSL_CTX *server_ctx = NULL, *server2_ctx = NULL, *client_ctx = NULL; SSL_TEST_CTX *test_ctx = NULL; HANDSHAKE_RESULT result; + const char *server2; test_ctx = SSL_TEST_CTX_create(conf, fixture.test_app); if (test_ctx == NULL) goto err; + /* Use ServerName to detect if we're testing SNI. */ + server2 = (test_ctx->servername != SSL_TEST_SERVERNAME_NONE) ? "server2" + : "server"; + #ifndef OPENSSL_NO_DTLS if (test_ctx->method == SSL_TEST_METHOD_DTLS) { server_ctx = SSL_CTX_new(DTLS_server_method()); @@ -200,15 +205,11 @@ static int execute_test(SSL_TEST_FIXTURE fixture) OPENSSL_assert(CONF_modules_load(conf, fixture.test_app, 0) > 0); if (!SSL_CTX_config(server_ctx, "server") - || !SSL_CTX_config(server2_ctx, "server2") + || !SSL_CTX_config(server2_ctx, server2) || !SSL_CTX_config(client_ctx, "client")) { goto err; } - test_ctx = SSL_TEST_CTX_create(conf, fixture.test_app); - if (test_ctx == NULL) - goto err; - result = do_handshake(server_ctx, server2_ctx, client_ctx, test_ctx); ret = check_test(result, test_ctx); -- cgit v1.2.3