Add FFDH support in client2, server2 applications
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
diff --git a/programs/ssl/ssl_server2.c b/programs/ssl/ssl_server2.c
index 5f8bea9..9919e08 100644
--- a/programs/ssl/ssl_server2.c
+++ b/programs/ssl/ssl_server2.c
@@ -70,6 +70,7 @@
#endif
#include "mbedtls/pk.h"
+#include "mbedtls/dhm.h"
/* Size of memory to be allocated for the heap, when using the library's memory
* management and MBEDTLS_MEMORY_BUFFER_ALLOC_C is enabled. */
@@ -587,7 +588,7 @@
" acceptable ciphersuite names:\n"
#define ALPN_LIST_SIZE 10
-#define CURVE_LIST_SIZE 20
+#define CURVE_LIST_SIZE 25
#define SIG_ALG_LIST_SIZE 5
#define PUT_UINT64_BE(out_be, in_le, i) \
@@ -2401,6 +2402,7 @@
/* Leave room for a final NULL in curve list */
while (i < CURVE_LIST_SIZE - 1 && *p != '\0') {
q = p;
+ uint16_t ffdh_group = 0;
/* Terminate the current string */
while (*p != ',' && *p != '\0') {
@@ -2412,6 +2414,8 @@
if ((curve_cur = mbedtls_ecp_curve_info_from_name(q)) != NULL) {
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 {
mbedtls_printf("unknown curve %s\n", q);
mbedtls_printf("supported curves: ");
@@ -2419,6 +2423,12 @@
curve_cur->grp_id != MBEDTLS_ECP_DP_NONE;
curve_cur++) {
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");
goto exit;