Fail gracefully upon unexpectedly large input to p25519 reduction
Signed-off-by: Hanno Becker <hanno.becker@arm.com>
This commit is contained in:
parent
bb04cb992f
commit
127fcabb21
1 changed files with 2 additions and 0 deletions
|
@ -5225,6 +5225,8 @@ static int ecp_mod_p255( mbedtls_mpi *N )
|
|||
const size_t NT_n = N->n - P255_WIDTH;
|
||||
if( N->n <= P255_WIDTH )
|
||||
return( 0 );
|
||||
if( NT_n > P255_WIDTH )
|
||||
return( MBEDTLS_ERR_ECP_BAD_INPUT_DATA );
|
||||
|
||||
/* Split N as N + 2^256 M */
|
||||
memset( Mp, 0, sizeof( Mp ) );
|
||||
|
|
Loading…
Reference in a new issue