mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-29 11:41:15 +03:00
Bignum Mod Raw: pass endianness as a parameter
The external representation before included more than just endianness (like reading in Mongtomery curve scalars or converting hashes to numbers in a standard compliant way). These are higher level concepts and are out of scope for Bignum and for the modulus structure. Passing endianness as a parameter is a step towards removing it from the modulus structure. Signed-off-by: Janos Follath <janos.follath@arm.com>
This commit is contained in:
@ -52,11 +52,12 @@ void mbedtls_mpi_mod_raw_cond_swap( mbedtls_mpi_uint *X,
|
||||
int mbedtls_mpi_mod_raw_read( mbedtls_mpi_uint *X,
|
||||
const mbedtls_mpi_mod_modulus *m,
|
||||
const unsigned char *input,
|
||||
size_t input_length )
|
||||
size_t input_length,
|
||||
mbedtls_mpi_mod_ext_rep ext_rep )
|
||||
{
|
||||
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
||||
|
||||
switch( m->ext_rep )
|
||||
switch( ext_rep )
|
||||
{
|
||||
case MBEDTLS_MPI_MOD_EXT_REP_LE:
|
||||
ret = mbedtls_mpi_core_read_le( X, m->limbs,
|
||||
@ -87,9 +88,10 @@ cleanup:
|
||||
int mbedtls_mpi_mod_raw_write( const mbedtls_mpi_uint *A,
|
||||
const mbedtls_mpi_mod_modulus *m,
|
||||
unsigned char *output,
|
||||
size_t output_length )
|
||||
size_t output_length,
|
||||
mbedtls_mpi_mod_ext_rep ext_rep )
|
||||
{
|
||||
switch( m->ext_rep )
|
||||
switch( ext_rep )
|
||||
{
|
||||
case MBEDTLS_MPI_MOD_EXT_REP_LE:
|
||||
return( mbedtls_mpi_core_write_le( A, m->limbs,
|
||||
|
Reference in New Issue
Block a user