aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2025-07-04 05:19:26 +0000
committerNIIBE Yutaka <[email protected]>2025-07-04 05:19:26 +0000
commit5ab9d59ee19ec1a50976d98344d331015180f7c9 (patch)
tree0371eb06981ecf2bd2b7cd8fc77873c14c85c4c7
parentcommon:kem: Factor out a function to retrieve ECC parameters. (diff)
downloadgnupg-5ab9d59ee19ec1a50976d98344d331015180f7c9.tar.gz
gnupg-5ab9d59ee19ec1a50976d98344d331015180f7c9.zip
common:ecc: Have a field if the curve of ECC is Weierstrass.
* common/util.h (struct gnupg_ecc_params): Add is_weierstrauss. * common/kem.c (ecc_table): Update. Also add secp256k1. -- GnuPG-bug-id: 7698 Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r--common/kem.c26
-rw-r--r--common/util.h1
2 files changed, 18 insertions, 9 deletions
diff --git a/common/kem.c b/common/kem.c
index 5d994f0d6..94ad13457 100644
--- a/common/kem.c
+++ b/common/kem.c
@@ -256,51 +256,59 @@ static const struct gnupg_ecc_params ecc_table[] =
"Curve25519",
33, 32, 32,
GCRY_MD_SHA3_256, GCRY_KEM_RAW_X25519,
- 1, 1
+ 1, 1, 0
},
{
"X448",
56, 56, 56,
GCRY_MD_SHA3_512, GCRY_KEM_RAW_X448,
- 0, 0
+ 0, 0, 0
},
{
"NIST P-256",
65, 32, 65,
GCRY_MD_SHA3_256, GCRY_KEM_RAW_P256R1,
- 0, 0
+ 0, 0, 1
},
{
"NIST P-384",
97, 48, 97,
GCRY_MD_SHA3_512, GCRY_KEM_RAW_P384R1,
- 0, 0
+ 0, 0, 1
},
{
"NIST P-521",
133, 66, 133,
GCRY_MD_SHA3_512, GCRY_KEM_RAW_P521R1,
- 0, 0
+ 0, 0, 1
},
{
"brainpoolP256r1",
65, 32, 65,
GCRY_MD_SHA3_256, GCRY_KEM_RAW_BP256,
- 0, 0
+ 0, 0, 1
},
{
"brainpoolP384r1",
97, 48, 97,
GCRY_MD_SHA3_512, GCRY_KEM_RAW_BP384,
- 0, 0
+ 0, 0, 1
},
{
"brainpoolP512r1",
129, 64, 129,
GCRY_MD_SHA3_512, GCRY_KEM_RAW_BP512,
- 0, 0
+ 0, 0, 1
},
- { NULL, 0, 0, 0, 0, 0, 0, 0 }
+#ifdef GCRY_KEM_RAW_P256K1
+ {
+ "secp256k1",
+ 65, 32, 65,
+ GCRY_MD_SHA3_256, GCRY_KEM_RAW_P256K1,
+ 0, 0, 1
+ },
+#endif
+ { NULL, 0, 0, 0, 0, 0, 0, 0, 0 }
};
diff --git a/common/util.h b/common/util.h
index b13f4300d..e8e6ed409 100644
--- a/common/util.h
+++ b/common/util.h
@@ -335,6 +335,7 @@ struct gnupg_ecc_params
int kem_algo;
int scalar_reverse; /* Byte-oder is reverse. */
int may_have_prefix; /* Point representation may have prefix. */
+ int is_weierstrauss; /* True if it is Weierstrass curve. */
};
const struct gnupg_ecc_params *gnupg_get_ecc_params (const char *curve);