diff --git a/library/bignum_mod.c b/library/bignum_mod.c index 38aff9bd46..dfccaf4857 100644 --- a/library/bignum_mod.c +++ b/library/bignum_mod.c @@ -47,10 +47,10 @@ int mbedtls_mpi_mod_residue_setup( mbedtls_mpi_mod_residue *r, mbedtls_mpi_uint *p, size_t pn ) { - if( pn < m->n || !mbedtls_mpi_core_lt_ct( m->p, p, pn ) ) + if( pn < m->limbs || !mbedtls_mpi_core_lt_ct( m->p, p, pn ) ) return( MBEDTLS_ERR_MPI_BAD_INPUT_DATA ); - r->n = m->n; + r->limbs = m->limbs; r->p = p; return( 0 ); @@ -61,7 +61,7 @@ void mbedtls_mpi_mod_residue_release( mbedtls_mpi_mod_residue *r ) if ( r == NULL ) return; - r->n = 0; + r->limbs = 0; r->p = NULL; } @@ -71,8 +71,8 @@ void mbedtls_mpi_mod_modulus_init( mbedtls_mpi_mod_modulus *m ) return; m->p = NULL; - m->n = 0; - m->plen = 0; + m->limbs = 0; + m->bits = 0; m->ext_rep = MBEDTLS_MPI_MOD_EXT_REP_INVALID; m->int_rep = MBEDTLS_MPI_MOD_REP_INVALID; } @@ -95,8 +95,8 @@ void mbedtls_mpi_mod_modulus_free( mbedtls_mpi_mod_modulus *m ) } m->p = NULL; - m->n = 0; - m->plen = 0; + m->limbs = 0; + m->bits = 0; m->ext_rep = MBEDTLS_MPI_MOD_EXT_REP_INVALID; m->int_rep = MBEDTLS_MPI_MOD_REP_INVALID; } @@ -110,8 +110,8 @@ int mbedtls_mpi_mod_modulus_setup( mbedtls_mpi_mod_modulus *m, int ret = 0; m->p = p; - m->n = pn; - m->plen = mbedtls_mpi_core_bitlen( p, pn ); + m->limbs = pn; + m->bits = mbedtls_mpi_core_bitlen( p, pn ); switch( ext_rep ) { diff --git a/library/bignum_mod.h b/library/bignum_mod.h index 2fb520cfb0..3712af0f4b 100644 --- a/library/bignum_mod.h +++ b/library/bignum_mod.h @@ -46,7 +46,7 @@ typedef enum typedef struct { mbedtls_mpi_uint *p; - size_t n; + size_t limbs; } mbedtls_mpi_mod_residue; typedef void *mbedtls_mpi_mont_struct; @@ -54,8 +54,8 @@ typedef void *mbedtls_mpi_opt_red_struct; typedef struct { mbedtls_mpi_uint *p; - size_t n; // number of limbs - size_t plen; // bitlen of 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 diff --git a/library/bignum_mod_raw.c b/library/bignum_mod_raw.c index 4d5fe81bd9..c4a3eb8dca 100644 --- a/library/bignum_mod_raw.c +++ b/library/bignum_mod_raw.c @@ -51,10 +51,10 @@ int mbedtls_mpi_mod_raw_read( mbedtls_mpi_uint *X, switch( m->ext_rep ) { case MBEDTLS_MPI_MOD_EXT_REP_LE: - ret = mbedtls_mpi_core_read_le( X, m->n, buf, buflen ); + ret = mbedtls_mpi_core_read_le( X, m->limbs, buf, buflen ); break; case MBEDTLS_MPI_MOD_EXT_REP_BE: - ret = mbedtls_mpi_core_read_be( X, m->n, buf, buflen ); + ret = mbedtls_mpi_core_read_be( X, m->limbs, buf, buflen ); break; default: return( MBEDTLS_ERR_MPI_BAD_INPUT_DATA ); @@ -63,7 +63,7 @@ int mbedtls_mpi_mod_raw_read( mbedtls_mpi_uint *X, if( ret != 0 ) goto cleanup; - if( !mbedtls_mpi_core_lt_ct( X, m->p, m->n ) ) + if( !mbedtls_mpi_core_lt_ct( X, m->p, m->limbs ) ) { ret = MBEDTLS_ERR_MPI_BAD_INPUT_DATA; goto cleanup; @@ -82,9 +82,9 @@ int mbedtls_mpi_mod_raw_write( mbedtls_mpi_uint *X, switch( m->ext_rep ) { case MBEDTLS_MPI_MOD_EXT_REP_LE: - return( mbedtls_mpi_core_write_le( X, m->n, buf, buflen ) ); + return( mbedtls_mpi_core_write_le( X, m->limbs, buf, buflen ) ); case MBEDTLS_MPI_MOD_EXT_REP_BE: - return( mbedtls_mpi_core_write_be( X, m->n, buf, buflen ) ); + return( mbedtls_mpi_core_write_be( X, m->limbs, buf, buflen ) ); default: return( MBEDTLS_ERR_MPI_BAD_INPUT_DATA ); }