mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-29 11:41:15 +03:00
Bignum Mod: remove endianness from modulus
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. Signed-off-by: Janos Follath <janos.follath@arm.com>
This commit is contained in:
@ -65,7 +65,6 @@ void mbedtls_mpi_mod_modulus_init( mbedtls_mpi_mod_modulus *m )
|
||||
m->p = NULL;
|
||||
m->limbs = 0;
|
||||
m->bits = 0;
|
||||
m->ext_rep = MBEDTLS_MPI_MOD_EXT_REP_INVALID;
|
||||
m->int_rep = MBEDTLS_MPI_MOD_REP_INVALID;
|
||||
}
|
||||
|
||||
@ -96,7 +95,6 @@ void mbedtls_mpi_mod_modulus_free( mbedtls_mpi_mod_modulus *m )
|
||||
m->p = NULL;
|
||||
m->limbs = 0;
|
||||
m->bits = 0;
|
||||
m->ext_rep = MBEDTLS_MPI_MOD_EXT_REP_INVALID;
|
||||
m->int_rep = MBEDTLS_MPI_MOD_REP_INVALID;
|
||||
}
|
||||
|
||||
@ -138,7 +136,6 @@ cleanup:
|
||||
int mbedtls_mpi_mod_modulus_setup( mbedtls_mpi_mod_modulus *m,
|
||||
const mbedtls_mpi_uint *p,
|
||||
size_t p_limbs,
|
||||
mbedtls_mpi_mod_ext_rep ext_rep,
|
||||
mbedtls_mpi_mod_rep_selector int_rep )
|
||||
{
|
||||
int ret = 0;
|
||||
@ -147,17 +144,6 @@ int mbedtls_mpi_mod_modulus_setup( mbedtls_mpi_mod_modulus *m,
|
||||
m->limbs = p_limbs;
|
||||
m->bits = mbedtls_mpi_core_bitlen( p, p_limbs );
|
||||
|
||||
switch( ext_rep )
|
||||
{
|
||||
case MBEDTLS_MPI_MOD_EXT_REP_LE:
|
||||
case MBEDTLS_MPI_MOD_EXT_REP_BE:
|
||||
m->ext_rep = ext_rep;
|
||||
break;
|
||||
default:
|
||||
ret = MBEDTLS_ERR_MPI_BAD_INPUT_DATA;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
switch( int_rep )
|
||||
{
|
||||
case MBEDTLS_MPI_MOD_REP_MONTGOMERY:
|
||||
|
@ -64,7 +64,6 @@ typedef struct {
|
||||
const mbedtls_mpi_uint *p;
|
||||
size_t limbs; // number of limbs
|
||||
size_t bits; // bitlen of p
|
||||
mbedtls_mpi_mod_ext_rep ext_rep; // signals external representation (eg. byte order)
|
||||
mbedtls_mpi_mod_rep_selector int_rep; // selector to signal the active member of the union
|
||||
union rep
|
||||
{
|
||||
@ -122,8 +121,6 @@ void mbedtls_mpi_mod_modulus_init( mbedtls_mpi_mod_modulus *m );
|
||||
* not be modified in any way until after
|
||||
* mbedtls_mpi_mod_modulus_free() is called.
|
||||
* \param p_limbs The number of limbs of \p p.
|
||||
* \param ext_rep The external representation to be used for residues
|
||||
* associated with \p m (see #mbedtls_mpi_mod_ext_rep).
|
||||
* \param int_rep The internal representation to be used for residues
|
||||
* associated with \p m (see #mbedtls_mpi_mod_rep_selector).
|
||||
*
|
||||
@ -134,7 +131,6 @@ void mbedtls_mpi_mod_modulus_init( mbedtls_mpi_mod_modulus *m );
|
||||
int mbedtls_mpi_mod_modulus_setup( mbedtls_mpi_mod_modulus *m,
|
||||
const mbedtls_mpi_uint *p,
|
||||
size_t p_limbs,
|
||||
mbedtls_mpi_mod_ext_rep ext_rep,
|
||||
mbedtls_mpi_mod_rep_selector int_rep );
|
||||
|
||||
/** Free elements of a modulus structure.
|
||||
|
Reference in New Issue
Block a user