summaryrefslogtreecommitdiffstats
path: root/test/ssl_test_ctx_test.c
diff options
context:
space:
mode:
authorEmilia Kasper <emilia@openssl.org>2016-07-05 19:06:23 +0200
committerEmilia Kasper <emilia@openssl.org>2016-07-20 13:55:53 +0200
commit590ed3d7ea555b877859f6b491020112588fe1be (patch)
tree0461027d23e45e0e29fdaed81e92fbe4b324c065 /test/ssl_test_ctx_test.c
parent23dd0c9f8dc6f7edf4b872d13e5644dfbbee585b (diff)
SSL test framework: port resumption tests
Systematically test every server-side version downgrade or upgrade. Client version upgrade or downgrade could be tested analogously but will be done in a later change. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
Diffstat (limited to 'test/ssl_test_ctx_test.c')
-rw-r--r--test/ssl_test_ctx_test.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/test/ssl_test_ctx_test.c b/test/ssl_test_ctx_test.c
index b3e2e705a3..6366e0ad59 100644
--- a/test/ssl_test_ctx_test.c
+++ b/test/ssl_test_ctx_test.c
@@ -92,7 +92,12 @@ static int SSL_TEST_CTX_equal(SSL_TEST_CTX *ctx, SSL_TEST_CTX *ctx2)
if (!strings_equal("ClientNPNProtocols", ctx->client_npn_protocols,
ctx2->client_npn_protocols))
return 0;
-
+ if (ctx->method != ctx2->method) {
+ fprintf(stderr, "Method mismatch: %s vs %s.\n",
+ ssl_test_method_name(ctx->method),
+ ssl_test_method_name(ctx2->method));
+ return 0;
+ }
if (!strings_equal("ServerNPNProtocols", ctx->server_npn_protocols,
ctx2->server_npn_protocols))
return 0;
@@ -115,6 +120,17 @@ static int SSL_TEST_CTX_equal(SSL_TEST_CTX *ctx, SSL_TEST_CTX *ctx2)
if (!strings_equal("ExpectedALPNProtocol", ctx->expected_alpn_protocol,
ctx2->expected_alpn_protocol))
return 0;
+ if (ctx->handshake_mode != ctx2->handshake_mode) {
+ fprintf(stderr, "HandshakeMode mismatch: %s vs %s.\n",
+ ssl_handshake_mode_name(ctx->handshake_mode),
+ ssl_handshake_mode_name(ctx2->handshake_mode));
+ return 0;
+ }
+ if (ctx->resumption_expected != ctx2->resumption_expected) {
+ fprintf(stderr, "ResumptionExpected mismatch: %d vs %d.\n",
+ ctx->resumption_expected, ctx2->resumption_expected);
+ return 0;
+ }
return 1;
}
@@ -202,6 +218,8 @@ static int test_good_configuration()
fixture.expected_ctx->server2_alpn_protocols = OPENSSL_strdup("baz");
OPENSSL_assert(fixture.expected_ctx->client_npn_protocols != NULL);
OPENSSL_assert(fixture.expected_ctx->server2_alpn_protocols != NULL);
+ fixture.expected_ctx->handshake_mode = SSL_TEST_HANDSHAKE_RESUME;
+ fixture.expected_ctx->resumption_expected = 1;
EXECUTE_SSL_TEST_CTX_TEST();
}
@@ -215,6 +233,8 @@ static const char *bad_configurations[] = {
"ssltest_unknown_servername_callback",
"ssltest_unknown_session_ticket_expected",
"ssltest_unknown_method",
+ "ssltest_unknown_handshake_mode",
+ "ssltest_unknown_resumption_expected",
};
static int test_bad_configuration(int idx)