Add an ecdsa_genkey() function

This commit is contained in:
Manuel Pégourié-Gonnard 2013-08-09 16:21:34 +02:00
parent 4846f5ecbc
commit 8eebd012b9
3 changed files with 26 additions and 3 deletions

View file

@ -273,6 +273,17 @@ int ecdsa_read_signature( ecdsa_context *ctx,
return( ecdsa_verify( &ctx->grp, hash, hlen, &ctx->Q, &ctx->r, &ctx->s ) );
}
/*
* Generate key pair
*/
int ecdsa_genkey( ecdsa_context *ctx, ecp_group_id gid,
int (*f_rng)(void *, unsigned char *, size_t), void *p_rng )
{
return( ecp_use_known_dp( &ctx->grp, gid ) ||
ecp_gen_keypair( &ctx->grp, &ctx->d, &ctx->Q, f_rng, p_rng ) );
}
/*
* Initialize context
*/