mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-30 22:43:08 +03:00
Bignum: remove unnecessary NULL pointer checks
A null pointer dereference, or null pointer plus small offset, is a clean runtime error in most environments. So it's not particularly useful to protect against this. While at it make a null pointer check that is actually necessary more robust. Signed-off-by: Janos Follath <janos.follath@arm.com>
This commit is contained in:
@ -47,9 +47,6 @@ int mbedtls_mpi_mod_residue_setup( mbedtls_mpi_mod_residue *r,
|
||||
mbedtls_mpi_uint *p,
|
||||
size_t pn )
|
||||
{
|
||||
if( p == NULL || m == NULL || r == NULL )
|
||||
return( MBEDTLS_ERR_MPI_BAD_INPUT_DATA );
|
||||
|
||||
if( pn < m->n || !mbedtls_mpi_core_lt_ct( m->p, p, pn ) )
|
||||
return( MBEDTLS_ERR_MPI_BAD_INPUT_DATA );
|
||||
|
||||
@ -112,9 +109,6 @@ int mbedtls_mpi_mod_modulus_setup( mbedtls_mpi_mod_modulus *m,
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if ( p == NULL || m == NULL )
|
||||
return( MBEDTLS_ERR_MPI_BAD_INPUT_DATA );
|
||||
|
||||
m->p = p;
|
||||
m->n = pn;
|
||||
m->plen = mbedtls_mpi_core_bitlen( p, pn );
|
||||
|
Reference in New Issue
Block a user