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
1 changed files with 4 additions and 2 deletions
|
@ -71,10 +71,12 @@ static int ecdh_gen_public_restartable( mbedtls_ecp_group *grp,
|
|||
{
|
||||
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( rs_ctx == NULL || rs_ctx->rsm == NULL )
|
||||
restarting = ( rs_ctx != NULL && rs_ctx->rsm != NULL );
|
||||
#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_mul_restartable( grp, Q, d, &grp->G,
|
||||
|
|
Loading…
Reference in a new issue