mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-12-24 17:41:01 +03:00
Merge remote-tracking branch 'development' into HEAD
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
|
||||
@@ -261,15 +261,20 @@ int main(void)
|
||||
#define USAGE_ALPN ""
|
||||
#endif /* MBEDTLS_SSL_ALPN */
|
||||
|
||||
#if defined(MBEDTLS_ECP_LIGHT)
|
||||
#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"
|
||||
#if defined(MBEDTLS_PK_HAVE_ECC_KEYS) || \
|
||||
(defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_SOME_EPHEMERAL_ENABLED) && \
|
||||
defined(PSA_WANT_ALG_FFDH))
|
||||
#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)
|
||||
@@ -437,7 +442,7 @@ int main(void)
|
||||
USAGE_EMS \
|
||||
USAGE_ETM \
|
||||
USAGE_REPRODUCIBLE \
|
||||
USAGE_CURVES \
|
||||
USAGE_GROUPS \
|
||||
USAGE_SIG_ALGS \
|
||||
USAGE_EARLY_DATA \
|
||||
USAGE_DHMLEN \
|
||||
@@ -466,10 +471,6 @@ int main(void)
|
||||
USAGE_SERIALIZATION \
|
||||
"\n"
|
||||
|
||||
#define ALPN_LIST_SIZE 10
|
||||
#define CURVE_LIST_SIZE 20
|
||||
#define SIG_ALG_LIST_SIZE 5
|
||||
|
||||
/*
|
||||
* global options
|
||||
*/
|
||||
@@ -526,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? */
|
||||
@@ -759,11 +760,7 @@ int main(int argc, char *argv[])
|
||||
#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
|
||||
unsigned char alloc_buf[MEMORY_HEAP_SIZE];
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_ECP_LIGHT)
|
||||
uint16_t group_list[CURVE_LIST_SIZE];
|
||||
const mbedtls_ecp_curve_info *curve_cur;
|
||||
#endif
|
||||
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;
|
||||
@@ -924,7 +921,7 @@ int main(int argc, char *argv[])
|
||||
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;
|
||||
@@ -1192,8 +1189,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) {
|
||||
@@ -1521,53 +1518,11 @@ usage:
|
||||
}
|
||||
#endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
|
||||
|
||||
#if defined(MBEDTLS_ECP_LIGHT)
|
||||
if (opt.curves != NULL) {
|
||||
p = (char *) opt.curves;
|
||||
i = 0;
|
||||
|
||||
if (strcmp(p, "none") == 0) {
|
||||
group_list[0] = 0;
|
||||
} else if (strcmp(p, "default") != 0) {
|
||||
/* Leave room for a final NULL in curve list */
|
||||
while (i < CURVE_LIST_SIZE - 1 && *p != '\0') {
|
||||
q = p;
|
||||
|
||||
/* Terminate the current string */
|
||||
while (*p != ',' && *p != '\0') {
|
||||
p++;
|
||||
}
|
||||
if (*p == ',') {
|
||||
*p++ = '\0';
|
||||
}
|
||||
|
||||
if ((curve_cur = mbedtls_ecp_curve_info_from_name(q)) != NULL) {
|
||||
group_list[i++] = curve_cur->tls_id;
|
||||
} else {
|
||||
mbedtls_printf("unknown curve %s\n", q);
|
||||
mbedtls_printf("supported curves: ");
|
||||
for (curve_cur = mbedtls_ecp_curve_list();
|
||||
curve_cur->grp_id != MBEDTLS_ECP_DP_NONE;
|
||||
curve_cur++) {
|
||||
mbedtls_printf("%s ", curve_cur->name);
|
||||
}
|
||||
mbedtls_printf("\n");
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
mbedtls_printf("Number of curves: %d\n", i);
|
||||
|
||||
if (i == CURVE_LIST_SIZE - 1 && *p != '\0') {
|
||||
mbedtls_printf("curves list too long, maximum %d",
|
||||
CURVE_LIST_SIZE - 1);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
group_list[i] = 0;
|
||||
if (opt.groups != NULL) {
|
||||
if (parse_groups(opt.groups, group_list, GROUP_LIST_SIZE) != 0) {
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
#endif /* MBEDTLS_ECP_LIGHT */
|
||||
|
||||
#if defined(MBEDTLS_SSL_HANDSHAKE_WITH_CERT_ENABLED)
|
||||
if (opt.sig_algs != NULL) {
|
||||
@@ -1970,9 +1925,11 @@ usage:
|
||||
}
|
||||
#endif /* MBEDTLS_SSL_HANDSHAKE_WITH_CERT_ENABLED */
|
||||
|
||||
#if defined(MBEDTLS_ECP_LIGHT)
|
||||
if (opt.curves != NULL &&
|
||||
strcmp(opt.curves, "default") != 0) {
|
||||
#if defined(MBEDTLS_PK_HAVE_ECC_KEYS) || \
|
||||
(defined(MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_SOME_EPHEMERAL_ENABLED) && \
|
||||
defined(PSA_WANT_ALG_FFDH))
|
||||
if (opt.groups != NULL &&
|
||||
strcmp(opt.groups, "default") != 0) {
|
||||
mbedtls_ssl_conf_groups(&conf, group_list);
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user