diffie-hellman: Add DH group identifiers for Curve25519 and Curve448

This commit is contained in:
Martin Willi 2014-08-08 16:20:31 +02:00 committed by Andreas Steffen
parent ee5da1633a
commit a4195d3841
2 changed files with 14 additions and 3 deletions

View File

@ -32,7 +32,7 @@ ENUM_NEXT(diffie_hellman_group_names, MODP_2048_BIT, ECP_521_BIT, MODP_1536_BIT,
"ECP_256",
"ECP_384",
"ECP_521");
ENUM_NEXT(diffie_hellman_group_names, MODP_1024_160, ECP_512_BP, ECP_521_BIT,
ENUM_NEXT(diffie_hellman_group_names, MODP_1024_160, CURVE_448, ECP_521_BIT,
"MODP_1024_160",
"MODP_2048_224",
"MODP_2048_256",
@ -41,8 +41,10 @@ ENUM_NEXT(diffie_hellman_group_names, MODP_1024_160, ECP_512_BP, ECP_521_BIT,
"ECP_224_BP",
"ECP_256_BP",
"ECP_384_BP",
"ECP_512_BP");
ENUM_NEXT(diffie_hellman_group_names, MODP_NULL, MODP_NULL, ECP_512_BP,
"ECP_512_BP",
"CURVE_25519",
"CURVE_448");
ENUM_NEXT(diffie_hellman_group_names, MODP_NULL, MODP_NULL, CURVE_448,
"MODP_NULL");
ENUM_NEXT(diffie_hellman_group_names, NTRU_112_BIT, NTRU_256_BIT, MODP_NULL,
"NTRU_112",
@ -552,6 +554,12 @@ bool diffie_hellman_verify_value(diffie_hellman_group_t group, chunk_t value)
case ECP_521_BIT:
valid = value.len == 132;
break;
case CURVE_25519:
valid = value.len == 32;
break;
case CURVE_448:
valid = value.len == 56;
break;
case NTRU_112_BIT:
case NTRU_128_BIT:
case NTRU_192_BIT:

View File

@ -37,6 +37,7 @@ typedef struct diffie_hellman_params_t diffie_hellman_params_t;
*
* ECP groups are defined in RFC 4753 and RFC 5114.
* ECC Brainpool groups are defined in RFC 6954.
* Curve25519 and Curve448 groups are defined in RFC 8031.
*/
enum diffie_hellman_group_t {
MODP_NONE = 0,
@ -60,6 +61,8 @@ enum diffie_hellman_group_t {
ECP_256_BP = 28,
ECP_384_BP = 29,
ECP_512_BP = 30,
CURVE_25519 = 31,
CURVE_448 = 32,
/** insecure NULL diffie hellman group for testing, in PRIVATE USE */
MODP_NULL = 1024,
/** MODP group with custom generator/prime */