summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2022-11-24 16:46:38 +0100
committerTomas Mraz <tomas@openssl.org>2022-11-25 18:39:44 +0100
commitff2f8c81a080ed33c24af171342fc9e82b01d857 (patch)
treedfafc691a489a3c650e667797138912a500807c4 /test
parentac591bf69e6be7c6ca3446cbb61c80292e088305 (diff)
Add test for EVP_PKEY_Q_keygen
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) (cherry picked from commit 667a8501f0b6e5705fd611d5bb3ca24848b07154)
Diffstat (limited to 'test')
-rw-r--r--test/evp_extra_test2.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/evp_extra_test2.c b/test/evp_extra_test2.c
index 160d0c95fd..5430ec462b 100644
--- a/test/evp_extra_test2.c
+++ b/test/evp_extra_test2.c
@@ -413,6 +413,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;
@@ -1136,6 +1149,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);