Improve coding style
Co-authored-by: Tom Cosgrove <81633263+tom-cosgrove-arm@users.noreply.github.com> Co-authored-by: Werner Lewis <werner.wmlewis@gmail.com> Signed-off-by: Janos Follath <janos.follath@arm.com>
This commit is contained in:
parent
b7a88eca42
commit
ca5688e10c
@ -712,7 +712,7 @@ cleanup:
|
||||
int mbedtls_mpi_write_binary_le( const mbedtls_mpi *X,
|
||||
unsigned char *buf, size_t buflen )
|
||||
{
|
||||
return( mbedtls_mpi_core_write_le( X->p, X->n, buf, buflen) );
|
||||
return( mbedtls_mpi_core_write_le( X->p, X->n, buf, buflen ) );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -174,7 +174,10 @@ int mbedtls_mpi_core_read_le( mbedtls_mpi_uint *X,
|
||||
memset( X, 0, X_limbs * ciL );
|
||||
|
||||
for( size_t i = 0; i < input_length; i++ )
|
||||
X[i / ciL] |= ((mbedtls_mpi_uint) input[i]) << ((i % ciL) << 3);
|
||||
{
|
||||
size_t offset = ( ( i % ciL ) << 3 );
|
||||
X[i / ciL] |= ( (mbedtls_mpi_uint) input[i] ) << offset;
|
||||
}
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
|
@ -141,9 +141,9 @@ int mbedtls_mpi_core_write_be( const mbedtls_mpi_uint *A,
|
||||
unsigned char *output,
|
||||
size_t output_length );
|
||||
|
||||
#define ciL (sizeof(mbedtls_mpi_uint)) /* chars in limb */
|
||||
#define biL (ciL << 3) /* bits in limb */
|
||||
#define biH (ciL << 2) /* half limb size */
|
||||
#define ciL ( sizeof(mbedtls_mpi_uint) ) /* chars in limb */
|
||||
#define biL ( ciL << 3 ) /* bits in limb */
|
||||
#define biH ( ciL << 2 ) /* half limb size */
|
||||
|
||||
/*
|
||||
* Convert between bits/chars and number of limbs
|
||||
@ -153,6 +153,6 @@ int mbedtls_mpi_core_write_be( const mbedtls_mpi_uint *A,
|
||||
#define CHARS_TO_LIMBS(i) ( (i) / ciL + ( (i) % ciL != 0 ) )
|
||||
/* Get a specific byte, without range checks. */
|
||||
#define GET_BYTE( X, i ) \
|
||||
( ( ( X )[( i ) / ciL] >> ( ( ( i ) % ciL ) * 8 ) ) & 0xff )
|
||||
( ( (X)[(i) / ciL] >> ( ( (i) % ciL ) * 8 ) ) & 0xff )
|
||||
|
||||
#endif /* MBEDTLS_BIGNUM_CORE_H */
|
||||
|
Loading…
Reference in New Issue
Block a user