summaryrefslogtreecommitdiffstats
path: root/test/ssl_test_ctx.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2017-01-08 00:09:08 +0000
committerDr. Stephen Henson <steve@openssl.org>2017-01-08 19:39:33 +0000
commit75f12d7cbffcaa31cc8ff5c7fee02e614785632a (patch)
tree7e965bf40bd456b24cb000757e4611f47d7124e7 /test/ssl_test_ctx.c
parent1702df6ed6bb6fd494adfa74125b5948bfbc13a6 (diff)
Add new ssl_test option.
Add option ExpectedTmpKeyType to test the temporary key the server sends is of the correct type. Reviewed-by: Kurt Roeckx <kurt@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2191) (cherry picked from commit b93ad05dba3e3d2ceb79799a883ae43d42ba16e2)
Diffstat (limited to 'test/ssl_test_ctx.c')
-rw-r--r--test/ssl_test_ctx.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/ssl_test_ctx.c b/test/ssl_test_ctx.c
index 0a528d805b..09e7a89e9b 100644
--- a/test/ssl_test_ctx.c
+++ b/test/ssl_test_ctx.c
@@ -431,6 +431,30 @@ IMPLEMENT_SSL_TEST_INT_OPTION(SSL_TEST_CTX, test, app_data_size)
IMPLEMENT_SSL_TEST_INT_OPTION(SSL_TEST_CTX, test, max_fragment_size)
+/***********************/
+/* ExpectedTmpKeyType */
+/***********************/
+
+__owur static int parse_expected_tmp_key_type(SSL_TEST_CTX *test_ctx,
+ const char *value)
+{
+ int nid;
+
+ if (value == NULL)
+ return 0;
+ nid = OBJ_sn2nid(value);
+ if (nid == NID_undef)
+ nid = OBJ_ln2nid(value);
+#ifndef OPENSSL_NO_EC
+ if (nid == NID_undef)
+ nid = EC_curve_nist2nid(value);
+#endif
+ if (nid == NID_undef)
+ return 0;
+ test_ctx->expected_tmp_key_type = nid;
+ return 1;
+}
+
/*************************************************************/
/* Known test options and their corresponding parse methods. */
/*************************************************************/
@@ -455,6 +479,7 @@ static const ssl_test_ctx_option ssl_test_ctx_options[] = {
{ "ResumptionExpected", &parse_test_resumption_expected },
{ "ApplicationData", &parse_test_app_data_size },
{ "MaxFragmentSize", &parse_test_max_fragment_size },
+ { "ExpectedTmpKeyType", &parse_expected_tmp_key_type },
};
/* Nested client options. */