src/sig/ec_key.c
int ec_key_pair_gen(ec_key_pair *kp, const ec_params *params,
		    ec_sig_alg_type ec_key_alg)
{
	int ret = -1;

	MUST_HAVE(kp != NULL);
	MUST_HAVE(params != NULL);

	/* Get a random value in ]0,q[ */
	ret = nn_get_random_mod(&(kp->priv_key.x), &(params->ec_gen_order));
	if (ret) {
		goto err;
	}

	/* Set key type and pointer to EC params for private key */
	kp->priv_key.key_type = ec_key_alg;
	kp->priv_key.params = (const ec_params *)params;
	kp->priv_key.magic = PRIV_KEY_MAGIC;

	/* Generate associated public key. */
	ret = init_pubkey_from_privkey(&(kp->pub_key), &(kp->priv_key));

 err:
	return ret;
}
/*
 * Generate a public/private key pair for given signature algorithm, using
 * given EC params.
 */
Generate a public/private key pair for given signature algorithm, using
given EC params.
Generate a public / private key pair for given signature algorithm using given EC params .
int ec_key_pair_gen(ec_key_pair *kp, const ec_params *params,
		    ec_sig_alg_type ec_key_alg)
{
	int ret = -1;
	MUST_HAVE(kp != NULL);
	MUST_HAVE(params != NULL);
	ret = nn_get_random_mod(&(kp->priv_key.x), &(params->ec_gen_order));
	if (ret) {
		goto err;
	}
	kp->priv_key.key_type = ec_key_alg;
	kp->priv_key.params = (const ec_params *)params;
	kp->priv_key.magic = PRIV_KEY_MAGIC;
	ret = init_pubkey_from_privkey(&(kp->pub_key), &(kp->priv_key));
 err:
	return ret;
}
int ec_key_pair_gen ( ec_key_pair * kp , const ec_params * params , ec_sig_alg_type ec_key_alg ) { int ret = -1 ; MUST_HAVE ( kp != NULL ) ; MUST_HAVE ( params != NULL ) ; ret = nn_get_random_mod ( & ( kp -> priv_key . x ) , & ( params -> ec_gen_order ) ) ; if ( ret ) { goto err ; } kp -> priv_key . key_type = ec_key_alg ; kp -> priv_key . params = ( const ec_params * ) params ; kp -> priv_key . magic = PRIV_KEY_MAGIC ; ret = init_pubkey_from_privkey ( & ( kp -> pub_key ) , & ( kp -> priv_key ) ) ; err : return ret ; }
Generate a public/private key pair for given signature algorithm, using
 given EC params.
Generate a public / private key pair for given signature algorithm using given EC params .
/* Get a random value in ]0,q[ */ /* Set key type and pointer to EC params for private key */ /* Generate associated public key. */