aboutsummaryrefslogtreecommitdiffstats
path: root/test/ssl_test.c
diff options
context:
space:
mode:
authorEmilia Kasper <emilia@openssl.org>2016-06-13 17:46:12 +0200
committerEmilia Kasper <emilia@openssl.org>2016-06-13 18:31:33 +0200
commitb02929802c1fc47daf268ec208ee113dcce3ed32 (patch)
tree6bf4fae4fd03c5bffffe9b94167416b0b66302ca /test/ssl_test.c
parent25b9d11c002e5c71840c2a6733c5009d78f2c9db (diff)
downloadopenssl-b02929802c1fc47daf268ec208ee113dcce3ed32.tar.gz
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 <rsalz@openssl.org>
Diffstat (limited to 'test/ssl_test.c')
-rw-r--r--test/ssl_test.c11
1 files changed, 6 insertions, 5 deletions
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);