]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Add test for EVP_PKEY_Q_keygen
authorTomas Mraz <tomas@openssl.org>
Thu, 24 Nov 2022 15:46:38 +0000 (16:46 +0100)
committerTomas Mraz <tomas@openssl.org>
Fri, 25 Nov 2022 17:38:52 +0000 (18:38 +0100)
Test for #19736

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19761)

test/evp_extra_test2.c

index 44ce4aed0115e97b0c1998753d9247724401938e..effefdaa05526c2a33b9ce96f088e1a0dc99f945 100644 (file)
@@ -442,6 +442,19 @@ static int test_ecx_tofrom_data_select(void)
 }
 #endif
 
+#ifndef OPENSSL_NO_SM2
+static int test_sm2_tofrom_data_select(void)
+{
+    int ret;
+    EVP_PKEY *key = NULL;
+
+    ret = TEST_ptr(key = EVP_PKEY_Q_keygen(mainctx, NULL, "SM2"))
+          && TEST_true(do_pkey_tofrom_data_select(key, "SM2"));
+    EVP_PKEY_free(key);
+    return ret;
+}
+#endif
+
 static int test_rsa_tofrom_data_select(void)
 {
     int ret;
@@ -1181,6 +1194,9 @@ int setup_tests(void)
 #else
     ADD_ALL_TESTS(test_d2i_PrivateKey_ex, 1);
 #endif
+#ifndef OPENSSL_NO_SM2
+    ADD_TEST(test_sm2_tofrom_data_select);
+#endif
 #ifndef OPENSSL_NO_DSA
     ADD_TEST(test_dsa_todata);
     ADD_TEST(test_dsa_tofrom_data_select);