mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-02-19 00:40:14 +00:00
Add FFDH support in client2, server2 applications
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
This commit is contained in:
parent
c89f3ea9f2
commit
6d7da5ee1e
@ -25,6 +25,8 @@
|
|||||||
#include "test/psa_crypto_helpers.h"
|
#include "test/psa_crypto_helpers.h"
|
||||||
#endif /* MBEDTLS_USE_PSA_CRYPTO || MBEDTLS_SSL_PROTO_TLS1_3 */
|
#endif /* MBEDTLS_USE_PSA_CRYPTO || MBEDTLS_SSL_PROTO_TLS1_3 */
|
||||||
|
|
||||||
|
#include "mbedtls/dhm.h"
|
||||||
|
|
||||||
#if defined(MBEDTLS_SSL_TEST_IMPOSSIBLE)
|
#if defined(MBEDTLS_SSL_TEST_IMPOSSIBLE)
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
@ -467,7 +469,7 @@ int main(void)
|
|||||||
" acceptable ciphersuite names:\n"
|
" acceptable ciphersuite names:\n"
|
||||||
|
|
||||||
#define ALPN_LIST_SIZE 10
|
#define ALPN_LIST_SIZE 10
|
||||||
#define CURVE_LIST_SIZE 20
|
#define CURVE_LIST_SIZE 25
|
||||||
#define SIG_ALG_LIST_SIZE 5
|
#define SIG_ALG_LIST_SIZE 5
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1508,6 +1510,7 @@ usage:
|
|||||||
/* Leave room for a final NULL in curve list */
|
/* Leave room for a final NULL in curve list */
|
||||||
while (i < CURVE_LIST_SIZE - 1 && *p != '\0') {
|
while (i < CURVE_LIST_SIZE - 1 && *p != '\0') {
|
||||||
q = p;
|
q = p;
|
||||||
|
uint16_t ffdh_group = 0;
|
||||||
|
|
||||||
/* Terminate the current string */
|
/* Terminate the current string */
|
||||||
while (*p != ',' && *p != '\0') {
|
while (*p != ',' && *p != '\0') {
|
||||||
@ -1519,6 +1522,8 @@ usage:
|
|||||||
|
|
||||||
if ((curve_cur = mbedtls_ecp_curve_info_from_name(q)) != NULL) {
|
if ((curve_cur = mbedtls_ecp_curve_info_from_name(q)) != NULL) {
|
||||||
group_list[i++] = curve_cur->tls_id;
|
group_list[i++] = curve_cur->tls_id;
|
||||||
|
} else if ((ffdh_group = mbedtls_ssl_ffdh_group_from_name(q)) != 0) {
|
||||||
|
group_list[i++] = ffdh_group;
|
||||||
} else {
|
} else {
|
||||||
mbedtls_printf("unknown curve %s\n", q);
|
mbedtls_printf("unknown curve %s\n", q);
|
||||||
mbedtls_printf("supported curves: ");
|
mbedtls_printf("supported curves: ");
|
||||||
@ -1527,6 +1532,12 @@ usage:
|
|||||||
curve_cur++) {
|
curve_cur++) {
|
||||||
mbedtls_printf("%s ", curve_cur->name);
|
mbedtls_printf("%s ", curve_cur->name);
|
||||||
}
|
}
|
||||||
|
uint16_t *supported_ffdh_group = mbedtls_ssl_ffdh_supported_groups();
|
||||||
|
while (*supported_ffdh_group != 0) {
|
||||||
|
mbedtls_printf("%s ",
|
||||||
|
mbedtls_ssl_ffdh_name_from_group(*supported_ffdh_group));
|
||||||
|
supported_ffdh_group++;
|
||||||
|
}
|
||||||
mbedtls_printf("\n");
|
mbedtls_printf("\n");
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -70,6 +70,7 @@ int main(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "mbedtls/pk.h"
|
#include "mbedtls/pk.h"
|
||||||
|
#include "mbedtls/dhm.h"
|
||||||
|
|
||||||
/* Size of memory to be allocated for the heap, when using the library's memory
|
/* Size of memory to be allocated for the heap, when using the library's memory
|
||||||
* management and MBEDTLS_MEMORY_BUFFER_ALLOC_C is enabled. */
|
* management and MBEDTLS_MEMORY_BUFFER_ALLOC_C is enabled. */
|
||||||
@ -587,7 +588,7 @@ int main(void)
|
|||||||
" acceptable ciphersuite names:\n"
|
" acceptable ciphersuite names:\n"
|
||||||
|
|
||||||
#define ALPN_LIST_SIZE 10
|
#define ALPN_LIST_SIZE 10
|
||||||
#define CURVE_LIST_SIZE 20
|
#define CURVE_LIST_SIZE 25
|
||||||
#define SIG_ALG_LIST_SIZE 5
|
#define SIG_ALG_LIST_SIZE 5
|
||||||
|
|
||||||
#define PUT_UINT64_BE(out_be, in_le, i) \
|
#define PUT_UINT64_BE(out_be, in_le, i) \
|
||||||
@ -2401,6 +2402,7 @@ usage:
|
|||||||
/* Leave room for a final NULL in curve list */
|
/* Leave room for a final NULL in curve list */
|
||||||
while (i < CURVE_LIST_SIZE - 1 && *p != '\0') {
|
while (i < CURVE_LIST_SIZE - 1 && *p != '\0') {
|
||||||
q = p;
|
q = p;
|
||||||
|
uint16_t ffdh_group = 0;
|
||||||
|
|
||||||
/* Terminate the current string */
|
/* Terminate the current string */
|
||||||
while (*p != ',' && *p != '\0') {
|
while (*p != ',' && *p != '\0') {
|
||||||
@ -2412,6 +2414,8 @@ usage:
|
|||||||
|
|
||||||
if ((curve_cur = mbedtls_ecp_curve_info_from_name(q)) != NULL) {
|
if ((curve_cur = mbedtls_ecp_curve_info_from_name(q)) != NULL) {
|
||||||
group_list[i++] = curve_cur->tls_id;
|
group_list[i++] = curve_cur->tls_id;
|
||||||
|
} else if ((ffdh_group = mbedtls_ssl_ffdh_group_from_name(q)) != 0) {
|
||||||
|
group_list[i++] = ffdh_group;
|
||||||
} else {
|
} else {
|
||||||
mbedtls_printf("unknown curve %s\n", q);
|
mbedtls_printf("unknown curve %s\n", q);
|
||||||
mbedtls_printf("supported curves: ");
|
mbedtls_printf("supported curves: ");
|
||||||
@ -2419,6 +2423,12 @@ usage:
|
|||||||
curve_cur->grp_id != MBEDTLS_ECP_DP_NONE;
|
curve_cur->grp_id != MBEDTLS_ECP_DP_NONE;
|
||||||
curve_cur++) {
|
curve_cur++) {
|
||||||
mbedtls_printf("%s ", curve_cur->name);
|
mbedtls_printf("%s ", curve_cur->name);
|
||||||
|
uint16_t *supported_ffdh_group = mbedtls_ssl_ffdh_supported_groups();
|
||||||
|
while (*supported_ffdh_group != 0) {
|
||||||
|
mbedtls_printf("%s ",
|
||||||
|
mbedtls_ssl_ffdh_name_from_group(*supported_ffdh_group));
|
||||||
|
supported_ffdh_group++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
mbedtls_printf("\n");
|
mbedtls_printf("\n");
|
||||||
goto exit;
|
goto exit;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user