xref: /optee_os/lib/libmbedtls/mbedtls/library/bignum_core_invasive.h (revision 19116a65b6728f04be40b827236dce7a34da49e1)
1 /**
2  * \file bignum_core_invasive.h
3  *
4  * \brief Function declarations for invasive functions of bignum core.
5  */
6 /**
7  *  Copyright The Mbed TLS Contributors
8  *  SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
9  */
10 
11 #ifndef MBEDTLS_BIGNUM_CORE_INVASIVE_H
12 #define MBEDTLS_BIGNUM_CORE_INVASIVE_H
13 
14 #include "bignum_core.h"
15 
16 #if defined(MBEDTLS_TEST_HOOKS)
17 
18 #if !defined(MBEDTLS_THREADING_C)
19 
20 extern void (*mbedtls_safe_codepath_hook)(void);
21 extern void (*mbedtls_unsafe_codepath_hook)(void);
22 
23 #endif /* !MBEDTLS_THREADING_C */
24 
25 /** Divide X by 2 mod N in place, assuming N is odd.
26  *
27  * \param[in,out] X     The value to divide by 2 mod \p N.
28  * \param[in]     N     The modulus. Must be odd.
29  * \param[in]     limbs The number of limbs in \p X and \p N.
30  */
31 MBEDTLS_STATIC_TESTABLE
32 void mbedtls_mpi_core_div2_mod_odd(mbedtls_mpi_uint *X,
33                                    const mbedtls_mpi_uint *N,
34                                    size_t limbs);
35 
36 #endif /* MBEDTLS_TEST_HOOKS */
37 
38 #endif /* MBEDTLS_BIGNUM_CORE_INVASIVE_H */
39