diff --git a/library/bignum_new.c b/library/bignum_new.c index 3f25fad6ca..51e1416043 100644 --- a/library/bignum_new.c +++ b/library/bignum_new.c @@ -454,10 +454,10 @@ int mbedtls_mpi_mod_raw_read( mbedtls_mpi_uint *X, { int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; - if( m->ext_rep & MBEDTLS_MPI_MOD_EXT_REP_LE ) + if( m->ext_rep == MBEDTLS_MPI_MOD_EXT_REP_LE ) ret = mbedtls_mpi_core_read_le( X, m->n, buf, buflen ); - else if( m->ext_rep & MBEDTLS_MPI_MOD_EXT_REP_BE ) + else if( m->ext_rep == MBEDTLS_MPI_MOD_EXT_REP_BE ) ret = mbedtls_mpi_core_read_be( X, m->n, buf, buflen ); else return( MBEDTLS_ERR_MPI_BAD_INPUT_DATA ); @@ -481,10 +481,10 @@ int mbedtls_mpi_mod_raw_write( mbedtls_mpi_uint *X, unsigned char *buf, size_t buflen ) { - if( m->ext_rep & MBEDTLS_MPI_MOD_EXT_REP_LE ) + if( m->ext_rep == MBEDTLS_MPI_MOD_EXT_REP_LE ) return mbedtls_mpi_core_write_le( X, m->n, buf, buflen ); - else if( m->ext_rep & MBEDTLS_MPI_MOD_EXT_REP_BE ) + else if( m->ext_rep == MBEDTLS_MPI_MOD_EXT_REP_BE ) return mbedtls_mpi_core_write_be( X, m->n, buf, buflen ); else