From a11269187ec25aded7de8c002e75c7fa231d7c09 Mon Sep 17 00:00:00 2001 From: Janos Follath Date: Tue, 20 Aug 2024 09:56:16 +0100 Subject: [PATCH] Fix optionally safe hooks declarations Signed-off-by: Janos Follath --- library/bignum_core.c | 5 +++++ library/bignum_core.h | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/library/bignum_core.c b/library/bignum_core.c index 150bc766b2..463f145148 100644 --- a/library/bignum_core.c +++ b/library/bignum_core.c @@ -746,6 +746,11 @@ static void exp_mod_precompute_window(const mbedtls_mpi_uint *A, } } +#if defined(MBEDTLS_TEST_HOOKS) +// Set to a default that is neither MBEDTLS_MPI_IS_PUBLIC nor MBEDTLS_MPI_IS_SECRET +int mbedtls_mpi_optionally_safe_codepath = MBEDTLS_MPI_IS_PUBLIC + MBEDTLS_MPI_IS_SECRET + 1; +#endif + /* * This function calculates the indices of the exponent where the exponentiation algorithm should * start processing. diff --git a/library/bignum_core.h b/library/bignum_core.h index 50c53e6c39..ff6360b3e7 100644 --- a/library/bignum_core.h +++ b/library/bignum_core.h @@ -818,9 +818,9 @@ void mbedtls_mpi_core_from_mont_rep(mbedtls_mpi_uint *X, mbedtls_mpi_uint *T); #if defined(MBEDTLS_TEST_HOOKS) -int mbedtls_mpi_optionally_safe_codepath; +extern int mbedtls_mpi_optionally_safe_codepath; -static inline void mbedtls_mpi_optionally_safe_codepath_reset() +static inline void mbedtls_mpi_optionally_safe_codepath_reset(void) { // Set to a default that is neither MBEDTLS_MPI_IS_PUBLIC nor MBEDTLS_MPI_IS_SECRET mbedtls_mpi_optionally_safe_codepath = MBEDTLS_MPI_IS_PUBLIC + MBEDTLS_MPI_IS_SECRET + 1;