Bignum: make const placement consistent
Signed-off-by: Janos Follath <janos.follath@arm.com>
This commit is contained in:
parent
ed5c8d3d1e
commit
620c58ced9
2 changed files with 4 additions and 4 deletions
|
@ -660,7 +660,7 @@ int mbedtls_mpi_read_binary_le( mbedtls_mpi *X,
|
||||||
const unsigned char *buf, size_t buflen )
|
const unsigned char *buf, size_t buflen )
|
||||||
{
|
{
|
||||||
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
||||||
size_t const limbs = CHARS_TO_LIMBS( buflen );
|
const size_t limbs = CHARS_TO_LIMBS( buflen );
|
||||||
|
|
||||||
/* Ensure that target MPI has exactly the necessary number of limbs */
|
/* Ensure that target MPI has exactly the necessary number of limbs */
|
||||||
MBEDTLS_MPI_CHK( mbedtls_mpi_resize_clear( X, limbs ) );
|
MBEDTLS_MPI_CHK( mbedtls_mpi_resize_clear( X, limbs ) );
|
||||||
|
@ -686,7 +686,7 @@ cleanup:
|
||||||
int mbedtls_mpi_read_binary( mbedtls_mpi *X, const unsigned char *buf, size_t buflen )
|
int mbedtls_mpi_read_binary( mbedtls_mpi *X, const unsigned char *buf, size_t buflen )
|
||||||
{
|
{
|
||||||
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
||||||
size_t const limbs = CHARS_TO_LIMBS( buflen );
|
const size_t limbs = CHARS_TO_LIMBS( buflen );
|
||||||
|
|
||||||
MPI_VALIDATE_RET( X != NULL );
|
MPI_VALIDATE_RET( X != NULL );
|
||||||
MPI_VALIDATE_RET( buflen == 0 || buf != NULL );
|
MPI_VALIDATE_RET( buflen == 0 || buf != NULL );
|
||||||
|
@ -2139,7 +2139,7 @@ int mbedtls_mpi_fill_random( mbedtls_mpi *X, size_t size,
|
||||||
void *p_rng )
|
void *p_rng )
|
||||||
{
|
{
|
||||||
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
||||||
size_t const limbs = CHARS_TO_LIMBS( size );
|
const size_t limbs = CHARS_TO_LIMBS( size );
|
||||||
|
|
||||||
MPI_VALIDATE_RET( X != NULL );
|
MPI_VALIDATE_RET( X != NULL );
|
||||||
MPI_VALIDATE_RET( f_rng != NULL );
|
MPI_VALIDATE_RET( f_rng != NULL );
|
||||||
|
|
|
@ -185,7 +185,7 @@ int mbedtls_mpi_core_read_be( mbedtls_mpi_uint *X,
|
||||||
const unsigned char *buf,
|
const unsigned char *buf,
|
||||||
size_t buflen )
|
size_t buflen )
|
||||||
{
|
{
|
||||||
size_t const limbs = CHARS_TO_LIMBS( buflen );
|
const size_t limbs = CHARS_TO_LIMBS( buflen );
|
||||||
|
|
||||||
if( nx < limbs )
|
if( nx < limbs )
|
||||||
return( MBEDTLS_ERR_MPI_BUFFER_TOO_SMALL );
|
return( MBEDTLS_ERR_MPI_BUFFER_TOO_SMALL );
|
||||||
|
|
Loading…
Reference in a new issue