aboutsummaryrefslogtreecommitdiffstats
path: root/test/sslapitest.c
diff options
context:
space:
mode:
authorTomas Mraz <tmraz@fedoraproject.org>2020-08-06 15:14:29 +0200
committerTomas Mraz <tmraz@fedoraproject.org>2020-08-13 10:17:10 +0200
commitea9f6890eb54e4b9e8b81cc1318ca3a6fc0c8356 (patch)
treec9a4707b079e79f9b6a84b05278c50fd174513d9 /test/sslapitest.c
parentdffeec1c10a874d7c7b83c221dbbce82f755edb1 (diff)
downloadopenssl-ea9f6890eb54e4b9e8b81cc1318ca3a6fc0c8356.tar.gz
sslapitest: Add test for premature call of SSL_export_keying_material
Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/12594)
Diffstat (limited to 'test/sslapitest.c')
-rw-r--r--test/sslapitest.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/test/sslapitest.c b/test/sslapitest.c
index 3d6d83a11a..6f4c11537b 100644
--- a/test/sslapitest.c
+++ b/test/sslapitest.c
@@ -5690,9 +5690,20 @@ static int test_export_key_mat(int tst)
goto end;
if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, NULL,
- NULL))
- || !TEST_true(create_ssl_connection(serverssl, clientssl,
- SSL_ERROR_NONE)))
+ NULL)))
+ goto end;
+
+ /*
+ * Premature call of SSL_export_keying_material should just fail.
+ */
+ if (!TEST_int_le(SSL_export_keying_material(clientssl, ckeymat1,
+ sizeof(ckeymat1), label,
+ SMALL_LABEL_LEN + 1, context,
+ sizeof(context) - 1, 1), 0))
+ goto end;
+
+ if (!TEST_true(create_ssl_connection(serverssl, clientssl,
+ SSL_ERROR_NONE)))
goto end;
if (tst == 5) {