Bignum: make modulus value const

The modulus value won't change during normal operations, make this clear
in the struct and the function signatures.

This won't prevent the caller from modifying the passed buffer, but
might give a hint and reinforces the message of the documentation.

Signed-off-by: Janos Follath <janos.follath@arm.com>
This commit is contained in:
Janos Follath 2022-08-15 11:50:22 +01:00
parent 138f51c5c8
commit ed5c8d3d1e
2 changed files with 3 additions and 3 deletions

View file

@ -102,7 +102,7 @@ void mbedtls_mpi_mod_modulus_free( mbedtls_mpi_mod_modulus *m )
}
int mbedtls_mpi_mod_modulus_setup( mbedtls_mpi_mod_modulus *m,
mbedtls_mpi_uint *p,
const mbedtls_mpi_uint *p,
size_t pn,
mbedtls_mpi_mod_ext_rep ext_rep,
mbedtls_mpi_mod_rep_selector int_rep )

View file

@ -53,7 +53,7 @@ typedef void *mbedtls_mpi_mont_struct;
typedef void *mbedtls_mpi_opt_red_struct;
typedef struct {
mbedtls_mpi_uint *p;
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)
@ -122,7 +122,7 @@ void mbedtls_mpi_mod_modulus_init( mbedtls_mpi_mod_modulus *m );
* invalid.
*/
int mbedtls_mpi_mod_modulus_setup( mbedtls_mpi_mod_modulus *m,
mbedtls_mpi_uint *p,
const mbedtls_mpi_uint *p,
size_t pn,
mbedtls_mpi_mod_ext_rep ext_rep,
mbedtls_mpi_mod_rep_selector int_rep );