mirror of
				https://github.com/Mbed-TLS/mbedtls.git
				synced 2025-10-24 13:32:59 +03:00 
			
		
		
		
	This function has specific code to handle carries and it's not clear how to exercises that code through the modinv function, so well, that's what unit tests are for. Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
		
			
				
	
	
		
			39 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| /**
 | |
|  * \file bignum_core_invasive.h
 | |
|  *
 | |
|  * \brief Function declarations for invasive functions of bignum core.
 | |
|  */
 | |
| /**
 | |
|  *  Copyright The Mbed TLS Contributors
 | |
|  *  SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
 | |
|  */
 | |
| 
 | |
| #ifndef MBEDTLS_BIGNUM_CORE_INVASIVE_H
 | |
| #define MBEDTLS_BIGNUM_CORE_INVASIVE_H
 | |
| 
 | |
| #include "bignum_core.h"
 | |
| 
 | |
| #if defined(MBEDTLS_TEST_HOOKS)
 | |
| 
 | |
| #if !defined(MBEDTLS_THREADING_C)
 | |
| 
 | |
| extern void (*mbedtls_safe_codepath_hook)(void);
 | |
| extern void (*mbedtls_unsafe_codepath_hook)(void);
 | |
| 
 | |
| #endif /* !MBEDTLS_THREADING_C */
 | |
| 
 | |
| /** Divide X by 2 mod N in place, assuming N is odd.
 | |
|  *
 | |
|  * \param[in,out] X     The value to divide by 2 mod \p N.
 | |
|  * \param[in]     N     The modulus. Must be odd.
 | |
|  * \param[in]     limbs The number of limbs in \p X and \p N.
 | |
|  */
 | |
| MBEDTLS_STATIC_TESTABLE
 | |
| void mbedtls_mpi_core_div2_mod_odd(mbedtls_mpi_uint *X,
 | |
|                                    const mbedtls_mpi_uint *N,
 | |
|                                    size_t limbs);
 | |
| 
 | |
| #endif /* MBEDTLS_TEST_HOOKS */
 | |
| 
 | |
| #endif /* MBEDTLS_BIGNUM_CORE_INVASIVE_H */
 |