From e9a1a7add5e10660cb168b8453702a26ef1db5e1 Mon Sep 17 00:00:00 2001 From: Jiang Guang Ming Date: Wed, 2 Aug 2023 17:56:02 +0800 Subject: [PATCH] feat(mbedtls): support ecp fixed-point multiplication configurable --- components/mbedtls/Kconfig | 10 ++++++++++ .../mbedtls/port/include/mbedtls/esp_config.h | 13 +++++++++++++ 2 files changed, 23 insertions(+) diff --git a/components/mbedtls/Kconfig b/components/mbedtls/Kconfig index b76e29a4d9..34d5f79013 100644 --- a/components/mbedtls/Kconfig +++ b/components/mbedtls/Kconfig @@ -982,6 +982,16 @@ menu "mbedTLS" Disabling this option saves some code size. + config MBEDTLS_ECP_FIXED_POINT_OPTIM + bool "Enable fixed-point multiplication optimisations" + depends on MBEDTLS_ECP_C + default y + help + This configuration option enables optimizations to speedup (about 3 ~ 4 times) the ECP + fixed point multiplication using pre-computed tables in the flash memory. + Disabling this configuration option saves flash footprint (about 29KB if all Elliptic Curve selected) + in the application binary. + # end of Elliptic Curve options config MBEDTLS_POLY1305_C diff --git a/components/mbedtls/port/include/mbedtls/esp_config.h b/components/mbedtls/port/include/mbedtls/esp_config.h index 4cc3b2d4a7..8e9b48edf2 100644 --- a/components/mbedtls/port/include/mbedtls/esp_config.h +++ b/components/mbedtls/port/include/mbedtls/esp_config.h @@ -488,6 +488,19 @@ #undef MBEDTLS_ECP_NIST_OPTIM #endif +/** + * \def MBEDTLS_ECP_FIXED_POINT_OPTIM + * + * Enable speed up fixed-point multiplication. + * + * Comment this macro to disable FIXED POINT curves optimisation. + */ +#ifdef CONFIG_MBEDTLS_ECP_FIXED_POINT_OPTIM +#define MBEDTLS_ECP_FIXED_POINT_OPTIM 1 +#else +#define MBEDTLS_ECP_FIXED_POINT_OPTIM 0 +#endif + /** * \def MBEDTLS_ECDSA_DETERMINISTIC *