mbedtls_mpi_core_get_mont_R2_unsafe: Removed NULL input checking
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
diff --git a/library/bignum_core.c b/library/bignum_core.c
index a3547bd..ad22a15 100644
--- a/library/bignum_core.c
+++ b/library/bignum_core.c
@@ -516,8 +516,6 @@
{
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
- if ( X == NULL || N == NULL ) goto cleanup;
-
MBEDTLS_MPI_CHK( mbedtls_mpi_lset( X, 1 ) );
MBEDTLS_MPI_CHK( mbedtls_mpi_shift_l( X, N->n * 2 * biL ) );
MBEDTLS_MPI_CHK( mbedtls_mpi_mod_mpi( X, X, N ) );
diff --git a/library/bignum_core.h b/library/bignum_core.h
index d46aea3..9870da4 100644
--- a/library/bignum_core.h
+++ b/library/bignum_core.h
@@ -426,8 +426,7 @@
* to store the value of Montgomery constant squared.
* \return #MBEDTLS_ERR_MPI_DIVISION_BY_ZERO if \p N modulus is zero.
* \return #MBEDTLS_ERR_MPI_NEGATIVE_VALUE if \p N modulus is negative.
- * \return #MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED \p N, \p X are NULL
- * or other operations fail.
+ * \return #MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED if other operations fail.
*/
int mbedtls_mpi_core_get_mont_R2_unsafe( mbedtls_mpi *X,
mbedtls_mpi const *N );
diff --git a/tests/suites/test_suite_bignum.function b/tests/suites/test_suite_bignum.function
index 6b59a51..b598ea6 100644
--- a/tests/suites/test_suite_bignum.function
+++ b/tests/suites/test_suite_bignum.function
@@ -4,7 +4,6 @@
#include "mbedtls/entropy.h"
#include "constant_time_internal.h"
#include "test/constant_flow.h"
-#include "mbedtls/error.h"
#if MBEDTLS_MPI_MAX_BITS > 792
#define MPI_MAX_BITS_LARGER_THAN_792
@@ -1424,13 +1423,6 @@
mbedtls_mpi_init( &RR );
const char * n = "7ffffffffffffff1";
- /* Test for NULL input pointers */
- TEST_EQUAL( MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED,
- mbedtls_mpi_core_get_mont_R2_unsafe( NULL, &N ) );
-
- TEST_EQUAL( MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED,
- mbedtls_mpi_core_get_mont_R2_unsafe( &RR, NULL ) );
-
/* Test for zero divisor */
TEST_EQUAL( MBEDTLS_ERR_MPI_DIVISION_BY_ZERO,
mbedtls_mpi_core_get_mont_R2_unsafe( &RR, &N ) );