diff options
author | Matt Caswell <matt@openssl.org> | 2017-06-28 17:18:27 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2017-06-29 10:15:50 +0100 |
commit | a599574be17579496877bcdcc5e1eeaf5b014cf3 (patch) | |
tree | a5d4cfaf17d9ffe1a1d8ab6d78efa2a64c6f47d1 /test | |
parent | e88c40af4572a422be5fcab732bd46c55df136f8 (diff) |
Updates following review of SSL_export_key_material() changes
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3782)
Diffstat (limited to 'test')
-rw-r--r-- | test/sslapitest.c | 33 |
1 files changed, 10 insertions, 23 deletions
diff --git a/test/sslapitest.c b/test/sslapitest.c index 8006d7e657..ae5c4c0bd1 100644 --- a/test/sslapitest.c +++ b/test/sslapitest.c @@ -2493,7 +2493,7 @@ static int test_serverinfo(int tst) */ static int test_export_key_mat(int tst) { - int testresult = 0, proto; + int testresult = 0; SSL_CTX *cctx = NULL, *sctx = NULL, *sctx2 = NULL; SSL *clientssl = NULL, *serverssl = NULL; const char label[] = "test label"; @@ -2501,6 +2501,12 @@ static int test_export_key_mat(int tst) const unsigned char *emptycontext = NULL; unsigned char ckeymat1[80], ckeymat2[80], ckeymat3[80]; unsigned char skeymat1[80], skeymat2[80], skeymat3[80]; + const int protocols[] = { + TLS1_VERSION, + TLS1_1_VERSION, + TLS1_2_VERSION, + TLS1_3_VERSION + }; #ifdef OPENSSL_NO_TLS1 if (tst == 0) @@ -2523,28 +2529,9 @@ static int test_export_key_mat(int tst) &cctx, cert, privkey))) goto end; - switch (tst) { - case 0: - proto = TLS1_VERSION; - break; - - case 1: - proto = TLS1_1_VERSION; - break; - - case 2: - proto = TLS1_2_VERSION; - break; - - case 3: - proto = TLS1_3_VERSION; - break; - - default: - goto end; - } - SSL_CTX_set_max_proto_version(cctx, proto); - SSL_CTX_set_min_proto_version(cctx, proto); + OPENSSL_assert(tst >= 0 && (size_t)tst < OSSL_NELEM(protocols)); + SSL_CTX_set_max_proto_version(cctx, protocols[tst]); + SSL_CTX_set_min_proto_version(cctx, protocols[tst]); if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, NULL, NULL)) |