]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
sslapitest: Add test for premature call of SSL_export_keying_material
authorTomas Mraz <tmraz@fedoraproject.org>
Thu, 6 Aug 2020 13:14:29 +0000 (15:14 +0200)
committerTomas Mraz <tmraz@fedoraproject.org>
Thu, 13 Aug 2020 08:17:10 +0000 (10:17 +0200)
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12594)

test/sslapitest.c

index 3d6d83a11a1e42fb55be73403e1472758bf61485..6f4c11537b0fdf98c152faf320ab0dbee82b78fe 100644 (file)
@@ -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) {