Lines Matching refs:group

51     ret->group = EC_GROUP_new_by_curve_name_ex(ctx, propq, nid);  in EC_KEY_new_by_curve_name_ex()
52 if (ret->group == NULL) { in EC_KEY_new_by_curve_name_ex()
57 && ret->meth->set_group(ret, ret->group) == 0) { in EC_KEY_new_by_curve_name_ex()
91 if (r->group && r->group->meth->keyfinish) in EC_KEY_free()
92 r->group->meth->keyfinish(r); in EC_KEY_free()
98 EC_GROUP_free(r->group); in EC_KEY_free()
115 if (dest->group && dest->group->meth->keyfinish) in EC_KEY_copy()
116 dest->group->meth->keyfinish(dest); in EC_KEY_copy()
125 if (src->group != NULL) { in EC_KEY_copy()
127 EC_GROUP_free(dest->group); in EC_KEY_copy()
128 dest->group = ossl_ec_group_new_ex(src->libctx, src->propq, in EC_KEY_copy()
129 src->group->meth); in EC_KEY_copy()
130 if (dest->group == NULL) in EC_KEY_copy()
132 if (!EC_GROUP_copy(dest->group, src->group)) in EC_KEY_copy()
138 dest->pub_key = EC_POINT_new(src->group); in EC_KEY_copy()
153 if (src->group->meth->keycopy in EC_KEY_copy()
154 && src->group->meth->keycopy(dest, src) == 0) in EC_KEY_copy()
212 if (eckey == NULL || eckey->group == NULL) { in EC_KEY_generate_key()
233 ret = eckey->group->meth->keygen(eckey); in ossl_ec_key_gen()
259 EC_POINT *pub_key2 = EC_POINT_new(eckey->group); in ecdsa_keygen_knownanswer_test()
272 if (!EC_POINT_mul(eckey->group, pub_key2, eckey->priv_key, NULL, NULL, ctx)) in ecdsa_keygen_knownanswer_test()
281 ret = !EC_POINT_cmp(eckey->group, eckey->pub_key, pub_key2, ctx); in ecdsa_keygen_knownanswer_test()
309 const EC_GROUP *group = eckey->group; in ec_generate_key() local
329 tmp = EC_GROUP_get0_order(group); in ec_generate_key()
359 pub_key = EC_POINT_new(group); in ec_generate_key()
366 if (!EC_POINT_mul(group, pub_key, priv_key, NULL, NULL, ctx)) in ec_generate_key()
395 EC_POINT_set_to_infinity(group, eckey->pub_key); in ec_generate_key()
423 eckey->pub_key = EC_POINT_new(eckey->group); in ossl_ec_generate_key_dhkem()
436 EC_POINT_set_to_infinity(eckey->group, eckey->pub_key); in ossl_ec_generate_key_dhkem()
459 ret = EC_POINT_mul(eckey->group, eckey->pub_key, eckey->priv_key, NULL, in ossl_ec_key_simple_generate_public_key()
471 if (eckey == NULL || eckey->group == NULL || eckey->pub_key == NULL) { in EC_KEY_check_key()
476 if (eckey->group->meth->keycheck == NULL) { in EC_KEY_check_key()
481 return eckey->group->meth->keycheck(eckey); in EC_KEY_check_key()
504 if (!EC_POINT_get_affine_coordinates(key->group, key->pub_key, x, y, ctx)) in ec_key_public_range_check()
507 if (EC_GROUP_get_field_type(key->group) == NID_X9_62_prime_field) { in ec_key_public_range_check()
509 || BN_cmp(x, key->group->field) >= 0 in ec_key_public_range_check()
511 || BN_cmp(y, key->group->field) >= 0) { in ec_key_public_range_check()
515 int m = EC_GROUP_get_degree(key->group); in ec_key_public_range_check()
532 if (eckey == NULL || eckey->group == NULL || eckey->pub_key == NULL) { in ossl_ec_key_public_check_quick()
538 if (EC_POINT_is_at_infinity(eckey->group, eckey->pub_key)) { in ossl_ec_key_public_check_quick()
550 if (EC_POINT_is_on_curve(eckey->group, eckey->pub_key, ctx) <= 0) { in ossl_ec_key_public_check_quick()
566 const BIGNUM *cofactor = EC_GROUP_get0_cofactor(eckey->group); in ossl_ec_key_public_check()
576 point = EC_POINT_new(eckey->group); in ossl_ec_key_public_check()
580 order = eckey->group->order; in ossl_ec_key_public_check()
586 if (!EC_POINT_mul(eckey->group, point, NULL, eckey->pub_key, order, ctx)) { in ossl_ec_key_public_check()
590 if (!EC_POINT_is_at_infinity(eckey->group, point)) { in ossl_ec_key_public_check()
607 if (eckey == NULL || eckey->group == NULL || eckey->priv_key == NULL) { in ossl_ec_key_private_check()
612 || BN_cmp(eckey->priv_key, eckey->group->order) >= 0) { in ossl_ec_key_private_check()
630 || eckey->group == NULL in ossl_ec_key_pairwise_check()
637 point = EC_POINT_new(eckey->group); in ossl_ec_key_pairwise_check()
642 if (!EC_POINT_mul(eckey->group, point, eckey->priv_key, NULL, NULL, ctx)) { in ossl_ec_key_pairwise_check()
646 if (EC_POINT_cmp(eckey->group, point, eckey->pub_key, ctx) != 0) { in ossl_ec_key_pairwise_check()
701 if (key == NULL || key->group == NULL || x == NULL || y == NULL) { in EC_KEY_set_public_key_affine_coordinates()
710 point = EC_POINT_new(key->group); in EC_KEY_set_public_key_affine_coordinates()
720 if (!EC_POINT_set_affine_coordinates(key->group, point, x, y, ctx)) in EC_KEY_set_public_key_affine_coordinates()
722 if (!EC_POINT_get_affine_coordinates(key->group, point, tx, ty, ctx)) in EC_KEY_set_public_key_affine_coordinates()
769 return key->group; in EC_KEY_get0_group()
772 int EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group) in EC_KEY_set_group() argument
774 if (key->meth->set_group != NULL && key->meth->set_group(key, group) == 0) in EC_KEY_set_group()
776 EC_GROUP_free(key->group); in EC_KEY_set_group()
777 key->group = EC_GROUP_dup(group); in EC_KEY_set_group()
778 if (key->group != NULL && EC_GROUP_get_curve_name(key->group) == NID_sm2) in EC_KEY_set_group()
782 return (key->group == NULL) ? 0 : 1; in EC_KEY_set_group()
796 if (key->group == NULL || key->group->meth == NULL) in EC_KEY_set_private_key()
807 order = EC_GROUP_get0_order(key->group); in EC_KEY_set_private_key()
811 if (key->group->meth->set_private != NULL in EC_KEY_set_private_key()
812 && key->group->meth->set_private(key, priv_key) == 0) in EC_KEY_set_private_key()
896 key->pub_key = EC_POINT_dup(pub_key, key->group); in EC_KEY_set_public_key()
919 if (key->group != NULL) in EC_KEY_set_conv_form()
920 EC_GROUP_set_point_conversion_form(key->group, cform); in EC_KEY_set_conv_form()
925 if (key->group != NULL) in EC_KEY_set_asn1_flag()
926 EC_GROUP_set_asn1_flag(key->group, flag); in EC_KEY_set_asn1_flag()
932 if (key->group == NULL) in EC_KEY_precompute_mult()
934 return EC_GROUP_precompute_mult(key->group, ctx); in EC_KEY_precompute_mult()
957 if (key == NULL || key->group == NULL) in EC_KEY_decoded_from_explicit_params()
959 return key->group->decoded_from_explicit_params; in EC_KEY_decoded_from_explicit_params()
965 if (key == NULL || key->pub_key == NULL || key->group == NULL) in EC_KEY_key2buf()
967 return EC_POINT_point2buf(key->group, key->pub_key, form, pbuf, ctx); in EC_KEY_key2buf()
973 if (key == NULL || key->group == NULL) in EC_KEY_oct2key()
976 key->pub_key = EC_POINT_new(key->group); in EC_KEY_oct2key()
979 if (EC_POINT_oct2point(key->group, key->pub_key, buf, len, ctx) == 0) in EC_KEY_oct2key()
989 if ((key->group->meth->flags & EC_FLAGS_CUSTOM_CURVE) == 0) in EC_KEY_oct2key()
997 if (eckey->group == NULL || eckey->group->meth == NULL) in EC_KEY_priv2oct()
999 if (eckey->group->meth->priv2oct == NULL) { in EC_KEY_priv2oct()
1004 return eckey->group->meth->priv2oct(eckey, buf, len); in EC_KEY_priv2oct()
1012 buf_len = (EC_GROUP_order_bits(eckey->group) + 7) / 8; in ossl_ec_key_simple_priv2oct()
1034 if (eckey->group == NULL || eckey->group->meth == NULL) in EC_KEY_oct2priv()
1036 if (eckey->group->meth->oct2priv == NULL) { in EC_KEY_oct2priv()
1040 ret = eckey->group->meth->oct2priv(eckey, buf, len); in EC_KEY_oct2priv()
1084 if (eckey->group == NULL || eckey->group->meth == NULL in EC_KEY_can_sign()
1085 || (eckey->group->meth->flags & EC_FLAGS_NO_SIGN)) in EC_KEY_can_sign()