diffie-hellman: Add DH group identifiers for Curve25519 and Curve448
authorMartin Willi <martin@revosec.ch>
Fri, 8 Aug 2014 14:20:31 +0000 (16:20 +0200)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Mon, 14 Nov 2016 15:20:51 +0000 (16:20 +0100)
src/libstrongswan/crypto/diffie_hellman.c
src/libstrongswan/crypto/diffie_hellman.h

index 6dcb6cb..820b8d1 100644 (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:
index f457153..1a8110a 100644 (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 */