[openssl] openssl-3.0 update

tomas at openssl.org tomas at openssl.org
Mon Jan 17 15:24:40 UTC 2022


The branch openssl-3.0 has been updated
       via  67397a6aeda3383bdc7c7165d8c0efe9423cc7a9 (commit)
      from  8bb90f43aa732efb9530edc2ab3767b228d5d9da (commit)


- Log -----------------------------------------------------------------
commit 67397a6aeda3383bdc7c7165d8c0efe9423cc7a9
Author: Tomas Mraz <tomas at openssl.org>
Date:   Thu Jan 13 19:02:31 2022 +0100

    dhtest: Add testcase for EVP_PKEY_CTX_set_dh_nid
    
    And a negative testcase for EVP_PKEY_CTX_set_dhx_rfc5114
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/17498)
    
    (cherry picked from commit 59d3fd1cc8c938daa6384783a7e5847d6f5201f7)

-----------------------------------------------------------------------

Summary of changes:
 test/dhtest.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/test/dhtest.c b/test/dhtest.c
index 71c95b186f..ce94999f7d 100644
--- a/test/dhtest.c
+++ b/test/dhtest.c
@@ -744,6 +744,33 @@ static int dh_rfc5114_fix_nid_test(void)
     /* Tested function is called here */
     if (!TEST_int_eq(EVP_PKEY_CTX_set_dhx_rfc5114(paramgen_ctx, 3), 1))
         goto err;
+    /* Negative test */
+    if (!TEST_int_eq(EVP_PKEY_CTX_set_dhx_rfc5114(paramgen_ctx, 99), 0))
+        goto err;
+    /* If we're still running then the test passed. */
+    ok = 1;
+err:
+    EVP_PKEY_CTX_free(paramgen_ctx);
+    return ok;
+}
+
+static int dh_set_dh_nid_test(void)
+{
+    int ok = 0;
+    EVP_PKEY_CTX *paramgen_ctx;
+
+    /* Run the test. Success is any time the test does not cause a SIGSEGV interrupt */
+    paramgen_ctx = EVP_PKEY_CTX_new_id(EVP_PKEY_DH, 0);
+    if (!TEST_ptr(paramgen_ctx))
+        goto err;
+    if (!TEST_int_eq(EVP_PKEY_paramgen_init(paramgen_ctx), 1))
+        goto err;
+    /* Tested function is called here */
+    if (!TEST_int_eq(EVP_PKEY_CTX_set_dh_nid(paramgen_ctx, NID_ffdhe2048), 1))
+        goto err;
+    /* Negative test */
+    if (!TEST_int_eq(EVP_PKEY_CTX_set_dh_nid(paramgen_ctx, NID_secp521r1), 0))
+        goto err;
     /* If we're still running then the test passed. */
     ok = 1;
 err:
@@ -898,6 +925,7 @@ int setup_tests(void)
     ADD_TEST(dh_get_nid);
     ADD_TEST(dh_load_pkcs3_namedgroup_privlen_test);
     ADD_TEST(dh_rfc5114_fix_nid_test);
+    ADD_TEST(dh_set_dh_nid_test);
 #endif
     return 1;
 }


More information about the openssl-commits mailing list