Add identifiers for Brainpool curves

This commit is contained in:
Manuel Pégourié-Gonnard 2013-10-07 19:40:41 +02:00
parent 9eb883104e
commit 8195c1a567
3 changed files with 24 additions and 9 deletions

View file

@ -241,6 +241,9 @@
#define POLARSSL_ECP_DP_SECP256R1_ENABLED #define POLARSSL_ECP_DP_SECP256R1_ENABLED
#define POLARSSL_ECP_DP_SECP384R1_ENABLED #define POLARSSL_ECP_DP_SECP384R1_ENABLED
#define POLARSSL_ECP_DP_SECP521R1_ENABLED #define POLARSSL_ECP_DP_SECP521R1_ENABLED
#define POLARSSL_ECP_DP_BP256R1_ENABLED
#define POLARSSL_ECP_DP_BP384R1_ENABLED
#define POLARSSL_ECP_DP_BP512R1_ENABLED
/** /**
* \def POLARSSL_KEY_EXCHANGE_PSK_ENABLED * \def POLARSSL_KEY_EXCHANGE_PSK_ENABLED

View file

@ -61,12 +61,15 @@ typedef enum
POLARSSL_ECP_DP_SECP256R1, /*!< 256-bits NIST curve */ POLARSSL_ECP_DP_SECP256R1, /*!< 256-bits NIST curve */
POLARSSL_ECP_DP_SECP384R1, /*!< 384-bits NIST curve */ POLARSSL_ECP_DP_SECP384R1, /*!< 384-bits NIST curve */
POLARSSL_ECP_DP_SECP521R1, /*!< 521-bits NIST curve */ POLARSSL_ECP_DP_SECP521R1, /*!< 521-bits NIST curve */
POLARSSL_ECP_DP_BP256R1, /*!< 256-bits Brainpool curve */
POLARSSL_ECP_DP_BP384R1, /*!< 384-bits Brainpool curve */
POLARSSL_ECP_DP_BP512R1, /*!< 512-bits Brainpool curve */
} ecp_group_id; } ecp_group_id;
/** /**
* Number of supported curves (plus one for NONE) * Number of supported curves (plus one for NONE)
*/ */
#define POLARSSL_ECP_DP_MAX 6 #define POLARSSL_ECP_DP_MAX 9
/** /**
* Curve information for use by other modules * Curve information for use by other modules

View file

@ -70,28 +70,37 @@ unsigned long add_count, dbl_count;
/* /*
* List of supported curves: * List of supported curves:
* - internal ID * - internal ID
* - TLS NamedCurve ID (RFC 4492 section 5.1.1) * - TLS NamedCurve ID (RFC 4492 sec. 5.1.1, RFC 7071 sec. 2)
* - size in bits * - size in bits
* - readeble name * - readable name
*/ */
const ecp_curve_info ecp_supported_curves[] = const ecp_curve_info ecp_supported_curves[] =
{ {
#if defined(POLARSSL_ECP_DP_BP512R1_ENABLED)
{ POLARSSL_ECP_DP_BP512R1, 28, 512, "brainpool512r1" },
#endif
#if defined(POLARSSL_ECP_DP_BP384R1_ENABLED)
{ POLARSSL_ECP_DP_BP384R1, 27, 384, "brainpool384r1" },
#endif
#if defined(POLARSSL_ECP_DP_BP256R1_ENABLED)
{ POLARSSL_ECP_DP_BP256R1, 26, 256, "brainpool256r1" },
#endif
#if defined(POLARSSL_ECP_DP_SECP521R1_ENABLED) #if defined(POLARSSL_ECP_DP_SECP521R1_ENABLED)
{ POLARSSL_ECP_DP_SECP521R1, 25, 521, "secp521r1" }, { POLARSSL_ECP_DP_SECP521R1, 25, 521, "secp521r1" },
#endif #endif
#if defined(POLARSSL_ECP_DP_SECP384R1_ENABLED) #if defined(POLARSSL_ECP_DP_SECP384R1_ENABLED)
{ POLARSSL_ECP_DP_SECP384R1, 24, 384, "secp384r1" }, { POLARSSL_ECP_DP_SECP384R1, 24, 384, "secp384r1" },
#endif #endif
#if defined(POLARSSL_ECP_DP_SECP256R1_ENABLED) #if defined(POLARSSL_ECP_DP_SECP256R1_ENABLED)
{ POLARSSL_ECP_DP_SECP256R1, 23, 256, "secp256r1" }, { POLARSSL_ECP_DP_SECP256R1, 23, 256, "secp256r1" },
#endif #endif
#if defined(POLARSSL_ECP_DP_SECP224R1_ENABLED) #if defined(POLARSSL_ECP_DP_SECP224R1_ENABLED)
{ POLARSSL_ECP_DP_SECP224R1, 21, 224, "secp224r1" }, { POLARSSL_ECP_DP_SECP224R1, 21, 224, "secp224r1" },
#endif #endif
#if defined(POLARSSL_ECP_DP_SECP192R1_ENABLED) #if defined(POLARSSL_ECP_DP_SECP192R1_ENABLED)
{ POLARSSL_ECP_DP_SECP192R1, 19, 192, "secp192r1" }, { POLARSSL_ECP_DP_SECP192R1, 19, 192, "secp192r1" },
#endif #endif
{ POLARSSL_ECP_DP_NONE, 0, 0, NULL }, { POLARSSL_ECP_DP_NONE, 0, 0, NULL },
}; };
/* /*