From 782c2b9f362adfd1fa1d61cdfa957f2d18a53280 Mon Sep 17 00:00:00 2001 From: kXuan Date: Wed, 2 Jun 2021 16:53:42 +0800 Subject: [PATCH] fix comment, ChangeLog & migration-guide for MBEDTLS_ECP_FIXED_POINT_OPTIM Signed-off-by: kXuan --- ChangeLog.d/issue4128.txt | 6 +++--- .../modify_MBEDTLS_ECP_FIXED_POINT_OPTIM_behaviour.md | 11 +++++++---- include/mbedtls/ecp.h | 7 ++++--- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/ChangeLog.d/issue4128.txt b/ChangeLog.d/issue4128.txt index 421740397d..bc41874fd4 100644 --- a/ChangeLog.d/issue4128.txt +++ b/ChangeLog.d/issue4128.txt @@ -1,4 +1,4 @@ API changes - * The option `MBEDTLS_ECP_FIXED_POINT_OPTIM` use pre-computed comb tables - instead of computing tables in runtime. Thus, this option now use more - ROM, and it does not increase RAM usage in runtime anymore. + * The option MBEDTLS_ECP_FIXED_POINT_OPTIM use pre-computed comb tables + instead of computing tables in runtime. Thus, this option now increase + code size, and it does not increase RAM usage in runtime anymore. diff --git a/docs/3.0-migration-guide.d/modify_MBEDTLS_ECP_FIXED_POINT_OPTIM_behaviour.md b/docs/3.0-migration-guide.d/modify_MBEDTLS_ECP_FIXED_POINT_OPTIM_behaviour.md index 02a083c44b..91bec7269d 100644 --- a/docs/3.0-migration-guide.d/modify_MBEDTLS_ECP_FIXED_POINT_OPTIM_behaviour.md +++ b/docs/3.0-migration-guide.d/modify_MBEDTLS_ECP_FIXED_POINT_OPTIM_behaviour.md @@ -1,8 +1,11 @@ Change MBEDTLS_ECP_FIXED_POINT_OPTIM behaviour ------------------------------------------------------ -The option MBEDTLS_ECP_FIXED_POINT_OPTIM now use more ROM and does not increase -peak RAM usage anymore. +The option `MBEDTLS_ECP_FIXED_POINT_OPTIM` now increase code size and it does +not increase peak RAM usage anymore. + +If you are limited by code size, you can define `MBEDTLS_ECP_FIXED_POINT_OPTIM` +to `0` in your config file. The impact depends on the number and size of +enabled curves. For example, for P-256 the difference is 1KB; see the documentation +of this option for details. -If you are limited by ROM space, you can define MBEDTLS_ECP_FIXED_POINT_OPTIM -to `0` in your config file. This will save about 50 KiB ROM space. diff --git a/include/mbedtls/ecp.h b/include/mbedtls/ecp.h index 0c351fae12..f53a828971 100644 --- a/include/mbedtls/ecp.h +++ b/include/mbedtls/ecp.h @@ -276,15 +276,16 @@ mbedtls_ecp_group; #if !defined(MBEDTLS_ECP_FIXED_POINT_OPTIM) /* - * Trade ROM usage for speed on fixed-point multiplication. + * Trade code size for speed on fixed-point multiplication. * * This speeds up repeated multiplication of the generator (that is, the * multiplication in ECDSA signatures, and half of the multiplications in * ECDSA verification and ECDHE) by a factor roughly 3 to 4. * - * The cost is increasing ROM usage by a factor roughly 2. + * For each n-bit Short Weierstrass curve that is enabled, this adds 4n bytes + * of code size if n < 384 and 8n otherwise. * - * Change this value to 0 to reduce ROM usage. + * Change this value to 0 to reduce code size. */ #define MBEDTLS_ECP_FIXED_POINT_OPTIM 1 /**< Enable fixed-point speed-up. */ #endif /* MBEDTLS_ECP_FIXED_POINT_OPTIM */