mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-08 17:42:09 +03:00
Adapt names (curves -> groups)
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
This commit is contained in:
@@ -95,7 +95,7 @@ int main(void)
|
||||
#define DFL_RECONNECT_HARD 0
|
||||
#define DFL_TICKETS MBEDTLS_SSL_SESSION_TICKETS_ENABLED
|
||||
#define DFL_ALPN_STRING NULL
|
||||
#define DFL_CURVES NULL
|
||||
#define DFL_GROUPS NULL
|
||||
#define DFL_SIG_ALGS NULL
|
||||
#define DFL_TRANSPORT MBEDTLS_SSL_TRANSPORT_STREAM
|
||||
#define DFL_HS_TO_MIN 0
|
||||
@@ -264,14 +264,17 @@ int main(void)
|
||||
#if defined(MBEDTLS_ECP_LIGHT) || \
|
||||
(defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_SOME_EPHEMERAL_ENABLED) && \
|
||||
defined(PSA_WANT_ALG_FFDH))
|
||||
#define USAGE_CURVES \
|
||||
" curves=a,b,c,d default: \"default\" (library default)\n" \
|
||||
" example: \"secp521r1,brainpoolP512r1\"\n" \
|
||||
" - use \"none\" for empty list\n" \
|
||||
" - see mbedtls_ecp_curve_list()\n" \
|
||||
" for acceptable curve names\n"
|
||||
#define USAGE_GROUPS \
|
||||
" groups=a,b,c,d default: \"default\" (library default)\n" \
|
||||
" example: \"secp521r1,brainpoolP512r1\"\n" \
|
||||
" - use \"none\" for empty list\n" \
|
||||
" - see mbedtls_ecp_curve_list()\n" \
|
||||
" for acceptable EC group names\n" \
|
||||
" - the following ffdh groups are supported:\n" \
|
||||
" ffdhe2048, ffdhe3072, ffdhe4096, ffdhe6144,\n" \
|
||||
" ffdhe8192\n"
|
||||
#else
|
||||
#define USAGE_CURVES ""
|
||||
#define USAGE_GROUPS ""
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_SSL_HANDSHAKE_WITH_CERT_ENABLED)
|
||||
@@ -439,7 +442,7 @@ int main(void)
|
||||
USAGE_EMS \
|
||||
USAGE_ETM \
|
||||
USAGE_REPRODUCIBLE \
|
||||
USAGE_CURVES \
|
||||
USAGE_GROUPS \
|
||||
USAGE_SIG_ALGS \
|
||||
USAGE_EARLY_DATA \
|
||||
USAGE_DHMLEN \
|
||||
@@ -524,7 +527,7 @@ struct options {
|
||||
int reco_mode; /* how to keep the session around */
|
||||
int reconnect_hard; /* unexpectedly reconnect from the same port */
|
||||
int tickets; /* enable / disable session tickets */
|
||||
const char *curves; /* list of supported elliptic curves */
|
||||
const char *groups; /* list of supported groups */
|
||||
const char *sig_algs; /* supported TLS 1.3 signature algorithms */
|
||||
const char *alpn_string; /* ALPN supported protocols */
|
||||
int transport; /* TLS or DTLS? */
|
||||
@@ -757,7 +760,7 @@ int main(int argc, char *argv[])
|
||||
#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
|
||||
unsigned char alloc_buf[MEMORY_HEAP_SIZE];
|
||||
#endif
|
||||
uint16_t group_list[CURVE_LIST_SIZE];
|
||||
uint16_t group_list[GROUP_LIST_SIZE];
|
||||
#if defined(MBEDTLS_SSL_DTLS_SRTP)
|
||||
unsigned char mki[MBEDTLS_TLS_SRTP_MAX_MKI_LENGTH];
|
||||
size_t mki_len = 0;
|
||||
@@ -943,7 +946,7 @@ usage:
|
||||
opt.reconnect_hard = DFL_RECONNECT_HARD;
|
||||
opt.tickets = DFL_TICKETS;
|
||||
opt.alpn_string = DFL_ALPN_STRING;
|
||||
opt.curves = DFL_CURVES;
|
||||
opt.groups = DFL_GROUPS;
|
||||
opt.sig_algs = DFL_SIG_ALGS;
|
||||
#if defined(MBEDTLS_SSL_EARLY_DATA)
|
||||
opt.early_data = DFL_EARLY_DATA;
|
||||
@@ -1166,8 +1169,8 @@ usage:
|
||||
break;
|
||||
default: goto usage;
|
||||
}
|
||||
} else if (strcmp(p, "curves") == 0) {
|
||||
opt.curves = q;
|
||||
} else if (strcmp(p, "groups") == 0) {
|
||||
opt.groups = q;
|
||||
}
|
||||
#if defined(MBEDTLS_SSL_HANDSHAKE_WITH_CERT_ENABLED)
|
||||
else if (strcmp(p, "sig_algs") == 0) {
|
||||
@@ -1491,8 +1494,8 @@ usage:
|
||||
}
|
||||
#endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
|
||||
|
||||
if (opt.curves != NULL) {
|
||||
if (parse_curves(opt.curves, group_list, CURVE_LIST_SIZE) != 0) {
|
||||
if (opt.groups != NULL) {
|
||||
if (parse_groups(opt.groups, group_list, GROUP_LIST_SIZE) != 0) {
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
@@ -1901,8 +1904,8 @@ usage:
|
||||
#if defined(MBEDTLS_ECP_LIGHT) || \
|
||||
(defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_SOME_EPHEMERAL_ENABLED) && \
|
||||
defined(PSA_WANT_ALG_FFDH))
|
||||
if (opt.curves != NULL &&
|
||||
strcmp(opt.curves, "default") != 0) {
|
||||
if (opt.groups != NULL &&
|
||||
strcmp(opt.groups, "default") != 0) {
|
||||
mbedtls_ssl_conf_groups(&conf, group_list);
|
||||
}
|
||||
#endif
|
||||
|
@@ -133,7 +133,7 @@ int main(void)
|
||||
#define DFL_CACHE_REMOVE 0
|
||||
#define DFL_SNI NULL
|
||||
#define DFL_ALPN_STRING NULL
|
||||
#define DFL_CURVES NULL
|
||||
#define DFL_GROUPS NULL
|
||||
#define DFL_MAX_EARLY_DATA_SIZE 0
|
||||
#define DFL_SIG_ALGS NULL
|
||||
#define DFL_DHM_FILE NULL
|
||||
@@ -449,14 +449,17 @@ int main(void)
|
||||
#if defined(MBEDTLS_ECP_LIGHT) || \
|
||||
(defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_SOME_EPHEMERAL_ENABLED) && \
|
||||
defined(PSA_WANT_ALG_FFDH))
|
||||
#define USAGE_CURVES \
|
||||
" curves=a,b,c,d default: \"default\" (library default)\n" \
|
||||
#define USAGE_GROUPS \
|
||||
" groups=a,b,c,d default: \"default\" (library default)\n" \
|
||||
" example: \"secp521r1,brainpoolP512r1\"\n" \
|
||||
" - use \"none\" for empty list\n" \
|
||||
" - see mbedtls_ecp_curve_list()\n" \
|
||||
" for acceptable curve names\n"
|
||||
" - see mbedtls_ecp_curve_list()\n" \
|
||||
" for acceptable EC group names\n" \
|
||||
" - the following ffdh groups are supported:\n" \
|
||||
" ffdhe2048, ffdhe3072, ffdhe4096, ffdhe6144,\n" \
|
||||
" ffdhe8192\n"
|
||||
#else
|
||||
#define USAGE_CURVES ""
|
||||
#define USAGE_GROUPS ""
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_SSL_HANDSHAKE_WITH_CERT_ENABLED)
|
||||
@@ -560,7 +563,7 @@ int main(void)
|
||||
USAGE_ALPN \
|
||||
USAGE_EMS \
|
||||
USAGE_ETM \
|
||||
USAGE_CURVES \
|
||||
USAGE_GROUPS \
|
||||
USAGE_SIG_ALGS \
|
||||
USAGE_KEY_OPAQUE_ALGS \
|
||||
"\n"
|
||||
@@ -672,7 +675,7 @@ struct options {
|
||||
#endif
|
||||
int cache_remove; /* enable / disable cache entry removal */
|
||||
char *sni; /* string describing sni information */
|
||||
const char *curves; /* list of supported elliptic curves */
|
||||
const char *groups; /* list of supported groups */
|
||||
const char *sig_algs; /* supported TLS 1.3 signature algorithms */
|
||||
const char *alpn_string; /* ALPN supported protocols */
|
||||
const char *dhm_file; /* the file with the DH parameters */
|
||||
@@ -1522,7 +1525,7 @@ int main(int argc, char *argv[])
|
||||
#if defined(SNI_OPTION)
|
||||
sni_entry *sni_info = NULL;
|
||||
#endif
|
||||
uint16_t group_list[CURVE_LIST_SIZE];
|
||||
uint16_t group_list[GROUP_LIST_SIZE];
|
||||
#if defined(MBEDTLS_SSL_ALPN)
|
||||
const char *alpn_list[ALPN_LIST_SIZE];
|
||||
#endif
|
||||
@@ -1733,7 +1736,7 @@ usage:
|
||||
opt.cache_remove = DFL_CACHE_REMOVE;
|
||||
opt.sni = DFL_SNI;
|
||||
opt.alpn_string = DFL_ALPN_STRING;
|
||||
opt.curves = DFL_CURVES;
|
||||
opt.groups = DFL_GROUPS;
|
||||
opt.max_early_data_size = DFL_MAX_EARLY_DATA_SIZE;
|
||||
opt.sig_algs = DFL_SIG_ALGS;
|
||||
opt.dhm_file = DFL_DHM_FILE;
|
||||
@@ -1913,8 +1916,8 @@ usage:
|
||||
goto usage;
|
||||
}
|
||||
opt.force_ciphersuite[1] = 0;
|
||||
} else if (strcmp(p, "curves") == 0) {
|
||||
opt.curves = q;
|
||||
} else if (strcmp(p, "groups") == 0) {
|
||||
opt.groups = q;
|
||||
}
|
||||
#if defined(MBEDTLS_SSL_HANDSHAKE_WITH_CERT_ENABLED)
|
||||
else if (strcmp(p, "sig_algs") == 0) {
|
||||
@@ -2386,8 +2389,8 @@ usage:
|
||||
}
|
||||
#endif /* MBEDTLS_SSL_HANDSHAKE_WITH_PSK_ENABLED */
|
||||
|
||||
if (opt.curves != NULL) {
|
||||
if (parse_curves(opt.curves, group_list, CURVE_LIST_SIZE) != 0) {
|
||||
if (opt.groups != NULL) {
|
||||
if (parse_groups(opt.groups, group_list, GROUP_LIST_SIZE) != 0) {
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
@@ -3095,8 +3098,8 @@ usage:
|
||||
#if defined(MBEDTLS_ECP_LIGHT) || \
|
||||
(defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_SOME_EPHEMERAL_ENABLED) && \
|
||||
defined(PSA_WANT_ALG_FFDH))
|
||||
if (opt.curves != NULL &&
|
||||
strcmp(opt.curves, "default") != 0) {
|
||||
if (opt.groups != NULL &&
|
||||
strcmp(opt.groups, "default") != 0) {
|
||||
mbedtls_ssl_conf_groups(&conf, group_list);
|
||||
}
|
||||
#endif
|
||||
|
@@ -508,9 +508,9 @@ static inline const char *mbedtls_ssl_ffdh_name_from_group(uint16_t group)
|
||||
}
|
||||
#endif /* MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_SOME_EPHEMERAL_ENABLED && PSA_WANT_ALG_FFDH */
|
||||
|
||||
int parse_curves(const char *curves, uint16_t *group_list, size_t group_list_len)
|
||||
int parse_groups(const char *groups, uint16_t *group_list, size_t group_list_len)
|
||||
{
|
||||
char *p = (char *) curves;
|
||||
char *p = (char *) groups;
|
||||
char *q = NULL;
|
||||
size_t i = 0;
|
||||
|
||||
@@ -570,10 +570,10 @@ int parse_curves(const char *curves, uint16_t *group_list, size_t group_list_len
|
||||
}
|
||||
}
|
||||
|
||||
mbedtls_printf("Number of curves: %u\n", (unsigned int) i);
|
||||
mbedtls_printf("Number of groups: %u\n", (unsigned int) i);
|
||||
|
||||
if (i == group_list_len - 1 && *p != '\0') {
|
||||
mbedtls_printf("curves list too long, maximum %u",
|
||||
mbedtls_printf("groups list too long, maximum %u",
|
||||
(unsigned int) (group_list_len - 1));
|
||||
return -1;
|
||||
}
|
||||
|
@@ -81,7 +81,7 @@
|
||||
#include "../test/query_config.h"
|
||||
|
||||
#define ALPN_LIST_SIZE 10
|
||||
#define CURVE_LIST_SIZE 25
|
||||
#define GROUP_LIST_SIZE 25
|
||||
#define SIG_ALG_LIST_SIZE 5
|
||||
|
||||
typedef struct eap_tls_keys {
|
||||
@@ -312,7 +312,7 @@ void test_hooks_free(void);
|
||||
#endif /* !MBEDTLS_TEST_HOOKS */
|
||||
|
||||
/* Helper functions for FFDH groups. */
|
||||
int parse_curves(const char *curves, uint16_t *group_list, size_t group_list_len);
|
||||
int parse_groups(const char *curves, uint16_t *group_list, size_t group_list_len);
|
||||
|
||||
#endif /* MBEDTLS_SSL_TEST_IMPOSSIBLE conditions: else */
|
||||
#endif /* MBEDTLS_PROGRAMS_SSL_SSL_TEST_LIB_H */
|
||||
|
Reference in New Issue
Block a user