summaryrefslogtreecommitdiffstats
path: root/test/ecdsatest.c
diff options
context:
space:
mode:
authorPaul Yang <kaishen.yy@antfin.com>2020-07-26 23:25:49 +0800
committerMatt Caswell <matt@openssl.org>2020-09-22 08:17:57 +0100
commit7ee511d093758360ed421e420cc29d9aaf11f143 (patch)
treeb5a7bc5b27c9db3a6e23d73ceb7864b4553bc426 /test/ecdsatest.c
parent6b1428ac12749f7ff0e49be363e9f7097f0e58b0 (diff)
Add SM2 key management
Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/12536)
Diffstat (limited to 'test/ecdsatest.c')
-rw-r--r--test/ecdsatest.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ecdsatest.c b/test/ecdsatest.c
index 471aaa184d..8340d28912 100644
--- a/test/ecdsatest.c
+++ b/test/ecdsatest.c
@@ -237,6 +237,20 @@ static int test_builtin(int n, int as)
return 1;
}
+ /*
+ * skip SM2 curve if 'as' is equal to EVP_PKEY_EC or, skip all curves
+ * except SM2 curve if 'as' is equal to EVP_PKEY_SM2
+ */
+ if (nid == NID_sm2 && as == EVP_PKEY_EC) {
+ TEST_info("skipped: EC key type unsupported for curve %s",
+ OBJ_nid2sn(nid));
+ return 1;
+ } else if (nid != NID_sm2 && as == EVP_PKEY_SM2) {
+ TEST_info("skipped: SM2 key type unsupported for curve %s",
+ OBJ_nid2sn(nid));
+ return 1;
+ }
+
TEST_info("testing ECDSA for curve %s as %s key type", OBJ_nid2sn(nid),
as == EVP_PKEY_EC ? "EC" : "SM2");