Lines Matching refs:group

50     ret->group = EC_GROUP_new_by_curve_name_ex(ctx, propq, nid);
51 if (ret->group == NULL) {
56 && ret->meth->set_group(ret, ret->group) == 0) {
90 if (r->group && r->group->meth->keyfinish)
91 r->group->meth->keyfinish(r);
97 EC_GROUP_free(r->group);
114 if (dest->group && dest->group->meth->keyfinish)
115 dest->group->meth->keyfinish(dest);
124 if (src->group != NULL) {
125 /* clear the old group */
126 EC_GROUP_free(dest->group);
127 dest->group = ossl_ec_group_new_ex(src->libctx, src->propq,
128 src->group->meth);
129 if (dest->group == NULL)
131 if (!EC_GROUP_copy(dest->group, src->group))
137 dest->pub_key = EC_POINT_new(src->group);
152 if (src->group->meth->keycopy
153 && src->group->meth->keycopy(dest, src) == 0)
211 if (eckey == NULL || eckey->group == NULL) {
232 ret = eckey->group->meth->keygen(eckey);
258 const EC_GROUP *group = eckey->group;
278 tmp = EC_GROUP_get0_order(group);
308 pub_key = EC_POINT_new(group);
315 if (!EC_POINT_mul(group, pub_key, priv_key, NULL, NULL, ctx))
343 EC_POINT_set_to_infinity(group, eckey->pub_key);
370 ret = EC_POINT_mul(eckey->group, eckey->pub_key, eckey->priv_key, NULL,
382 if (eckey == NULL || eckey->group == NULL || eckey->pub_key == NULL) {
387 if (eckey->group->meth->keycheck == NULL) {
392 return eckey->group->meth->keycheck(eckey);
415 if (!EC_POINT_get_affine_coordinates(key->group, key->pub_key, x, y, ctx))
418 if (EC_GROUP_get_field_type(key->group) == NID_X9_62_prime_field) {
420 || BN_cmp(x, key->group->field) >= 0
422 || BN_cmp(y, key->group->field) >= 0) {
426 int m = EC_GROUP_get_degree(key->group);
443 if (eckey == NULL || eckey->group == NULL || eckey->pub_key == NULL) {
449 if (EC_POINT_is_at_infinity(eckey->group, eckey->pub_key)) {
461 if (EC_POINT_is_on_curve(eckey->group, eckey->pub_key, ctx) <= 0) {
481 point = EC_POINT_new(eckey->group);
485 order = eckey->group->order;
491 if (!EC_POINT_mul(eckey->group, point, NULL, eckey->pub_key, order, ctx)) {
495 if (!EC_POINT_is_at_infinity(eckey->group, point)) {
512 if (eckey == NULL || eckey->group == NULL || eckey->priv_key == NULL) {
517 || BN_cmp(eckey->priv_key, eckey->group->order) >= 0) {
535 || eckey->group == NULL
542 point = EC_POINT_new(eckey->group);
547 if (!EC_POINT_mul(eckey->group, point, eckey->priv_key, NULL, NULL, ctx)) {
551 if (EC_POINT_cmp(eckey->group, point, eckey->pub_key, ctx) != 0) {
569 * an approved elliptic-curve group is used.
606 if (key == NULL || key->group == NULL || x == NULL || y == NULL) {
615 point = EC_POINT_new(key->group);
625 if (!EC_POINT_set_affine_coordinates(key->group, point, x, y, ctx))
627 if (!EC_POINT_get_affine_coordinates(key->group, point, tx, ty, ctx))
669 /* Do we need to propagate this to the group? */
674 return key->group;
677 int EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group)
679 if (key->meth->set_group != NULL && key->meth->set_group(key, group) == 0)
681 EC_GROUP_free(key->group);
682 key->group = EC_GROUP_dup(group);
683 if (key->group != NULL && EC_GROUP_get_curve_name(key->group) == NID_sm2)
687 return (key->group == NULL) ? 0 : 1;
701 if (key->group == NULL || key->group->meth == NULL)
705 * Not only should key->group be set, but it should also be in a valid
708 * Specifically, to operate in constant time, we need that the group order
712 order = EC_GROUP_get0_order(key->group);
716 if (key->group->meth->set_private != NULL
717 && key->group->meth->set_private(key, priv_key) == 0)
801 key->pub_key = EC_POINT_dup(pub_key, key->group);
824 if (key->group != NULL)
825 EC_GROUP_set_point_conversion_form(key->group, cform);
830 if (key->group != NULL)
831 EC_GROUP_set_asn1_flag(key->group, flag);
837 if (key->group == NULL)
839 return EC_GROUP_precompute_mult(key->group, ctx);
862 if (key == NULL || key->group == NULL)
864 return key->group->decoded_from_explicit_params;
870 if (key == NULL || key->pub_key == NULL || key->group == NULL)
872 return EC_POINT_point2buf(key->group, key->pub_key, form, pbuf, ctx);
878 if (key == NULL || key->group == NULL)
881 key->pub_key = EC_POINT_new(key->group);
884 if (EC_POINT_oct2point(key->group, key->pub_key, buf, len, ctx) == 0)
894 if ((key->group->meth->flags & EC_FLAGS_CUSTOM_CURVE) == 0)
902 if (eckey->group == NULL || eckey->group->meth == NULL)
904 if (eckey->group->meth->priv2oct == NULL) {
909 return eckey->group->meth->priv2oct(eckey, buf, len);
917 buf_len = (EC_GROUP_order_bits(eckey->group) + 7) / 8;
939 if (eckey->group == NULL || eckey->group->meth == NULL)
941 if (eckey->group->meth->oct2priv == NULL) {
945 ret = eckey->group->meth->oct2priv(eckey, buf, len);
991 if (eckey->group == NULL || eckey->group->meth == NULL
992 || (eckey->group->meth->flags & EC_FLAGS_NO_SIGN))