From 19779c47397f68837566d7f051fb8aaa17f34792 Mon Sep 17 00:00:00 2001 From: Ron Eldor Date: Mon, 5 Nov 2018 16:58:13 +0200 Subject: [PATCH] Some style and documentation fixes 1. Change description of of hte `MBEDTLS_ECP_RESTARTABLE` in the configuration file. 2. Change check for compilation of `rs_ctx` to positive flow. --- include/mbedtls/config.h | 5 +++-- library/ecdh.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/mbedtls/config.h b/include/mbedtls/config.h index c594b6944..950319a10 100644 --- a/include/mbedtls/config.h +++ b/include/mbedtls/config.h @@ -695,8 +695,9 @@ * * Uncomment this macro to enable restartable ECC computations. * - * \note MBEDTLS_ECP_RESTARTABLE cannot be defined if there is an alternative - * implementation for one of the ECP, ECDSA or ECDH functions. * + * \note This option only works with the default software implementation of + * elliptic curve functionality. It is incompatible with + * MBEDTLS_ECP_ALT, MBEDTLS_ECDH_xxx_ALT and MBEDTLS_ECDSA_xxx_ALT. */ //#define MBEDTLS_ECP_RESTARTABLE diff --git a/library/ecdh.c b/library/ecdh.c index b7e25dcc9..307ee1fb2 100644 --- a/library/ecdh.c +++ b/library/ecdh.c @@ -191,14 +191,14 @@ int mbedtls_ecdh_make_params( mbedtls_ecdh_context *ctx, size_t *olen, { int ret; size_t grp_len, pt_len; -#if !defined(MBEDTLS_ECDH_GEN_PUBLIC_ALT) +#if defined(MBEDTLS_ECP_RESTARTABLE) mbedtls_ecp_restart_ctx *rs_ctx = NULL; #endif if( ctx == NULL || ctx->grp.pbits == 0 ) return( MBEDTLS_ERR_ECP_BAD_INPUT_DATA ); -#if defined(MBEDTLS_ECP_RESTARTABLE) && !defined(MBEDTLS_ECDH_GEN_PUBLIC_ALT) +#if defined(MBEDTLS_ECP_RESTARTABLE) if( ctx->restart_enabled ) rs_ctx = &ctx->rs; #endif