Rename structure elements
Use better names for structure elements and adopting the convention of
the other modules.
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
diff --git a/library/bignum_mod.c b/library/bignum_mod.c
index 38aff9b..dfccaf4 100644
--- a/library/bignum_mod.c
+++ b/library/bignum_mod.c
@@ -47,10 +47,10 @@
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 @@
if ( r == NULL )
return;
- r->n = 0;
+ r->limbs = 0;
r->p = NULL;
}
@@ -71,8 +71,8 @@
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 @@
}
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 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 2fb520c..3712af0 100644
--- a/library/bignum_mod.h
+++ b/library/bignum_mod.h
@@ -46,7 +46,7 @@
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 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 4d5fe81..c4a3eb8 100644
--- a/library/bignum_mod_raw.c
+++ b/library/bignum_mod_raw.c
@@ -51,10 +51,10 @@
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 @@
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 @@
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 );
}