diff --git a/include/mbedtls/check_config.h b/include/mbedtls/check_config.h index 8495ef26b..6fe6d52f9 100644 --- a/include/mbedtls/check_config.h +++ b/include/mbedtls/check_config.h @@ -150,12 +150,12 @@ #error "MBEDTLS_GCM_C defined, but not all prerequisites" #endif -#if defined(MBEDTLS_ECP_ALT_INIT) && !defined(MBEDTLS_ECP_FUNCTION_ALT) -#error "MBEDTLS_ECP_ALT_INIT defined, but not all prerequisites" +#if defined(MBEDTLS_ECP_INIT_ALT) && !defined(MBEDTLS_ECP_FUNCTION_ALT) +#error "MBEDTLS_ECP_INIT_ALT defined, but not all prerequisites" #endif -#if defined(MBEDTLS_ECP_ALT_DEINIT) && !defined(MBEDTLS_ECP_FUNCTION_ALT) -#error "MBEDTLS_ECP_ALT_DEINIT defined, but not all prerequisites" +#if defined(MBEDTLS_ECP_DEINIT_ALT) && !defined(MBEDTLS_ECP_FUNCTION_ALT) +#error "MBEDTLS_ECP_DEINIT_ALT defined, but not all prerequisites" #endif #if defined(MBEDTLS_ECP_RANDOMIZE_JAC_ALT) && !defined(MBEDTLS_ECP_FUNCTION_ALT) diff --git a/include/mbedtls/config.h b/include/mbedtls/config.h index d2c96539f..8d943916c 100644 --- a/include/mbedtls/config.h +++ b/include/mbedtls/config.h @@ -314,12 +314,12 @@ * The functions: * int ecp_alt_init( const mbedtls_ecp_group *grp ) * void ecp_alt_deinit( const mbedtls_ecp_group *grp ) - * can be enabled by MBEDTLS_ECP_ALT_INIT and MBEDTLS_ECP_ALT_DEINIT. + * can be enabled by MBEDTLS_ECP_INIT_ALT and MBEDTLS_ECP_DEINIT_ALT. * They are called before and after each point operation and provide an * opportunity to implement optimized set up and tear down instructions. * * Example: In case you uncomment MBEDTLS_ECP_FUNCTION_ALT and - * MBEDTLS_ECP_DOUBLE_JAC, mbed TLS will still provide the ecp_double_jac + * MBEDTLS_ECP_DOUBLE_JAC_ALT, mbed TLS will still provide the ecp_double_jac * function, but will use your ecp_double_jac_alt if the group is supported * (your ecp_alt_grp_capable function returns 1 when receives it as an * argument). If the group is not supported then the original implementation is @@ -334,8 +334,8 @@ /* Required for all the functions in this section */ //#define MBEDTLS_ECP_FUNCTION_ALT /* Utility functions for setup and cleanup */ -//#define MBEDTLS_ECP_ALT_INIT -//#define MBEDTLS_ECP_ALT_DEINIT +//#define MBEDTLS_ECP_INIT_ALT +//#define MBEDTLS_ECP_DEINIT_ALT /* Support for Weierstrass curves with Jacobi representation */ //#define MBEDTLS_ECP_RANDOMIZE_JAC_ALT //#define MBEDTLS_ECP_ADD_MIXED_ALT diff --git a/include/mbedtls/ecp_internal.h b/include/mbedtls/ecp_internal.h index 835b0cc51..67a3de2c6 100644 --- a/include/mbedtls/ecp_internal.h +++ b/include/mbedtls/ecp_internal.h @@ -29,12 +29,13 @@ unsigned char ecp_alt_grp_capable( const mbedtls_ecp_group *grp ); -#if defined(MBEDTLS_ECP_ALT_INIT) +#if defined(MBEDTLS_ECP_INIT_ALT) int ecp_alt_init( const mbedtls_ecp_group *grp ); #endif -#if defined(MBEDTLS_ECP_ALT_DEINIT) +#if defined(MBEDTLS_ECP_DEINIT_ALT) void ecp_alt_deinit( const mbedtls_ecp_group *grp ); +#endif #if defined(MBEDTLS_ECP_RANDOMIZE_JAC_ALT) int ecp_randomize_jac_alt( const mbedtls_ecp_group *grp, mbedtls_ecp_point *pt, diff --git a/library/ecp.c b/library/ecp.c index 610198304..7f48e38ab 100644 --- a/library/ecp.c +++ b/library/ecp.c @@ -1685,7 +1685,7 @@ int mbedtls_ecp_mul( mbedtls_ecp_group *grp, mbedtls_ecp_point *R, ( ret = mbedtls_ecp_check_pubkey( grp, P ) ) != 0 ) return( ret ); -#if defined(MBEDTLS_ECP_ALT_INIT) +#if defined(MBEDTLS_ECP_INIT_ALT) if ( ecp_alt_grp_capable( grp ) ) { MBEDTLS_MPI_CHK( ecp_alt_init( grp ) ); @@ -1702,11 +1702,11 @@ int mbedtls_ecp_mul( mbedtls_ecp_group *grp, mbedtls_ecp_point *R, ret = ecp_mul_comb( grp, R, m, P, f_rng, p_rng ); #endif -#if defined(MBEDTLS_ECP_ALT_INIT) +#if defined(MBEDTLS_ECP_INIT_ALT) cleanup: #endif -#if defined(MBEDTLS_ECP_ALT_DEINIT) +#if defined(MBEDTLS_ECP_DEINIT_ALT) if ( ecp_alt_grp_capable( grp ) ) { ecp_alt_deinit( grp ); @@ -1815,7 +1815,7 @@ int mbedtls_ecp_muladd( mbedtls_ecp_group *grp, mbedtls_ecp_point *R, MBEDTLS_MPI_CHK( mbedtls_ecp_mul_shortcuts( grp, &mP, m, P ) ); MBEDTLS_MPI_CHK( mbedtls_ecp_mul_shortcuts( grp, R, n, Q ) ); -#if defined(MBEDTLS_ECP_ALT_INIT) +#if defined(MBEDTLS_ECP_INIT_ALT) if ( ecp_alt_grp_capable( grp ) ) { MBEDTLS_MPI_CHK( ecp_alt_init( grp ) ); @@ -1826,7 +1826,7 @@ int mbedtls_ecp_muladd( mbedtls_ecp_group *grp, mbedtls_ecp_point *R, cleanup: -#if defined(MBEDTLS_ECP_ALT_DEINIT) +#if defined(MBEDTLS_ECP_DEINIT_ALT) if ( ecp_alt_grp_capable( grp ) ) { ecp_alt_deinit( grp );