EC_KEY_free(ret);
return NULL;
}
+ if (ret->meth->set_group && ret->meth->set_group(ret, ret->group) == 0) {
+ EC_KEY_free(ret);
+ return NULL;
+ }
return ret;
}
int EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group)
{
+ if (key->meth->set_group && key->meth->set_group(key, group) == 0)
+ return 0;
EC_GROUP_free(key->group);
key->group = EC_GROUP_dup(group);
return (key->group == NULL) ? 0 : 1;
int EC_KEY_set_private_key(EC_KEY *key, const BIGNUM *priv_key)
{
+ if (key->meth->set_private && key->meth->set_private(key, priv_key) == 0)
+ return 0;
BN_clear_free(key->priv_key);
key->priv_key = BN_dup(priv_key);
return (key->priv_key == NULL) ? 0 : 1;
int EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub_key)
{
+ if (key->meth->set_public && key->meth->set_public(key, pub_key) == 0)
+ return 0;
EC_POINT_free(key->pub_key);
key->pub_key = EC_POINT_dup(pub_key, key->group);
return (key->pub_key == NULL) ? 0 : 1;
int (*init)(EC_KEY *key);
void (*finish)(EC_KEY *key);
int (*copy)(EC_KEY *dest, const EC_KEY *src);
+ int (*set_group)(EC_KEY *key, const EC_GROUP *grp);
+ int (*set_private)(EC_KEY *key, const BIGNUM *priv_key);
+ int (*set_public)(EC_KEY *key, const EC_POINT *pub_key);
int (*keygen)(EC_KEY *key);
int (*compute_key)(void *out, size_t outlen, const EC_POINT *pub_key,
EC_KEY *ecdh,