1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-14 21:47:19 +02:00

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 <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2025-07-04 14:19:26 +09:00
parent 5e623b71d5
commit 5ab9d59ee1
No known key found for this signature in database
GPG key ID: 640114AF89DE6054
2 changed files with 18 additions and 9 deletions

View file

@ -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 }
};

View file

@ -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);