mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-02-24 20:16:57 +00:00
Give a constant a name
This commit is contained in:
parent
fc3e0beabf
commit
67c83fb871
|
@ -1334,6 +1334,7 @@ static int ecp_precompute_comb( const mbedtls_ecp_group *grp,
|
||||||
int ret;
|
int ret;
|
||||||
unsigned char i;
|
unsigned char i;
|
||||||
size_t j;
|
size_t j;
|
||||||
|
const unsigned char T_len = 1U << ( w - 1 );
|
||||||
mbedtls_ecp_point *cur, *TT[COMB_MAX_PRE - 1];
|
mbedtls_ecp_point *cur, *TT[COMB_MAX_PRE - 1];
|
||||||
|
|
||||||
#if defined(MBEDTLS_ECP_EARLY_RETURN)
|
#if defined(MBEDTLS_ECP_EARLY_RETURN)
|
||||||
|
@ -1351,7 +1352,7 @@ static int ecp_precompute_comb( const mbedtls_ecp_group *grp,
|
||||||
*/
|
*/
|
||||||
MBEDTLS_MPI_CHK( mbedtls_ecp_copy( &T[0], P ) );
|
MBEDTLS_MPI_CHK( mbedtls_ecp_copy( &T[0], P ) );
|
||||||
|
|
||||||
for( i = 1; i < ( 1U << ( w - 1 ) ); i <<= 1 )
|
for( i = 1; i < T_len; i <<= 1 )
|
||||||
{
|
{
|
||||||
cur = T + i;
|
cur = T + i;
|
||||||
MBEDTLS_MPI_CHK( mbedtls_ecp_copy( cur, T + ( i >> 1 ) ) );
|
MBEDTLS_MPI_CHK( mbedtls_ecp_copy( cur, T + ( i >> 1 ) ) );
|
||||||
|
@ -1364,7 +1365,7 @@ static int ecp_precompute_comb( const mbedtls_ecp_group *grp,
|
||||||
* use an auxiliary array of pointers to elements in T.
|
* use an auxiliary array of pointers to elements in T.
|
||||||
*/
|
*/
|
||||||
j = 0;
|
j = 0;
|
||||||
for( i = 1; i < ( 1U << ( w - 1 ) ); i <<= 1 )
|
for( i = 1; i < T_len; i <<= 1 )
|
||||||
TT[j++] = T + i;
|
TT[j++] = T + i;
|
||||||
|
|
||||||
MBEDTLS_MPI_CHK( ecp_normalize_jac_many( grp, TT, j ) );
|
MBEDTLS_MPI_CHK( ecp_normalize_jac_many( grp, TT, j ) );
|
||||||
|
@ -1373,7 +1374,7 @@ static int ecp_precompute_comb( const mbedtls_ecp_group *grp,
|
||||||
* Compute the remaining ones using the minimal number of additions
|
* Compute the remaining ones using the minimal number of additions
|
||||||
* Be careful to update T[2^l] only after using it!
|
* Be careful to update T[2^l] only after using it!
|
||||||
*/
|
*/
|
||||||
for( i = 1; i < ( 1U << ( w - 1 ) ); i <<= 1 )
|
for( i = 1; i < T_len; i <<= 1 )
|
||||||
{
|
{
|
||||||
j = i;
|
j = i;
|
||||||
while( j-- )
|
while( j-- )
|
||||||
|
@ -1383,9 +1384,9 @@ static int ecp_precompute_comb( const mbedtls_ecp_group *grp,
|
||||||
/*
|
/*
|
||||||
* Normalize final elements in T. Even though there are no holes now,
|
* Normalize final elements in T. Even though there are no holes now,
|
||||||
* we still need the auxiliary array for homogeneity with last time.
|
* we still need the auxiliary array for homogeneity with last time.
|
||||||
* Also skip T[0] which is already normalised, being a copy of P.
|
* Also, skip T[0] which is already normalised, being a copy of P.
|
||||||
*/
|
*/
|
||||||
for( j = 0; j + 1 < ( 1U << ( w - 1 ) ); j++ )
|
for( j = 0; j + 1 < T_len; j++ )
|
||||||
TT[j] = T + j + 1;
|
TT[j] = T + j + 1;
|
||||||
|
|
||||||
MBEDTLS_MPI_CHK( ecp_normalize_jac_many( grp, TT, j ) );
|
MBEDTLS_MPI_CHK( ecp_normalize_jac_many( grp, TT, j ) );
|
||||||
|
|
Loading…
Reference in a new issue