mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-24 19:43:32 +00:00
For some reason I didn't think about other files in the previous commit. Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
39 lines
993 B
C
39 lines
993 B
C
/** Support for path tracking in optionally safe bignum functions
|
|
*/
|
|
/*
|
|
* Copyright The Mbed TLS Contributors
|
|
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
|
*/
|
|
|
|
#include "test/bignum_codepath_check.h"
|
|
#include "bignum_core_invasive.h"
|
|
|
|
#if defined(MBEDTLS_TEST_HOOKS) && !defined(MBEDTLS_THREADING_C)
|
|
int mbedtls_codepath_check = MBEDTLS_MPI_IS_TEST;
|
|
|
|
void mbedtls_codepath_take_safe(void)
|
|
{
|
|
if (mbedtls_codepath_check == MBEDTLS_MPI_IS_TEST) {
|
|
mbedtls_codepath_check = MBEDTLS_MPI_IS_SECRET;
|
|
}
|
|
}
|
|
|
|
void mbedtls_codepath_take_unsafe(void)
|
|
{
|
|
mbedtls_codepath_check = MBEDTLS_MPI_IS_PUBLIC;
|
|
}
|
|
|
|
void mbedtls_codepath_test_hooks_setup(void)
|
|
{
|
|
mbedtls_safe_codepath_hook = mbedtls_codepath_take_safe;
|
|
mbedtls_unsafe_codepath_hook = mbedtls_codepath_take_unsafe;
|
|
}
|
|
|
|
void mbedtls_codepath_test_hooks_teardown(void)
|
|
{
|
|
mbedtls_safe_codepath_hook = NULL;
|
|
mbedtls_unsafe_codepath_hook = NULL;
|
|
}
|
|
|
|
#endif /* MBEDTLS_TEST_HOOKS && !MBEDTLS_THREADING_C */
|