Fix return value of ecdsa_from_keypair()

This commit is contained in:
Manuel Pégourié-Gonnard 2013-10-27 14:53:48 +01:00 committed by Paul Bakker
parent 21ef42f257
commit 1001e32d6f

View file

@ -291,12 +291,14 @@ int ecdsa_genkey( ecdsa_context *ctx, ecp_group_id gid,
*/ */
int ecdsa_from_keypair( ecdsa_context *ctx, const ecp_keypair *key ) int ecdsa_from_keypair( ecdsa_context *ctx, const ecp_keypair *key )
{ {
int ret = ecp_group_copy( &ctx->grp, &key->grp ) || int ret;
mpi_copy( &ctx->d, &key->d ) ||
ecp_copy( &ctx->Q, &key->Q );
if( ret != 0 ) if( ( ret = ecp_group_copy( &ctx->grp, &key->grp ) ) != 0 ||
( ret = mpi_copy( &ctx->d, &key->d ) ) != 0 ||
( ret = ecp_copy( &ctx->Q, &key->Q ) ) != 0 )
{
ecdsa_free( ctx ); ecdsa_free( ctx );
}
return( ret ); return( ret );
} }