summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTianjia Zhang <tianjia.zhang@linux.alibaba.com>2019-12-22 17:20:11 +0800
committerNIIBE Yutaka <gniibe@fsij.org>2020-01-16 14:54:23 +0900
commitd154c1e9e11019980253f0a65758932cd0656470 (patch)
tree6ca3fefe3f48266a9c69d0ff9236909513d6dfa2
parentf34de41b9db5412f253b9b984522427638aae115 (diff)
downloadlibgcrypt-d154c1e9e11019980253f0a65758932cd0656470.tar.gz
Add new curve named sm2p256v1.
* cipher/ecc-curves.c (domain_parms): Add sm2p256v1 for SM2. * tests/curves.c (N_CURVES): Update N_CURVES for SM2. Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
-rw-r--r--cipher/ecc-curves.c14
-rw-r--r--tests/curves.c2
2 files changed, 15 insertions, 1 deletions
diff --git a/cipher/ecc-curves.c b/cipher/ecc-curves.c
index 52872c5e..1592d23a 100644
--- a/cipher/ecc-curves.c
+++ b/cipher/ecc-curves.c
@@ -115,6 +115,8 @@ static const struct
{ "secp256k1", "1.3.132.0.10" },
+ { "sm2p256v1", "1.2.156.10197.1.301" },
+
{ NULL, NULL}
};
@@ -512,6 +514,18 @@ static const ecc_domain_parms_t domain_parms[] =
1
},
+ {
+ "sm2p256v1", 256, 0,
+ MPI_EC_WEIERSTRASS, ECC_DIALECT_STANDARD,
+ "0xfffffffeffffffffffffffffffffffffffffffff00000000ffffffffffffffff",
+ "0xfffffffeffffffffffffffffffffffffffffffff00000000fffffffffffffffc",
+ "0x28e9fa9e9d9f5e344d5a9e4bcf6509a7f39789f515ab8f92ddbcbd414d940e93",
+ "0xfffffffeffffffffffffffffffffffff7203df6b21c6052b53bbf40939d54123",
+ "0x32c4ae2c1f1981195f9904466a39c9948fe30bbff2660be1715a4589334c74c7",
+ "0xbc3736a2f4f6779c59bdcee36b692153d0a9877cc62a474002df32e52139f0a0",
+ 1
+ },
+
{ NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
};
diff --git a/tests/curves.c b/tests/curves.c
index ff244bd1..0dfa2acb 100644
--- a/tests/curves.c
+++ b/tests/curves.c
@@ -33,7 +33,7 @@
#include "t-common.h"
/* Number of curves defined in ../cipger/ecc-curves.c */
-#define N_CURVES 25
+#define N_CURVES 26
/* A real world sample public key. */
static char const sample_key_1[] =