mbedtls_mpi_read_binary() document that function guarantees to return an MPI with exactly the necessary number of limbs and remove redundant call to mbedtls_mpi_grow()
Signed-off-by: Przemyslaw Stekiel <przemyslaw.stekiel@mobica.com>
This commit is contained in:
parent
aeaa4f0651
commit
76960a7217
2 changed files with 6 additions and 1 deletions
|
@ -785,6 +785,9 @@ static void mpi_bigendian_to_host( mbedtls_mpi_uint * const p, size_t limbs )
|
|||
|
||||
/*
|
||||
* Import X from unsigned binary data, little endian
|
||||
*
|
||||
* This function is guaranteed to return an MPI with exactly the necessary
|
||||
* number of limbs (in particular, it does not skip 0s in the input).
|
||||
*/
|
||||
int mbedtls_mpi_read_binary_le( mbedtls_mpi *X,
|
||||
const unsigned char *buf, size_t buflen )
|
||||
|
@ -811,6 +814,9 @@ cleanup:
|
|||
|
||||
/*
|
||||
* Import X from unsigned binary data, big endian
|
||||
*
|
||||
* This function is guaranteed to return an MPI with exactly the necessary
|
||||
* number of limbs (in particular, it does not skip 0s in the input).
|
||||
*/
|
||||
int mbedtls_mpi_read_binary( mbedtls_mpi *X, const unsigned char *buf, size_t buflen )
|
||||
{
|
||||
|
|
|
@ -4934,7 +4934,6 @@ static psa_status_t psa_generate_derived_ecc_key_weierstrass_helper(
|
|||
* Result of comparison is returned. When it indicates error
|
||||
* then this fuction is called again.
|
||||
*/
|
||||
MBEDTLS_MPI_CHK( mbedtls_mpi_grow( &k, diff_N_2.n ) );
|
||||
MBEDTLS_MPI_CHK( mbedtls_mpi_lt_mpi_ct( &diff_N_2, &k, &key_out_of_range ) );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue