Remove local MPI from ecp_normalize_jac_many()
Signed-off-by: Hanno Becker <hanno.becker@arm.com>
This commit is contained in:
parent
838b715fcc
commit
02a999b91a
1 changed files with 7 additions and 7 deletions
|
@ -1279,7 +1279,7 @@ static int ecp_normalize_jac_many( const mbedtls_ecp_group *grp,
|
||||||
#else
|
#else
|
||||||
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
||||||
size_t i;
|
size_t i;
|
||||||
mbedtls_mpi *c, u, Zi, ZZi;
|
mbedtls_mpi *c, u, Zi;
|
||||||
|
|
||||||
if( ( c = mbedtls_calloc( T_size, sizeof( mbedtls_mpi ) ) ) == NULL )
|
if( ( c = mbedtls_calloc( T_size, sizeof( mbedtls_mpi ) ) ) == NULL )
|
||||||
return( MBEDTLS_ERR_ECP_ALLOC_FAILED );
|
return( MBEDTLS_ERR_ECP_ALLOC_FAILED );
|
||||||
|
@ -1287,7 +1287,7 @@ static int ecp_normalize_jac_many( const mbedtls_ecp_group *grp,
|
||||||
for( i = 0; i < T_size; i++ )
|
for( i = 0; i < T_size; i++ )
|
||||||
mbedtls_mpi_init( &c[i] );
|
mbedtls_mpi_init( &c[i] );
|
||||||
|
|
||||||
mbedtls_mpi_init( &u ); mbedtls_mpi_init( &Zi ); mbedtls_mpi_init( &ZZi );
|
mbedtls_mpi_init( &u ); mbedtls_mpi_init( &Zi );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* c[i] = Z_0 * ... * Z_i
|
* c[i] = Z_0 * ... * Z_i
|
||||||
|
@ -1322,10 +1322,10 @@ static int ecp_normalize_jac_many( const mbedtls_ecp_group *grp,
|
||||||
/*
|
/*
|
||||||
* proceed as in normalize()
|
* proceed as in normalize()
|
||||||
*/
|
*/
|
||||||
MPI_ECP_MUL( &ZZi, &Zi, &Zi );
|
MPI_ECP_MUL( &T[i]->Y, &T[i]->Y, &Zi );
|
||||||
MPI_ECP_MUL( &T[i]->X, &T[i]->X, &ZZi );
|
MPI_ECP_MUL( &Zi, &Zi, &Zi );
|
||||||
MPI_ECP_MUL( &T[i]->Y, &T[i]->Y, &ZZi );
|
MPI_ECP_MUL( &T[i]->X, &T[i]->X, &Zi );
|
||||||
MPI_ECP_MUL( &T[i]->Y, &T[i]->Y, &Zi );
|
MPI_ECP_MUL( &T[i]->Y, &T[i]->Y, &Zi );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Post-precessing: reclaim some memory by shrinking coordinates
|
* Post-precessing: reclaim some memory by shrinking coordinates
|
||||||
|
@ -1343,7 +1343,7 @@ static int ecp_normalize_jac_many( const mbedtls_ecp_group *grp,
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
|
||||||
mbedtls_mpi_free( &u ); mbedtls_mpi_free( &Zi ); mbedtls_mpi_free( &ZZi );
|
mbedtls_mpi_free( &u ); mbedtls_mpi_free( &Zi );
|
||||||
for( i = 0; i < T_size; i++ )
|
for( i = 0; i < T_size; i++ )
|
||||||
mbedtls_mpi_free( &c[i] );
|
mbedtls_mpi_free( &c[i] );
|
||||||
mbedtls_free( c );
|
mbedtls_free( c );
|
||||||
|
|
Loading…
Reference in a new issue