summaryrefslogtreecommitdiffstats
path: root/test/handshake_helper.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/handshake_helper.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/handshake_helper.c')
-rw-r--r--test/handshake_helper.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/handshake_helper.c b/test/handshake_helper.c
index 1d0e2a4b99..0a421b1597 100644
--- a/test/handshake_helper.c
+++ b/test/handshake_helper.c
@@ -876,6 +876,7 @@ static HANDSHAKE_RESULT *do_handshake_internal(
const unsigned char *proto = NULL;
/* API dictates unsigned int rather than size_t. */
unsigned int proto_len = 0;
+ EVP_PKEY *tmp_key;
memset(&server_ctx_data, 0, sizeof(server_ctx_data));
memset(&server2_ctx_data, 0, sizeof(server2_ctx_data));
@@ -1035,6 +1036,19 @@ static HANDSHAKE_RESULT *do_handshake_internal(
if (session_out != NULL)
*session_out = SSL_get1_session(client.ssl);
+ if (SSL_get_server_tmp_key(client.ssl, &tmp_key)) {
+ int nid = EVP_PKEY_id(tmp_key);
+
+#ifndef OPENSSL_NO_EC
+ if (nid == EVP_PKEY_EC) {
+ EC_KEY *ec = EVP_PKEY_get0_EC_KEY(tmp_key);
+ nid = EC_GROUP_get_curve_name(EC_KEY_get0_group(ec));
+ }
+#endif
+ EVP_PKEY_free(tmp_key);
+ ret->tmp_key_type = nid;
+ }
+
ctx_data_free_data(&server_ctx_data);
ctx_data_free_data(&server2_ctx_data);
ctx_data_free_data(&client_ctx_data);