Fix optionally safe hooks declarations

Signed-off-by: Janos Follath <janos.follath@arm.com>
This commit is contained in:
Janos Follath 2024-08-20 09:56:16 +01:00
parent 9d72df8e6d
commit a11269187e
2 changed files with 7 additions and 2 deletions

View File

@ -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 * This function calculates the indices of the exponent where the exponentiation algorithm should
* start processing. * start processing.

View File

@ -818,9 +818,9 @@ void mbedtls_mpi_core_from_mont_rep(mbedtls_mpi_uint *X,
mbedtls_mpi_uint *T); mbedtls_mpi_uint *T);
#if defined(MBEDTLS_TEST_HOOKS) #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 // 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; mbedtls_mpi_optionally_safe_codepath = MBEDTLS_MPI_IS_PUBLIC + MBEDTLS_MPI_IS_SECRET + 1;