aboutsummaryrefslogtreecommitdiffstats
path: root/test/ssl_test.c
diff options
context:
space:
mode:
authorEmilia Kasper <emilia@openssl.org>2016-07-21 14:04:00 +0200
committerEmilia Kasper <emilia@openssl.org>2016-07-21 15:44:36 +0200
commit11279b13f586441a8fcc5109ee1907f33eb0cc24 (patch)
tree9dbd063fa7147e9854aeba640f9d7dff859b11bb /test/ssl_test.c
parent2980ae2e78169b3b4d0b140c0c5796c441c5902c (diff)
downloadopenssl-11279b13f586441a8fcc5109ee1907f33eb0cc24.tar.gz
Test client-side resumption
Add tests for resuming with a different client version. This happens in reality when clients persist sessions on disk through upgrades. Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'test/ssl_test.c')
-rw-r--r--test/ssl_test.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/test/ssl_test.c b/test/ssl_test.c
index c5deeb209b..b28d308d08 100644
--- a/test/ssl_test.c
+++ b/test/ssl_test.c
@@ -215,7 +215,7 @@ static int execute_test(SSL_TEST_FIXTURE fixture)
{
int ret = 0;
SSL_CTX *server_ctx = NULL, *server2_ctx = NULL, *client_ctx = NULL,
- *resume_server_ctx = NULL;
+ *resume_server_ctx = NULL, *resume_client_ctx = NULL;
SSL_TEST_CTX *test_ctx = NULL;
HANDSHAKE_RESULT *result = NULL;
@@ -233,7 +233,9 @@ static int execute_test(SSL_TEST_FIXTURE fixture)
client_ctx = SSL_CTX_new(DTLS_client_method());
if (test_ctx->handshake_mode == SSL_TEST_HANDSHAKE_RESUME) {
resume_server_ctx = SSL_CTX_new(DTLS_server_method());
+ resume_client_ctx = SSL_CTX_new(DTLS_client_method());
OPENSSL_assert(resume_server_ctx != NULL);
+ OPENSSL_assert(resume_client_ctx != NULL);
}
}
#endif
@@ -247,11 +249,14 @@ static int execute_test(SSL_TEST_FIXTURE fixture)
if (test_ctx->handshake_mode == SSL_TEST_HANDSHAKE_RESUME) {
resume_server_ctx = SSL_CTX_new(TLS_server_method());
+ resume_client_ctx = SSL_CTX_new(TLS_client_method());
OPENSSL_assert(resume_server_ctx != NULL);
+ OPENSSL_assert(resume_client_ctx != NULL);
}
}
- OPENSSL_assert(server_ctx != NULL && client_ctx != NULL);
+ OPENSSL_assert(server_ctx != NULL);
+ OPENSSL_assert(client_ctx != NULL);
OPENSSL_assert(CONF_modules_load(conf, fixture.test_app, 0) > 0);
@@ -265,9 +270,12 @@ static int execute_test(SSL_TEST_FIXTURE fixture)
if (resume_server_ctx != NULL
&& !SSL_CTX_config(resume_server_ctx, "resume-server"))
goto err;
+ if (resume_client_ctx != NULL
+ && !SSL_CTX_config(resume_client_ctx, "resume-client"))
+ goto err;
result = do_handshake(server_ctx, server2_ctx, client_ctx,
- resume_server_ctx, test_ctx);
+ resume_server_ctx, resume_client_ctx, test_ctx);
ret = check_test(result, test_ctx);
@@ -277,6 +285,7 @@ err:
SSL_CTX_free(server2_ctx);
SSL_CTX_free(client_ctx);
SSL_CTX_free(resume_server_ctx);
+ SSL_CTX_free(resume_client_ctx);
SSL_TEST_CTX_free(test_ctx);
if (ret != 1)
ERR_print_errors_fp(stderr);