From 360e2c41d8211e43ed2a729e4947db6f9d050c31 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Fri, 24 Jul 2020 02:03:20 +0200 Subject: [PATCH] List Montgomery curves in mbedtls_ecp_curve_list() mbedtls_ecp_curve_list() now lists Curve25519 and Curve448 under the names "x25519" and "x448". These curves support ECDH but not ECDSA. This was meant ever since the introduction of mbedtls_ecdsa_can_do() in 0082f9df6f26b982f74a3301399f66ba7a6eb039, but 2c69d10bac678d0d86615de3d01b3d5bbb4b8c45 had removed the claim that Montgomery curves support ECDH except through Everest. Signed-off-by: Gilles Peskine --- ChangeLog.d/ecp_curve_list.txt | 5 +++++ library/ecp.c | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 ChangeLog.d/ecp_curve_list.txt diff --git a/ChangeLog.d/ecp_curve_list.txt b/ChangeLog.d/ecp_curve_list.txt new file mode 100644 index 000000000..55745d38d --- /dev/null +++ b/ChangeLog.d/ecp_curve_list.txt @@ -0,0 +1,5 @@ +Bugfix + * mbedtls_ecp_curve_list() now lists Curve25519 and Curve448 under the names + "x25519" and "x448". These curves support ECDH but not ECDSA. If you need + only the curves that support ECDSA, filter the list with + mbedtls_ecdsa_can_do(). diff --git a/library/ecp.c b/library/ecp.c index 5d00de5cf..05a0b0175 100644 --- a/library/ecp.c +++ b/library/ecp.c @@ -546,8 +546,11 @@ static const mbedtls_ecp_curve_info ecp_supported_curves[] = #if defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED) { MBEDTLS_ECP_DP_SECP192K1, 18, 192, "secp192k1" }, #endif -#if defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED) && defined(MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED) +#if defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED) { MBEDTLS_ECP_DP_CURVE25519, 29, 256, "x25519" }, +#endif +#if defined(MBEDTLS_ECP_DP_CURVE448_ENABLED) + { MBEDTLS_ECP_DP_CURVE448, 30, 448, "x448" }, #endif { MBEDTLS_ECP_DP_NONE, 0, 0, NULL }, };