mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-28 00:21:48 +03:00
Implement and test mbedtls_mpi_mod_raw_random
In the basic/XXX=core test cases, use odd upper bounds, because the mod version of random() only supports odd upper bounds (the upper bound is a modulus and the mod modules only support odd moduli). Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
@ -176,6 +176,18 @@ void mbedtls_mpi_mod_raw_add( mbedtls_mpi_uint *X,
|
||||
|
||||
/* BEGIN MERGE SLOT 6 */
|
||||
|
||||
int mbedtls_mpi_mod_raw_random( mbedtls_mpi_uint *X,
|
||||
mbedtls_mpi_uint min,
|
||||
const mbedtls_mpi_mod_modulus *N,
|
||||
int (*f_rng)(void *, unsigned char *, size_t),
|
||||
void *p_rng )
|
||||
{
|
||||
int ret = mbedtls_mpi_core_random( X, min, N->p, N->limbs, f_rng, p_rng );
|
||||
if( ret != 0 )
|
||||
return( ret );
|
||||
return( mbedtls_mpi_mod_raw_to_mont_rep( X, N ) );
|
||||
}
|
||||
|
||||
/* END MERGE SLOT 6 */
|
||||
|
||||
/* BEGIN MERGE SLOT 7 */
|
||||
|
Reference in New Issue
Block a user