Deprecate Diffie-Hellman groups from RFC 5114
Also, change the way the standardized Diffie-Hellman groups are provided from macro-based string-literals to global variables.
This commit is contained in:
parent
01692531c6
commit
0e6dc84f3e
@ -38,6 +38,14 @@
|
||||
#define MBEDTLS_ERR_DHM_ALLOC_FAILED -0x3400 /**< Allocation of memory failed. */
|
||||
#define MBEDTLS_ERR_DHM_FILE_IO_ERROR -0x3480 /**< Read/write of file failed. */
|
||||
|
||||
#if ! defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#if defined(MBEDTLS_DEPRECATED_WARNING)
|
||||
#define MBEDTLS_DEPRECATED __attribute__((deprecated))
|
||||
#else
|
||||
#define MBEDTLS_DEPRECATED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* RFC 3526 defines a number of standardized Diffie-Hellman groups
|
||||
* for IKE.
|
||||
@ -51,93 +59,48 @@
|
||||
* RFC 3526 4. 3072-bit MODP Group
|
||||
* RFC 3526 5. 4096-bit MODP Group
|
||||
* RFC 5114 2.2. 2048-bit MODP Group with 224-bit Prime Order Subgroup
|
||||
* The constants with suffix "_p" denote the chosen prime moduli, while
|
||||
* the constants with suffix "_g" denote the chosen generator
|
||||
* of the associated prime field.
|
||||
*
|
||||
* All constants are represented as null-terminated strings containing the
|
||||
* hexadecimal presentation of the respective numbers.
|
||||
*
|
||||
* \warning The origin of the primes in RFC 5114 is not documented and
|
||||
* their use therefore constitutes a security risk!
|
||||
*
|
||||
* \deprecated The primes from RFC 5114 are superseded by the primes
|
||||
* from RFC 3526 and RFC 7919 and should no longer be used.
|
||||
* They will be removed in the next major revision.
|
||||
*/
|
||||
#define MBEDTLS_DHM_RFC3526_MODP_2048_P \
|
||||
"FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" \
|
||||
"29024E088A67CC74020BBEA63B139B22514A08798E3404DD" \
|
||||
"EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" \
|
||||
"E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" \
|
||||
"EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D" \
|
||||
"C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F" \
|
||||
"83655D23DCA3AD961C62F356208552BB9ED529077096966D" \
|
||||
"670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B" \
|
||||
"E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9" \
|
||||
"DE2BCBF6955817183995497CEA956AE515D2261898FA0510" \
|
||||
"15728E5A8AACAA68FFFFFFFFFFFFFFFF"
|
||||
|
||||
#define MBEDTLS_DHM_RFC3526_MODP_2048_G "02"
|
||||
const char *mbedtls_dhm_rfc3526_modp_2048_p;
|
||||
const char *mbedtls_dhm_rfc3526_modp_2048_g;
|
||||
const char *mbedtls_dhm_rfc3526_modp_3072_p;
|
||||
const char *mbedtls_dhm_rfc3526_modp_3072_g;
|
||||
const char *mbedtls_dhm_rfc3526_modp_4096_p;
|
||||
const char *mbedtls_dhm_rfc3526_modp_4096_g;
|
||||
|
||||
#define MBEDTLS_DHM_RFC3526_MODP_3072_P \
|
||||
"FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" \
|
||||
"29024E088A67CC74020BBEA63B139B22514A08798E3404DD" \
|
||||
"EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" \
|
||||
"E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" \
|
||||
"EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D" \
|
||||
"C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F" \
|
||||
"83655D23DCA3AD961C62F356208552BB9ED529077096966D" \
|
||||
"670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B" \
|
||||
"E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9" \
|
||||
"DE2BCBF6955817183995497CEA956AE515D2261898FA0510" \
|
||||
"15728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64" \
|
||||
"ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7" \
|
||||
"ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6B" \
|
||||
"F12FFA06D98A0864D87602733EC86A64521F2B18177B200C" \
|
||||
"BBE117577A615D6C770988C0BAD946E208E24FA074E5AB31" \
|
||||
"43DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF"
|
||||
|
||||
#define MBEDTLS_DHM_RFC3526_MODP_3072_G "02"
|
||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
MBEDTLS_DEPRECATED const char *mbedtls_dhm_rfc5114_modp_2048_p;
|
||||
MBEDTLS_DEPRECATED const char *mbedtls_dhm_rfc5114_modp_2048_g;
|
||||
#endif
|
||||
|
||||
#define MBEDTLS_DHM_RFC3526_MODP_4096_P \
|
||||
"FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" \
|
||||
"29024E088A67CC74020BBEA63B139B22514A08798E3404DD" \
|
||||
"EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" \
|
||||
"E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" \
|
||||
"EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D" \
|
||||
"C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F" \
|
||||
"83655D23DCA3AD961C62F356208552BB9ED529077096966D" \
|
||||
"670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B" \
|
||||
"E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9" \
|
||||
"DE2BCBF6955817183995497CEA956AE515D2261898FA0510" \
|
||||
"15728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64" \
|
||||
"ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7" \
|
||||
"ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6B" \
|
||||
"F12FFA06D98A0864D87602733EC86A64521F2B18177B200C" \
|
||||
"BBE117577A615D6C770988C0BAD946E208E24FA074E5AB31" \
|
||||
"43DB5BFCE0FD108E4B82D120A92108011A723C12A787E6D7" \
|
||||
"88719A10BDBA5B2699C327186AF4E23C1A946834B6150BDA" \
|
||||
"2583E9CA2AD44CE8DBBBC2DB04DE8EF92E8EFC141FBECAA6" \
|
||||
"287C59474E6BC05D99B2964FA090C3A2233BA186515BE7ED" \
|
||||
"1F612970CEE2D7AFB81BDD762170481CD0069127D5B05AA9" \
|
||||
"93B4EA988D8FDDC186FFB7DC90A6C08F4DF435C934063199" \
|
||||
"FFFFFFFFFFFFFFFF"
|
||||
|
||||
#define MBEDTLS_DHM_RFC3526_MODP_4096_G "02"
|
||||
|
||||
#define MBEDTLS_DHM_RFC5114_MODP_2048_P \
|
||||
"AD107E1E9123A9D0D660FAA79559C51FA20D64E5683B9FD1" \
|
||||
"B54B1597B61D0A75E6FA141DF95A56DBAF9A3C407BA1DF15" \
|
||||
"EB3D688A309C180E1DE6B85A1274A0A66D3F8152AD6AC212" \
|
||||
"9037C9EDEFDA4DF8D91E8FEF55B7394B7AD5B7D0B6C12207" \
|
||||
"C9F98D11ED34DBF6C6BA0B2C8BBC27BE6A00E0A0B9C49708" \
|
||||
"B3BF8A317091883681286130BC8985DB1602E714415D9330" \
|
||||
"278273C7DE31EFDC7310F7121FD5A07415987D9ADC0A486D" \
|
||||
"CDF93ACC44328387315D75E198C641A480CD86A1B9E587E8" \
|
||||
"BE60E69CC928B2B9C52172E413042E9B23F10B0E16E79763" \
|
||||
"C9B53DCF4BA80A29E3FB73C16B8E75B97EF363E2FFA31F71" \
|
||||
"CF9DE5384E71B81C0AC4DFFE0C10E64F"
|
||||
|
||||
#define MBEDTLS_DHM_RFC5114_MODP_2048_G \
|
||||
"AC4032EF4F2D9AE39DF30B5C8FFDAC506CDEBE7B89998CAF"\
|
||||
"74866A08CFE4FFE3A6824A4E10B9A6F0DD921F01A70C4AFA"\
|
||||
"AB739D7700C29F52C57DB17C620A8652BE5E9001A8D66AD7"\
|
||||
"C17669101999024AF4D027275AC1348BB8A762D0521BC98A"\
|
||||
"E247150422EA1ED409939D54DA7460CDB5F6C6B250717CBE"\
|
||||
"F180EB34118E98D119529A45D6F834566E3025E316A330EF"\
|
||||
"BB77A86F0C1AB15B051AE3D428C8F8ACB70A8137150B8EEB"\
|
||||
"10E183EDD19963DDD9E263E4770589EF6AA21E7F5F2FF381"\
|
||||
"B539CCE3409D13CD566AFBB48D6C019181E1BCFE94B30269"\
|
||||
"EDFE72FE9B6AA4BD7B5A0F1C71CFFF4C19C418E1F6EC0179"\
|
||||
"81BC087F2A7065B384B890D3191F2BFA"
|
||||
/**
|
||||
* \deprecated These macros are superseded by direct access to the corresponding
|
||||
* global variables and will be removed in the next major revision.
|
||||
*/
|
||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#define MBEDTLS_DHM_RFC5114_MODP_2048_P mbedtls_dhm_rfc5114_modp_2048_p
|
||||
#define MBEDTLS_DHM_RFC5114_MODP_2048_G mbedtls_dhm_rfc5114_modp_2048_g
|
||||
#define MBEDTLS_DHM_RFC3526_MODP_2048_P mbedtls_dhm_rfc3526_modp_2048_p
|
||||
#define MBEDTLS_DHM_RFC3526_MODP_2048_G mbedtls_dhm_rfc3526_modp_2048_g
|
||||
#define MBEDTLS_DHM_RFC3526_MODP_3072_P mbedtls_dhm_rfc3526_modp_3072_p
|
||||
#define MBEDTLS_DHM_RFC3526_MODP_3072_G mbedtls_dhm_rfc3526_modp_3072_g
|
||||
#define MBEDTLS_DHM_RFC3526_MODP_4096_P mbedtls_dhm_rfc3526_modp_4096_p
|
||||
#define MBEDTLS_DHM_RFC3526_MODP_4096_G mbedtls_dhm_rfc3526_modp_4096_g
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -57,6 +57,103 @@
|
||||
#define mbedtls_free free
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Diffie-Hellman groups from RFC 5114
|
||||
*
|
||||
* \warning The origin of the primes in RFC 5114 is not documented and
|
||||
* their use therefore constitutes a security risk!
|
||||
*
|
||||
* \deprecated The primes from RFC 5114 are superseded by the primes
|
||||
* from RFC 3526 and RFC 7919 and should no longer be used.
|
||||
* They will be removed in the next major version.
|
||||
*/
|
||||
|
||||
const char * mbedtls_dhm_rfc5114_modp_2048_p =
|
||||
"AD107E1E9123A9D0D660FAA79559C51FA20D64E5683B9FD1"
|
||||
"B54B1597B61D0A75E6FA141DF95A56DBAF9A3C407BA1DF15"
|
||||
"EB3D688A309C180E1DE6B85A1274A0A66D3F8152AD6AC212"
|
||||
"9037C9EDEFDA4DF8D91E8FEF55B7394B7AD5B7D0B6C12207"
|
||||
"C9F98D11ED34DBF6C6BA0B2C8BBC27BE6A00E0A0B9C49708"
|
||||
"B3BF8A317091883681286130BC8985DB1602E714415D9330"
|
||||
"278273C7DE31EFDC7310F7121FD5A07415987D9ADC0A486D"
|
||||
"CDF93ACC44328387315D75E198C641A480CD86A1B9E587E8"
|
||||
"BE60E69CC928B2B9C52172E413042E9B23F10B0E16E79763"
|
||||
"C9B53DCF4BA80A29E3FB73C16B8E75B97EF363E2FFA31F71"
|
||||
"CF9DE5384E71B81C0AC4DFFE0C10E64F";
|
||||
const char * mbedtls_dhm_rfc5114_modp_2048_g =
|
||||
"AC4032EF4F2D9AE39DF30B5C8FFDAC506CDEBE7B89998CAF"
|
||||
"74866A08CFE4FFE3A6824A4E10B9A6F0DD921F01A70C4AFA"
|
||||
"AB739D7700C29F52C57DB17C620A8652BE5E9001A8D66AD7"
|
||||
"C17669101999024AF4D027275AC1348BB8A762D0521BC98A"
|
||||
"E247150422EA1ED409939D54DA7460CDB5F6C6B250717CBE"
|
||||
"F180EB34118E98D119529A45D6F834566E3025E316A330EF"
|
||||
"BB77A86F0C1AB15B051AE3D428C8F8ACB70A8137150B8EEB"
|
||||
"10E183EDD19963DDD9E263E4770589EF6AA21E7F5F2FF381"
|
||||
"B539CCE3409D13CD566AFBB48D6C019181E1BCFE94B30269"
|
||||
"EDFE72FE9B6AA4BD7B5A0F1C71CFFF4C19C418E1F6EC0179"
|
||||
"81BC087F2A7065B384B890D3191F2BFA";
|
||||
|
||||
/*
|
||||
* Diffie-Hellman groups from RFC 3526
|
||||
*/
|
||||
|
||||
const char * mbedtls_dhm_rfc3526_modp_2048_p =
|
||||
"FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1"
|
||||
"29024E088A67CC74020BBEA63B139B22514A08798E3404DD"
|
||||
"EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245"
|
||||
"E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED"
|
||||
"EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D"
|
||||
"C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F"
|
||||
"83655D23DCA3AD961C62F356208552BB9ED529077096966D"
|
||||
"670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B"
|
||||
"E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9"
|
||||
"DE2BCBF6955817183995497CEA956AE515D2261898FA0510"
|
||||
"15728E5A8AACAA68FFFFFFFFFFFFFFFF";
|
||||
const char * mbedtls_dhm_rfc3526_modp_2048_g = "02";
|
||||
|
||||
const char * mbedtls_dhm_rfc3526_modp_3072_p =
|
||||
"FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1"
|
||||
"29024E088A67CC74020BBEA63B139B22514A08798E3404DD"
|
||||
"EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245"
|
||||
"E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED"
|
||||
"EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D"
|
||||
"C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F"
|
||||
"83655D23DCA3AD961C62F356208552BB9ED529077096966D"
|
||||
"670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B"
|
||||
"E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9"
|
||||
"DE2BCBF6955817183995497CEA956AE515D2261898FA0510"
|
||||
"15728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64"
|
||||
"ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7"
|
||||
"ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6B"
|
||||
"F12FFA06D98A0864D87602733EC86A64521F2B18177B200C"
|
||||
"BBE117577A615D6C770988C0BAD946E208E24FA074E5AB31"
|
||||
"43DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF";
|
||||
const char * mbedtls_dhm_rfc3526_modp_3072_g = "02";
|
||||
|
||||
const char * mbedtls_dhm_rfc3526_modp_4096_p =
|
||||
"FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1"
|
||||
"29024E088A67CC74020BBEA63B139B22514A08798E3404DD"
|
||||
"EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245"
|
||||
"E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED"
|
||||
"EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D"
|
||||
"C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F"
|
||||
"83655D23DCA3AD961C62F356208552BB9ED529077096966D"
|
||||
"670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B"
|
||||
"E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9"
|
||||
"DE2BCBF6955817183995497CEA956AE515D2261898FA0510"
|
||||
"15728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64"
|
||||
"ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7"
|
||||
"ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6B"
|
||||
"F12FFA06D98A0864D87602733EC86A64521F2B18177B200C"
|
||||
"BBE117577A615D6C770988C0BAD946E208E24FA074E5AB31"
|
||||
"43DB5BFCE0FD108E4B82D120A92108011A723C12A787E6D7"
|
||||
"88719A10BDBA5B2699C327186AF4E23C1A946834B6150BDA"
|
||||
"2583E9CA2AD44CE8DBBBC2DB04DE8EF92E8EFC141FBECAA6"
|
||||
"287C59474E6BC05D99B2964FA090C3A2233BA186515BE7ED"
|
||||
"1F612970CEE2D7AFB81BDD762170481CD0069127D5B05AA9"
|
||||
"93B4EA988D8FDDC186FFB7DC90A6C08F4DF435C934063199"
|
||||
"FFFFFFFFFFFFFFFF";
|
||||
const char * mbedtls_dhm_rfc3526_modp_4096_g = "02";
|
||||
/* Implementation that should never be optimized out by the compiler */
|
||||
static void mbedtls_zeroize( void *v, size_t n ) {
|
||||
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user