mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-01-03 23:43:40 +00:00
Refactor macro-spanning ifs in ecdh.c
Signed-off-by: David Horstmann <david.horstmann@arm.com>
This commit is contained in:
parent
fc735dffd6
commit
91e20a0580
@ -71,10 +71,12 @@ static int ecdh_gen_public_restartable( mbedtls_ecp_group *grp,
|
|||||||
{
|
{
|
||||||
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
|
||||||
|
|
||||||
/* If multiplication is in progress, we already generated a privkey */
|
int restarting = 0;
|
||||||
#if defined(MBEDTLS_ECP_RESTARTABLE)
|
#if defined(MBEDTLS_ECP_RESTARTABLE)
|
||||||
if( rs_ctx == NULL || rs_ctx->rsm == NULL )
|
restarting = ( rs_ctx != NULL && rs_ctx->rsm != NULL );
|
||||||
#endif
|
#endif
|
||||||
|
/* If multiplication is in progress, we already generated a privkey */
|
||||||
|
if( !restarting )
|
||||||
MBEDTLS_MPI_CHK( mbedtls_ecp_gen_privkey( grp, d, f_rng, p_rng ) );
|
MBEDTLS_MPI_CHK( mbedtls_ecp_gen_privkey( grp, d, f_rng, p_rng ) );
|
||||||
|
|
||||||
MBEDTLS_MPI_CHK( mbedtls_ecp_mul_restartable( grp, Q, d, &grp->G,
|
MBEDTLS_MPI_CHK( mbedtls_ecp_mul_restartable( grp, Q, d, &grp->G,
|
||||||
|
Loading…
Reference in New Issue
Block a user