mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-01-26 04:50:59 +00:00
Group related code together
This commit is contained in:
parent
4b2336d7f6
commit
24be79588d
|
@ -1465,13 +1465,6 @@ static int ecp_mul_comb( mbedtls_ecp_group *grp, mbedtls_ecp_point *R,
|
||||||
|
|
||||||
mbedtls_mpi_init( &M );
|
mbedtls_mpi_init( &M );
|
||||||
|
|
||||||
/*
|
|
||||||
* We need an odd scalar for recoding. Ensure that by replacing it with
|
|
||||||
* its opposite, then negating the result to compensate if needed.
|
|
||||||
*/
|
|
||||||
m_is_odd = ( mbedtls_mpi_get_bit( m, 0 ) == 1 );
|
|
||||||
MBEDTLS_MPI_CHK( ecp_make_scalar_odd( grp, &M, m, m_is_odd ) );
|
|
||||||
|
|
||||||
/* Is P the base point ? */
|
/* Is P the base point ? */
|
||||||
#if MBEDTLS_ECP_FIXED_POINT_OPTIM == 1
|
#if MBEDTLS_ECP_FIXED_POINT_OPTIM == 1
|
||||||
p_eq_g = ( mbedtls_mpi_cmp_mpi( &P->Y, &grp->G.Y ) == 0 &&
|
p_eq_g = ( mbedtls_mpi_cmp_mpi( &P->Y, &grp->G.Y ) == 0 &&
|
||||||
|
@ -1509,6 +1502,13 @@ static int ecp_mul_comb( mbedtls_ecp_group *grp, mbedtls_ecp_point *R,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We need an odd scalar for recoding. Ensure that by replacing it with
|
||||||
|
* its opposite, then negating the result to compensate if needed.
|
||||||
|
*/
|
||||||
|
m_is_odd = ( mbedtls_mpi_get_bit( m, 0 ) == 1 );
|
||||||
|
MBEDTLS_MPI_CHK( ecp_make_scalar_odd( grp, &M, m, m_is_odd ) );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Go for comb multiplication, R = M * P
|
* Go for comb multiplication, R = M * P
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue