/openssl/crypto/ec/ |
H A D | ec_lib.c | 128 group->meth->group_finish(group); in EC_GROUP_free() 147 group->meth->group_clear_finish(group); in EC_GROUP_clear_free() 149 group->meth->group_finish(group); in EC_GROUP_clear_free() 156 OPENSSL_clear_free(group->seed, group->seed_len); in EC_GROUP_clear_free() 157 OPENSSL_clear_free(group, sizeof(*group)); in EC_GROUP_clear_free() 357 || !BN_div(group->cofactor, NULL, group->cofactor, group->order, ctx)) in ec_guess_cofactor() 403 group->generator = EC_POINT_new(group); in EC_GROUP_set_generator() 463 return group->meth->group_order_bits(group); in EC_GROUP_order_bits() 610 return group->meth->group_get_degree(group); in EC_GROUP_get_degree() 966 return group->meth->dbl(group, r, a, ctx); in EC_POINT_dbl() [all …]
|
H A D | ecp_smpl.c | 103 if (group->field == NULL || group->a == NULL || group->b == NULL) { in ossl_ec_GFp_simple_group_init() 175 if (!group->meth->field_encode(group, group->a, tmp_a, ctx)) in ossl_ec_GFp_simple_group_set_curve() 184 if (!group->meth->field_encode(group, group->b, group->b, ctx)) in ossl_ec_GFp_simple_group_set_curve() 219 if (!group->meth->field_decode(group, a, group->a, ctx)) in ossl_ec_GFp_simple_group_get_curve() 223 if (!group->meth->field_decode(group, b, group->b, ctx)) in ossl_ec_GFp_simple_group_get_curve() 275 if (!group->meth->field_decode(group, a, group->a, ctx)) in ossl_ec_GFp_simple_group_check_discriminant() 277 if (!group->meth->field_decode(group, b, group->b, ctx)) in ossl_ec_GFp_simple_group_check_discriminant() 1509 || !group->meth->field_mul(group, t5, p->X, group->b, ctx) in ossl_ec_GFp_simple_ladder_pre() 1584 || !group->meth->field_mul(group, t5, group->a, t0, ctx) in ossl_ec_GFp_simple_ladder_step() 1601 || !group->meth->field_mul(group, t6, t5, group->a, ctx) in ossl_ec_GFp_simple_ladder_step() [all …]
|
H A D | ec2_smpl.c | 34 if (group->field == NULL || group->a == NULL || group->b == NULL) { in ossl_ec_GF2m_simple_group_init() 110 i = BN_GF2m_poly2arr(group->field, group->poly, 6) - 1; in ossl_ec_GF2m_simple_group_set_curve() 117 if (!BN_GF2m_mod_arr(group->a, a, group->poly)) in ossl_ec_GF2m_simple_group_set_curve() 125 if (!BN_GF2m_mod_arr(group->b, b, group->poly)) in ossl_ec_GF2m_simple_group_set_curve() 201 if (!BN_GF2m_mod_arr(b, group->b, group->poly)) in ossl_ec_GF2m_simple_group_check_discriminant() 423 if (!group->meth->field_sqr(group, x2, s, ctx)) in ossl_ec_GF2m_simple_add() 443 if (!group->meth->field_sqr(group, x2, s, ctx)) in ossl_ec_GF2m_simple_add() 453 if (!group->meth->field_mul(group, y2, y2, s, ctx)) in ossl_ec_GF2m_simple_add() 491 || !group->meth->make_affine(group, point, ctx)) in ossl_ec_GF2m_simple_invert() 791 || !group->meth->field_mul(group, s->Y, s->Y, group->b, ctx) in ec_GF2m_simple_ladder_step() [all …]
|
H A D | ec_oct.c | 32 if (!ec_point_is_compat(point, group)) { in EC_POINT_set_compressed_coordinates() 36 if (group->meth->flags & EC_FLAGS_DEFAULT_OCT) { in EC_POINT_set_compressed_coordinates() 51 return group->meth->point_set_compressed_coordinates(group, point, x, in EC_POINT_set_compressed_coordinates() 81 if (group->meth->point2oct == 0 in EC_POINT_point2oct() 86 if (!ec_point_is_compat(point, group)) { in EC_POINT_point2oct() 90 if (group->meth->flags & EC_FLAGS_DEFAULT_OCT) { in EC_POINT_point2oct() 106 return group->meth->point2oct(group, point, form, buf, len, ctx); in EC_POINT_point2oct() 112 if (group->meth->oct2point == 0 in EC_POINT_oct2point() 117 if (!ec_point_is_compat(point, group)) { in EC_POINT_oct2point() 121 if (group->meth->flags & EC_FLAGS_DEFAULT_OCT) { in EC_POINT_oct2point() [all …]
|
H A D | ecp_mont.c | 88 group->field_data1 = NULL; in ossl_ec_GFp_mont_group_init() 89 group->field_data2 = NULL; in ossl_ec_GFp_mont_group_init() 96 group->field_data1 = NULL; in ossl_ec_GFp_mont_group_finish() 98 group->field_data2 = NULL; in ossl_ec_GFp_mont_group_finish() 105 group->field_data1 = NULL; in ossl_ec_GFp_mont_group_clear_finish() 107 group->field_data2 = NULL; in ossl_ec_GFp_mont_group_clear_finish() 152 group->field_data1 = NULL; in ossl_ec_GFp_mont_group_set_curve() 154 group->field_data2 = NULL; in ossl_ec_GFp_mont_group_set_curve() 175 group->field_data1 = mont; in ossl_ec_GFp_mont_group_set_curve() 177 group->field_data2 = one; in ossl_ec_GFp_mont_group_set_curve() [all …]
|
H A D | ecp_oct.c | 56 if (group->meth->field_decode == 0) { in ossl_ec_GFp_simple_set_compressed_coordinates() 58 if (!group->meth->field_sqr(group, tmp2, x_, ctx)) in ossl_ec_GFp_simple_set_compressed_coordinates() 60 if (!group->meth->field_mul(group, tmp1, tmp2, x_, ctx)) in ossl_ec_GFp_simple_set_compressed_coordinates() 70 if (group->a_is_minus3) { in ossl_ec_GFp_simple_set_compressed_coordinates() 78 if (group->meth->field_decode) { in ossl_ec_GFp_simple_set_compressed_coordinates() 79 if (!group->meth->field_decode(group, tmp2, group->a, ctx)) in ossl_ec_GFp_simple_set_compressed_coordinates() 85 if (!group->meth->field_mul(group, tmp2, group->a, x, ctx)) in ossl_ec_GFp_simple_set_compressed_coordinates() 94 if (group->meth->field_decode) { in ossl_ec_GFp_simple_set_compressed_coordinates() 95 if (!group->meth->field_decode(group, tmp2, group->b, ctx)) in ossl_ec_GFp_simple_set_compressed_coordinates() 100 if (!BN_mod_add_quick(tmp1, tmp1, group->b, group->field)) in ossl_ec_GFp_simple_set_compressed_coordinates() [all …]
|
H A D | ec_key.c | 91 if (r->group && r->group->meth->keyfinish) in EC_KEY_free() 115 if (dest->group && dest->group->meth->keyfinish) in EC_KEY_copy() 132 if (!EC_GROUP_copy(dest->group, src->group)) in EC_KEY_copy() 309 const EC_GROUP *group = eckey->group; in ec_generate_key() local 769 return key->group; in EC_KEY_get0_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() 796 if (key->group == NULL || key->group->meth == NULL) in EC_KEY_set_private_key() 997 if (eckey->group == NULL || eckey->group->meth == NULL) in EC_KEY_priv2oct() 1034 if (eckey->group == NULL || eckey->group->meth == NULL) in EC_KEY_oct2priv() [all …]
|
H A D | ec_check.c | 25 if (group == NULL) { in EC_GROUP_check_named_curve() 38 nid = ossl_ec_curve_nid_from_params(group, ctx); in EC_GROUP_check_named_curve() 46 int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx) in EC_GROUP_check() argument 60 if (group == NULL || group->meth == NULL) { in EC_GROUP_check() 66 if ((group->meth->flags & EC_FLAGS_CUSTOM_CURVE) != 0) in EC_GROUP_check() 78 if (!EC_GROUP_check_discriminant(group, ctx)) { in EC_GROUP_check() 84 if (group->generator == NULL) { in EC_GROUP_check() 88 if (EC_POINT_is_on_curve(group, group->generator, ctx) <= 0) { in EC_GROUP_check() 94 if ((point = EC_POINT_new(group)) == NULL) in EC_GROUP_check() 96 order = EC_GROUP_get0_order(group); in EC_GROUP_check() [all …]
|
H A D | ec_mult.c | 54 if (!group) in ec_pre_comp_new() 61 ret->group = group; in ec_pre_comp_new() 155 if (BN_is_zero(group->order)) { in ossl_ec_scalar_mul_ladder() 196 if (!BN_mul(cardinality, group->order, group->cofactor, ctx)) { in ossl_ec_scalar_mul_ladder() 265 || !group->meth->make_affine(group, p, ctx))) { in ossl_ec_scalar_mul_ladder() 432 if (!BN_is_zero(group->order) && !BN_is_zero(group->cofactor)) { in ossl_ec_wNAF_mul() 706 || !group->meth->points_make_affine(group, num_val, val, ctx)) in ossl_ec_wNAF_mul() 834 EC_pre_comp_free(group); in ossl_ec_wNAF_precompute_mult() 945 || !group->meth->points_make_affine(group, num, points, ctx)) in ossl_ec_wNAF_precompute_mult() 948 pre_comp->group = group; in ossl_ec_wNAF_precompute_mult() [all …]
|
H A D | ecp_nist.c | 100 if ((ctx = new_ctx = BN_CTX_new_ex(group->libctx)) == NULL) in ossl_ec_GFp_nist_group_set_curve() 106 group->field_mod_func = BN_nist_mod_192; in ossl_ec_GFp_nist_group_set_curve() 108 group->field_mod_func = BN_nist_mod_224; in ossl_ec_GFp_nist_group_set_curve() 110 group->field_mod_func = BN_nist_mod_256; in ossl_ec_GFp_nist_group_set_curve() 112 group->field_mod_func = BN_nist_mod_384; in ossl_ec_GFp_nist_group_set_curve() 114 group->field_mod_func = BN_nist_mod_521; in ossl_ec_GFp_nist_group_set_curve() 120 ret = ossl_ec_GFp_simple_group_set_curve(group, p, a, b, ctx); in ossl_ec_GFp_nist_group_set_curve() 134 if (!group || !r || !a || !b) { in ossl_ec_GFp_nist_field_mul() 144 if (!group->field_mod_func(r, r, group->field, ctx)) in ossl_ec_GFp_nist_field_mul() 159 if (!group || !r || !a) { in ossl_ec_GFp_nist_field_sqr() [all …]
|
H A D | ec_local.h | 190 int (*ladder_pre)(const EC_GROUP *group, 294 EC_GROUP *group; member 330 return group->meth == point->meth in ec_point_is_compat() 331 && (group->curve_name == 0 in ec_point_is_compat() 344 void EC_pre_comp_free(EC_GROUP *group); 770 if (group->meth->ladder_pre != NULL) in ec_point_ladder_pre() 771 return group->meth->ladder_pre(group, r, s, p, ctx); in ec_point_ladder_pre() 784 if (group->meth->ladder_step != NULL) in ec_point_ladder_step() 785 return group->meth->ladder_step(group, r, s, p, ctx); in ec_point_ladder_step() 799 if (group->meth->ladder_post != NULL) in ec_point_ladder_post() [all …]
|
H A D | ec2_oct.c | 66 if (!BN_GF2m_mod_arr(x, x_, group->poly)) in ossl_ec_GF2m_simple_set_compressed_coordinates() 69 if (!BN_GF2m_mod_sqrt_arr(y, group->b, group->poly, ctx)) in ossl_ec_GF2m_simple_set_compressed_coordinates() 72 if (!group->meth->field_sqr(group, tmp, x, ctx)) in ossl_ec_GF2m_simple_set_compressed_coordinates() 74 if (!group->meth->field_div(group, tmp, group->b, tmp, ctx)) in ossl_ec_GF2m_simple_set_compressed_coordinates() 76 if (!BN_GF2m_add(tmp, group->a, tmp)) in ossl_ec_GF2m_simple_set_compressed_coordinates() 99 if (!group->meth->field_mul(group, y, x, z, ctx)) in ossl_ec_GF2m_simple_set_compressed_coordinates() 145 if (EC_POINT_is_at_infinity(group, point)) { in ossl_ec_GF2m_simple_point2oct() 158 field_len = (EC_GROUP_get_degree(group) + 7) / 8; in ossl_ec_GF2m_simple_point2oct() 191 if (!group->meth->field_div(group, yxi, y, x, ctx)) in ossl_ec_GF2m_simple_point2oct() 309 m = EC_GROUP_get_degree(group); in ossl_ec_GF2m_simple_oct2point() [all …]
|
H A D | ec_backend.c | 297 if (group == NULL) { in ossl_ec_group_todata() 502 EC_GROUP *group = NULL; in ossl_ec_group_fromdata() local 514 EC_GROUP_free(group); in ossl_ec_group_fromdata() 611 if (src->group != NULL in ossl_ec_key_dup() 616 || !EC_GROUP_copy(ret->group, src->group)) in ossl_ec_key_dup() 745 EC_GROUP *group; in ossl_x509_algor_is_sm2() local 753 EC_GROUP_free(group); in ossl_x509_algor_is_sm2() 766 EC_GROUP *group = NULL; in ossl_ec_key_param_from_x509_algor() local 792 if (group == NULL) in ossl_ec_key_param_from_x509_algor() 797 EC_GROUP_free(group); in ossl_ec_key_param_from_x509_algor() [all …]
|
H A D | ecp_s390x_nistp.c | 61 ctx = new_ctx = BN_CTX_new_ex(group->libctx); in ec_GFp_s390x_nistp_mul() 93 rc = EC_POINT_set_to_infinity(group, r); in ec_GFp_s390x_nistp_mul() 99 if (group->meth->point_get_affine_coordinates(group, point_ptr, in ec_GFp_s390x_nistp_mul() 108 || group->meth->point_set_affine_coordinates(group, r, in ec_GFp_s390x_nistp_mul() 136 const EC_GROUP *group; in ecdsa_s390x_nistp_sign_sig() local 140 group = EC_KEY_get0_group(eckey); in ecdsa_s390x_nistp_sign_sig() 142 if (group == NULL || privkey == NULL) { in ecdsa_s390x_nistp_sign_sig() 232 const EC_GROUP *group; in ecdsa_s390x_nistp_verify_sig() local 236 group = EC_KEY_get0_group(eckey); in ecdsa_s390x_nistp_verify_sig() 248 ctx = BN_CTX_new_ex(group->libctx); in ecdsa_s390x_nistp_verify_sig() [all …]
|
H A D | ecdsa_ossl.c | 42 if (eckey->group->meth->ecdsa_sign_setup == NULL) { in ossl_ecdsa_sign_setup() 54 if (eckey->group->meth->ecdsa_sign_sig == NULL) { in ossl_ecdsa_sign_sig() 66 if (eckey->group->meth->ecdsa_verify_sig == NULL) { in ossl_ecdsa_verify_sig() 142 const EC_GROUP *group; in ecdsa_sign_setup() local 175 if ((tmp_point = EC_POINT_new(group)) == NULL) { in ecdsa_sign_setup() 279 const EC_GROUP *group; in ossl_ecdsa_simple_sign_sig() local 283 group = EC_KEY_get0_group(eckey); in ossl_ecdsa_simple_sign_sig() 286 if (group == NULL) { in ossl_ecdsa_simple_sign_sig() 452 const EC_GROUP *group; in ossl_ecdsa_simple_verify_sig() local 482 order = EC_GROUP_get0_order(group); in ossl_ecdsa_simple_verify_sig() [all …]
|
H A D | ecdh_ossl.c | 31 if (ecdh->group->meth->ecdh_compute_key == NULL) { in ossl_ecdh_compute_key() 36 return ecdh->group->meth->ecdh_compute_key(psec, pseclen, pub_key, ecdh); in ossl_ecdh_compute_key() 56 const EC_GROUP *group; in ossl_ecdh_simple_compute_key() local 76 group = EC_KEY_get0_group(ecdh); in ossl_ecdh_simple_compute_key() 83 if (!EC_GROUP_get_cofactor(group, x, NULL)) { in ossl_ecdh_simple_compute_key() 94 if ((tmp = EC_POINT_new(group)) == NULL) { in ossl_ecdh_simple_compute_key() 99 if (!EC_POINT_mul(group, tmp, NULL, pub_key, priv_key, ctx)) { in ossl_ecdh_simple_compute_key() 109 if (!EC_POINT_get_affine_coordinates(group, tmp, x, NULL, ctx)) { in ossl_ecdh_simple_compute_key() 118 buflen = (EC_GROUP_get_degree(group) + 7) / 8; in ossl_ecdh_simple_compute_key()
|
H A D | ec_asn1.c | 354 if (group->seed) { in ec_asn1_group2curve() 436 tmp = EC_GROUP_get0_order(group); in EC_GROUP_get_ecparameters() 887 EC_GROUP *group = NULL; in d2i_ECPKParameters() local 906 *a = group; in d2i_ECPKParameters() 911 return group; in d2i_ECPKParameters() 951 EC_GROUP_free(ret->group); in d2i_ECPrivateKey() 953 if (ret->group != NULL in d2i_ECPrivateKey() 958 if (ret->group == NULL) { in d2i_ECPrivateKey() 1313 const EC_GROUP *group; in ECDSA_size() local 1318 group = EC_KEY_get0_group(ec); in ECDSA_size() [all …]
|
H A D | ec_curve.c | 3154 EC_GROUP *group = NULL; in ec_group_new_from_data() local 3187 if (!group->meth->group_full_init(group, params)){ in ec_group_new_from_data() 3193 return group; in ec_group_new_from_data() 3206 if (group != NULL) { in ec_group_new_from_data() 3207 if (group->meth->group_set_curve(group, p, a, b, ctx) == 0) { in ec_group_new_from_data() 3299 EC_GROUP_free(group); in ec_group_new_from_data() 3300 group = NULL; in ec_group_new_from_data() 3310 return group; in ec_group_new_from_data() 3389 nid = EC_GROUP_get_curve_name(group); in ossl_ec_curve_nid_from_params() 3392 seed = EC_GROUP_get0_seed(group); in ossl_ec_curve_nid_from_params() [all …]
|
/openssl/test/ |
H A D | ectest.c | 163 EC_GROUP *group = NULL; in prime_field_tests() local 595 EC_GROUP_free(group); in prime_field_tests() 930 EC_GROUP_free(group); in char2_curve_test() 1075 EC_GROUP_free(group); in char2_field_tests() 1130 EC_GROUP_free(group); in hybrid_point_encoding_test() 1152 EC_GROUP_free(group); in internal_curve_test() 1159 EC_GROUP *group; in internal_curve_test_method() local 1166 EC_GROUP_free(group); in internal_curve_test_method() 2028 group = NULL; in parameter_test() 2247 || !TEST_ptr(group = d2i_ECPKParameters(&group, &b2, in cofactor_range_test() [all …]
|
H A D | ec_internal_test.c | 31 if (group->meth->field_inv == NULL || group->meth->field_mul == NULL) in group_field_tests() 39 || !TEST_true(group->meth->field_inv(group, b, BN_value_one(), ctx)) in group_field_tests() 44 || !TEST_true(group->meth->field_inv(group, b, a, ctx)) in group_field_tests() 46 !TEST_true(group->meth->field_encode(group, a, a, ctx))) in group_field_tests() 48 !TEST_true(group->meth->field_encode(group, b, b, ctx))) in group_field_tests() 49 || !TEST_true(group->meth->field_mul(group, c, a, b, ctx)) in group_field_tests() 51 !TEST_true(group->meth->field_decode(group, c, c, ctx))) in group_field_tests() 57 if (!TEST_false(group->meth->field_inv(group, b, a, ctx)) in group_field_tests() 62 || !TEST_false(group->meth->field_inv(group, b, group->field, ctx)) in group_field_tests() 103 if (group != NULL) in field_tests() [all …]
|
H A D | ecstresstest.c | 42 static BIGNUM *walk_curve(const EC_GROUP *group, EC_POINT *point, in walk_curve() argument 49 || !TEST_true(EC_POINT_get_affine_coordinates(group, point, scalar, in walk_curve() 54 if (!TEST_true(EC_POINT_mul(group, point, NULL, point, scalar, NULL)) in walk_curve() 55 || !TEST_true(EC_POINT_get_affine_coordinates(group, point, in walk_curve() 69 EC_GROUP *group = NULL; in test_curve() local 78 if (!TEST_ptr(group = EC_GROUP_new_by_curve_name(NID_X9_62_prime256v1)) in test_curve() 79 || !TEST_ptr(point = EC_POINT_dup(EC_GROUP_get0_generator(group), in test_curve() 80 group)) in test_curve() 81 || !TEST_ptr(result = walk_curve(group, point, num_repeats))) in test_curve() 97 EC_GROUP_free(group); in test_curve()
|
H A D | sm2_internal_test.c | 89 EC_GROUP *group = NULL; in create_EC_group() local 97 group = EC_GROUP_new_curve_GFp(p, a, b, NULL); in create_EC_group() 98 if (!TEST_ptr(group)) in create_EC_group() 101 generator = EC_POINT_new(group); in create_EC_group() 127 EC_GROUP_free(group); in create_EC_group() 128 group = NULL; in create_EC_group() 131 return group; in create_EC_group() 134 static int test_sm2_crypt(const EC_GROUP *group, in test_sm2_crypt() argument 162 pt = EC_POINT_new(group); in test_sm2_crypt() 302 static int test_sm2_sign(const EC_GROUP *group, in test_sm2_sign() argument [all …]
|
/openssl/crypto/ffc/ |
H A D | ffc_dh.c | 133 if (group == NULL) in ossl_ffc_named_group_get_uid() 135 return group->uid; in ossl_ffc_named_group_get_uid() 140 if (group == NULL) in ossl_ffc_named_group_get_name() 142 return group->name; in ossl_ffc_named_group_get_name() 148 if (group == NULL) in ossl_ffc_named_group_get_keylength() 150 return group->keylength; in ossl_ffc_named_group_get_keylength() 155 if (group == NULL) in ossl_ffc_named_group_get_q() 157 return group->q; in ossl_ffc_named_group_get_q() 162 if (ffc == NULL || group == NULL) in ossl_ffc_named_group_set() 165 ossl_ffc_params_set0_pqg(ffc, (BIGNUM *)group->p, (BIGNUM *)group->q, in ossl_ffc_named_group_set() [all …]
|
/openssl/include/openssl/ |
H A D | ec.h | 197 void EC_GROUP_free(EC_GROUP *group); 254 int EC_GROUP_order_bits(const EC_GROUP *group); 275 void EC_GROUP_set_curve_name(EC_GROUP *group, int nid); 281 int EC_GROUP_get_curve_name(const EC_GROUP *group); 293 int EC_GROUP_get_field_type(const EC_GROUP *group); 295 void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag); 296 int EC_GROUP_get_asn1_flag(const EC_GROUP *group); 298 void EC_GROUP_set_point_conversion_form(EC_GROUP *group, 398 int EC_GROUP_get_degree(const EC_GROUP *group); 405 int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx); [all …]
|
/openssl/crypto/dh/ |
H A D | dh_group_params.c | 27 static DH *dh_param_init(OSSL_LIB_CTX *libctx, const DH_NAMED_GROUP *group) in dh_param_init() argument 34 ossl_ffc_named_group_set(&dh->params, group); in dh_param_init() 35 dh->params.nid = ossl_ffc_named_group_get_uid(group); in dh_param_init() 42 const DH_NAMED_GROUP *group; in ossl_dh_new_by_nid_ex() local 44 if ((group = ossl_ffc_uid_to_dh_named_group(nid)) != NULL) in ossl_dh_new_by_nid_ex() 45 return dh_param_init(libctx, group); in ossl_dh_new_by_nid_ex() 58 const DH_NAMED_GROUP *group; in ossl_dh_cache_named_group() local 70 if ((group = ossl_ffc_numbers_to_dh_named_group(dh->params.p, in ossl_dh_cache_named_group() 74 dh->params.q = (BIGNUM *)ossl_ffc_named_group_get_q(group); in ossl_dh_cache_named_group() 76 dh->params.nid = ossl_ffc_named_group_get_uid(group); in ossl_dh_cache_named_group() [all …]
|