diff options
Diffstat (limited to 'src/lib/libcrypto/ec')
| -rw-r--r-- | src/lib/libcrypto/ec/ec2_smpl.c | 79 | ||||
| -rw-r--r-- | src/lib/libcrypto/ec/ec_ameth.c | 64 | ||||
| -rw-r--r-- | src/lib/libcrypto/ec/ec_pmeth.c | 41 | ||||
| -rw-r--r-- | src/lib/libcrypto/ec/ecp_mont.c | 82 | ||||
| -rw-r--r-- | src/lib/libcrypto/ec/ecp_nist.c | 79 | ||||
| -rw-r--r-- | src/lib/libcrypto/ec/ecp_nistp224.c | 84 | ||||
| -rw-r--r-- | src/lib/libcrypto/ec/ecp_nistp256.c | 84 | ||||
| -rw-r--r-- | src/lib/libcrypto/ec/ecp_nistp521.c | 84 | ||||
| -rw-r--r-- | src/lib/libcrypto/ec/ecp_smpl.c | 79 |
9 files changed, 329 insertions, 347 deletions
diff --git a/src/lib/libcrypto/ec/ec2_smpl.c b/src/lib/libcrypto/ec/ec2_smpl.c index 0cf681fa9d..5682bfab37 100644 --- a/src/lib/libcrypto/ec/ec2_smpl.c +++ b/src/lib/libcrypto/ec/ec2_smpl.c | |||
| @@ -73,52 +73,51 @@ | |||
| 73 | 73 | ||
| 74 | #ifndef OPENSSL_NO_EC2M | 74 | #ifndef OPENSSL_NO_EC2M |
| 75 | 75 | ||
| 76 | const EC_METHOD *EC_GF2m_simple_method(void) | 76 | const EC_METHOD * |
| 77 | { | 77 | EC_GF2m_simple_method(void) |
| 78 | { | ||
| 78 | static const EC_METHOD ret = { | 79 | static const EC_METHOD ret = { |
| 79 | EC_FLAGS_DEFAULT_OCT, | 80 | .flags = EC_FLAGS_DEFAULT_OCT, |
| 80 | NID_X9_62_characteristic_two_field, | 81 | .field_type = NID_X9_62_characteristic_two_field, |
| 81 | ec_GF2m_simple_group_init, | 82 | .group_init = ec_GF2m_simple_group_init, |
| 82 | ec_GF2m_simple_group_finish, | 83 | .group_finish = ec_GF2m_simple_group_finish, |
| 83 | ec_GF2m_simple_group_clear_finish, | 84 | .group_clear_finish = ec_GF2m_simple_group_clear_finish, |
| 84 | ec_GF2m_simple_group_copy, | 85 | .group_copy = ec_GF2m_simple_group_copy, |
| 85 | ec_GF2m_simple_group_set_curve, | 86 | .group_set_curve = ec_GF2m_simple_group_set_curve, |
| 86 | ec_GF2m_simple_group_get_curve, | 87 | .group_get_curve = ec_GF2m_simple_group_get_curve, |
| 87 | ec_GF2m_simple_group_get_degree, | 88 | .group_get_degree = ec_GF2m_simple_group_get_degree, |
| 88 | ec_GF2m_simple_group_check_discriminant, | 89 | .group_check_discriminant = |
| 89 | ec_GF2m_simple_point_init, | 90 | ec_GF2m_simple_group_check_discriminant, |
| 90 | ec_GF2m_simple_point_finish, | 91 | .point_init = ec_GF2m_simple_point_init, |
| 91 | ec_GF2m_simple_point_clear_finish, | 92 | .point_finish = ec_GF2m_simple_point_finish, |
| 92 | ec_GF2m_simple_point_copy, | 93 | .point_clear_finish = ec_GF2m_simple_point_clear_finish, |
| 93 | ec_GF2m_simple_point_set_to_infinity, | 94 | .point_copy = ec_GF2m_simple_point_copy, |
| 94 | 0 /* set_Jprojective_coordinates_GFp */, | 95 | .point_set_to_infinity = ec_GF2m_simple_point_set_to_infinity, |
| 95 | 0 /* get_Jprojective_coordinates_GFp */, | 96 | .point_set_affine_coordinates = |
| 96 | ec_GF2m_simple_point_set_affine_coordinates, | 97 | ec_GF2m_simple_point_set_affine_coordinates, |
| 97 | ec_GF2m_simple_point_get_affine_coordinates, | 98 | .point_get_affine_coordinates = |
| 98 | 0,0,0, | 99 | ec_GF2m_simple_point_get_affine_coordinates, |
| 99 | ec_GF2m_simple_add, | 100 | .add = ec_GF2m_simple_add, |
| 100 | ec_GF2m_simple_dbl, | 101 | .dbl = ec_GF2m_simple_dbl, |
| 101 | ec_GF2m_simple_invert, | 102 | .invert = ec_GF2m_simple_invert, |
| 102 | ec_GF2m_simple_is_at_infinity, | 103 | .is_at_infinity = ec_GF2m_simple_is_at_infinity, |
| 103 | ec_GF2m_simple_is_on_curve, | 104 | .is_on_curve = ec_GF2m_simple_is_on_curve, |
| 104 | ec_GF2m_simple_cmp, | 105 | .point_cmp = ec_GF2m_simple_cmp, |
| 105 | ec_GF2m_simple_make_affine, | 106 | .make_affine = ec_GF2m_simple_make_affine, |
| 106 | ec_GF2m_simple_points_make_affine, | 107 | .points_make_affine = ec_GF2m_simple_points_make_affine, |
| 107 | 108 | ||
| 108 | /* the following three method functions are defined in ec2_mult.c */ | 109 | /* the following three method functions are defined in ec2_mult.c */ |
| 109 | ec_GF2m_simple_mul, | 110 | .mul = ec_GF2m_simple_mul, |
| 110 | ec_GF2m_precompute_mult, | 111 | .precompute_mult = ec_GF2m_precompute_mult, |
| 111 | ec_GF2m_have_precompute_mult, | 112 | .have_precompute_mult = ec_GF2m_have_precompute_mult, |
| 112 | 113 | ||
| 113 | ec_GF2m_simple_field_mul, | 114 | .field_mul = ec_GF2m_simple_field_mul, |
| 114 | ec_GF2m_simple_field_sqr, | 115 | .field_sqr = ec_GF2m_simple_field_sqr, |
| 115 | ec_GF2m_simple_field_div, | 116 | .field_div = ec_GF2m_simple_field_div, |
| 116 | 0 /* field_encode */, | 117 | }; |
| 117 | 0 /* field_decode */, | ||
| 118 | 0 /* field_set_to_one */ }; | ||
| 119 | 118 | ||
| 120 | return &ret; | 119 | return &ret; |
| 121 | } | 120 | } |
| 122 | 121 | ||
| 123 | 122 | ||
| 124 | /* Initialize a GF(2^m)-based EC_GROUP structure. | 123 | /* Initialize a GF(2^m)-based EC_GROUP structure. |
diff --git a/src/lib/libcrypto/ec/ec_ameth.c b/src/lib/libcrypto/ec/ec_ameth.c index 79dd11083e..0e6381f543 100644 --- a/src/lib/libcrypto/ec/ec_ameth.c +++ b/src/lib/libcrypto/ec/ec_ameth.c | |||
| @@ -626,36 +626,34 @@ static int ec_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2) | |||
| 626 | 626 | ||
| 627 | } | 627 | } |
| 628 | 628 | ||
| 629 | const EVP_PKEY_ASN1_METHOD eckey_asn1_meth = | 629 | const EVP_PKEY_ASN1_METHOD eckey_asn1_meth = { |
| 630 | { | 630 | .pkey_id = EVP_PKEY_EC, |
| 631 | EVP_PKEY_EC, | 631 | .pkey_base_id = EVP_PKEY_EC, |
| 632 | EVP_PKEY_EC, | 632 | |
| 633 | 0, | 633 | .pem_str = "EC", |
| 634 | "EC", | 634 | .info = "OpenSSL EC algorithm", |
| 635 | "OpenSSL EC algorithm", | 635 | |
| 636 | 636 | .pub_decode = eckey_pub_decode, | |
| 637 | eckey_pub_decode, | 637 | .pub_encode = eckey_pub_encode, |
| 638 | eckey_pub_encode, | 638 | .pub_cmp = eckey_pub_cmp, |
| 639 | eckey_pub_cmp, | 639 | .pub_print = eckey_pub_print, |
| 640 | eckey_pub_print, | 640 | |
| 641 | 641 | .priv_decode = eckey_priv_decode, | |
| 642 | eckey_priv_decode, | 642 | .priv_encode = eckey_priv_encode, |
| 643 | eckey_priv_encode, | 643 | .priv_print = eckey_priv_print, |
| 644 | eckey_priv_print, | 644 | |
| 645 | 645 | .pkey_size = int_ec_size, | |
| 646 | int_ec_size, | 646 | .pkey_bits = ec_bits, |
| 647 | ec_bits, | 647 | |
| 648 | 648 | .param_decode = eckey_param_decode, | |
| 649 | eckey_param_decode, | 649 | .param_encode = eckey_param_encode, |
| 650 | eckey_param_encode, | 650 | .param_missing = ec_missing_parameters, |
| 651 | ec_missing_parameters, | 651 | .param_copy = ec_copy_parameters, |
| 652 | ec_copy_parameters, | 652 | .param_cmp = ec_cmp_parameters, |
| 653 | ec_cmp_parameters, | 653 | .param_print = eckey_param_print, |
| 654 | eckey_param_print, | 654 | |
| 655 | 0, | 655 | .pkey_free = int_ec_free, |
| 656 | 656 | .pkey_ctrl = ec_pkey_ctrl, | |
| 657 | int_ec_free, | 657 | .old_priv_decode = old_ec_priv_decode, |
| 658 | ec_pkey_ctrl, | 658 | .old_priv_encode = old_ec_priv_encode |
| 659 | old_ec_priv_decode, | 659 | }; |
| 660 | old_ec_priv_encode | ||
| 661 | }; | ||
diff --git a/src/lib/libcrypto/ec/ec_pmeth.c b/src/lib/libcrypto/ec/ec_pmeth.c index dfc8ace27b..c970d8c9ca 100644 --- a/src/lib/libcrypto/ec/ec_pmeth.c +++ b/src/lib/libcrypto/ec/ec_pmeth.c | |||
| @@ -304,38 +304,23 @@ static int pkey_ec_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) | |||
| 304 | return EC_KEY_generate_key(pkey->pkey.ec); | 304 | return EC_KEY_generate_key(pkey->pkey.ec); |
| 305 | } | 305 | } |
| 306 | 306 | ||
| 307 | const EVP_PKEY_METHOD ec_pkey_meth = | 307 | const EVP_PKEY_METHOD ec_pkey_meth = { |
| 308 | { | 308 | .pkey_id = EVP_PKEY_EC, |
| 309 | EVP_PKEY_EC, | ||
| 310 | 0, | ||
| 311 | pkey_ec_init, | ||
| 312 | pkey_ec_copy, | ||
| 313 | pkey_ec_cleanup, | ||
| 314 | |||
| 315 | 0, | ||
| 316 | pkey_ec_paramgen, | ||
| 317 | |||
| 318 | 0, | ||
| 319 | pkey_ec_keygen, | ||
| 320 | |||
| 321 | 0, | ||
| 322 | pkey_ec_sign, | ||
| 323 | |||
| 324 | 0, | ||
| 325 | pkey_ec_verify, | ||
| 326 | 309 | ||
| 327 | 0,0, | 310 | .init = pkey_ec_init, |
| 311 | .copy = pkey_ec_copy, | ||
| 312 | .cleanup = pkey_ec_cleanup, | ||
| 328 | 313 | ||
| 329 | 0,0,0,0, | 314 | .paramgen = pkey_ec_paramgen, |
| 330 | 315 | ||
| 331 | 0,0, | 316 | .keygen = pkey_ec_keygen, |
| 332 | 317 | ||
| 333 | 0,0, | 318 | .sign = pkey_ec_sign, |
| 334 | 319 | ||
| 335 | 0, | 320 | .verify = pkey_ec_verify, |
| 336 | pkey_ec_derive, | ||
| 337 | 321 | ||
| 338 | pkey_ec_ctrl, | 322 | .derive = pkey_ec_derive, |
| 339 | pkey_ec_ctrl_str | ||
| 340 | 323 | ||
| 341 | }; | 324 | .ctrl = pkey_ec_ctrl, |
| 325 | .ctrl_str = pkey_ec_ctrl_str | ||
| 326 | }; | ||
diff --git a/src/lib/libcrypto/ec/ecp_mont.c b/src/lib/libcrypto/ec/ecp_mont.c index cee0fee12a..6b5b856344 100644 --- a/src/lib/libcrypto/ec/ecp_mont.c +++ b/src/lib/libcrypto/ec/ecp_mont.c | |||
| @@ -66,49 +66,51 @@ | |||
| 66 | #include "ec_lcl.h" | 66 | #include "ec_lcl.h" |
| 67 | 67 | ||
| 68 | 68 | ||
| 69 | const EC_METHOD *EC_GFp_mont_method(void) | 69 | const EC_METHOD * |
| 70 | { | 70 | EC_GFp_mont_method(void) |
| 71 | { | ||
| 71 | static const EC_METHOD ret = { | 72 | static const EC_METHOD ret = { |
| 72 | EC_FLAGS_DEFAULT_OCT, | 73 | .flags = EC_FLAGS_DEFAULT_OCT, |
| 73 | NID_X9_62_prime_field, | 74 | .field_type = NID_X9_62_prime_field, |
| 74 | ec_GFp_mont_group_init, | 75 | .group_init = ec_GFp_mont_group_init, |
| 75 | ec_GFp_mont_group_finish, | 76 | .group_finish = ec_GFp_mont_group_finish, |
| 76 | ec_GFp_mont_group_clear_finish, | 77 | .group_clear_finish = ec_GFp_mont_group_clear_finish, |
| 77 | ec_GFp_mont_group_copy, | 78 | .group_copy = ec_GFp_mont_group_copy, |
| 78 | ec_GFp_mont_group_set_curve, | 79 | .group_set_curve = ec_GFp_mont_group_set_curve, |
| 79 | ec_GFp_simple_group_get_curve, | 80 | .group_get_curve = ec_GFp_simple_group_get_curve, |
| 80 | ec_GFp_simple_group_get_degree, | 81 | .group_get_degree = ec_GFp_simple_group_get_degree, |
| 81 | ec_GFp_simple_group_check_discriminant, | 82 | .group_check_discriminant = |
| 82 | ec_GFp_simple_point_init, | 83 | ec_GFp_simple_group_check_discriminant, |
| 83 | ec_GFp_simple_point_finish, | 84 | .point_init = ec_GFp_simple_point_init, |
| 84 | ec_GFp_simple_point_clear_finish, | 85 | .point_finish = ec_GFp_simple_point_finish, |
| 85 | ec_GFp_simple_point_copy, | 86 | .point_clear_finish = ec_GFp_simple_point_clear_finish, |
| 86 | ec_GFp_simple_point_set_to_infinity, | 87 | .point_copy = ec_GFp_simple_point_copy, |
| 87 | ec_GFp_simple_set_Jprojective_coordinates_GFp, | 88 | .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity, |
| 88 | ec_GFp_simple_get_Jprojective_coordinates_GFp, | 89 | .point_set_Jprojective_coordinates_GFp = |
| 89 | ec_GFp_simple_point_set_affine_coordinates, | 90 | ec_GFp_simple_set_Jprojective_coordinates_GFp, |
| 90 | ec_GFp_simple_point_get_affine_coordinates, | 91 | .point_get_Jprojective_coordinates_GFp = |
| 91 | 0,0,0, | 92 | ec_GFp_simple_get_Jprojective_coordinates_GFp, |
| 92 | ec_GFp_simple_add, | 93 | .point_set_affine_coordinates = |
| 93 | ec_GFp_simple_dbl, | 94 | ec_GFp_simple_point_set_affine_coordinates, |
| 94 | ec_GFp_simple_invert, | 95 | .point_get_affine_coordinates = |
| 95 | ec_GFp_simple_is_at_infinity, | 96 | ec_GFp_simple_point_get_affine_coordinates, |
| 96 | ec_GFp_simple_is_on_curve, | 97 | .add = ec_GFp_simple_add, |
| 97 | ec_GFp_simple_cmp, | 98 | .dbl = ec_GFp_simple_dbl, |
| 98 | ec_GFp_simple_make_affine, | 99 | .invert = ec_GFp_simple_invert, |
| 99 | ec_GFp_simple_points_make_affine, | 100 | .is_at_infinity = ec_GFp_simple_is_at_infinity, |
| 100 | 0 /* mul */, | 101 | .is_on_curve = ec_GFp_simple_is_on_curve, |
| 101 | 0 /* precompute_mult */, | 102 | .point_cmp = ec_GFp_simple_cmp, |
| 102 | 0 /* have_precompute_mult */, | 103 | .make_affine = ec_GFp_simple_make_affine, |
| 103 | ec_GFp_mont_field_mul, | 104 | .points_make_affine = ec_GFp_simple_points_make_affine, |
| 104 | ec_GFp_mont_field_sqr, | 105 | .field_mul = ec_GFp_mont_field_mul, |
| 105 | 0 /* field_div */, | 106 | .field_sqr = ec_GFp_mont_field_sqr, |
| 106 | ec_GFp_mont_field_encode, | 107 | .field_encode = ec_GFp_mont_field_encode, |
| 107 | ec_GFp_mont_field_decode, | 108 | .field_decode = ec_GFp_mont_field_decode, |
| 108 | ec_GFp_mont_field_set_to_one }; | 109 | .field_set_to_one = ec_GFp_mont_field_set_to_one |
| 110 | }; | ||
| 109 | 111 | ||
| 110 | return &ret; | 112 | return &ret; |
| 111 | } | 113 | } |
| 112 | 114 | ||
| 113 | 115 | ||
| 114 | int ec_GFp_mont_group_init(EC_GROUP *group) | 116 | int ec_GFp_mont_group_init(EC_GROUP *group) |
diff --git a/src/lib/libcrypto/ec/ecp_nist.c b/src/lib/libcrypto/ec/ecp_nist.c index ac5b814238..479cff8fc9 100644 --- a/src/lib/libcrypto/ec/ecp_nist.c +++ b/src/lib/libcrypto/ec/ecp_nist.c | |||
| @@ -67,49 +67,48 @@ | |||
| 67 | #include <openssl/obj_mac.h> | 67 | #include <openssl/obj_mac.h> |
| 68 | #include "ec_lcl.h" | 68 | #include "ec_lcl.h" |
| 69 | 69 | ||
| 70 | const EC_METHOD *EC_GFp_nist_method(void) | 70 | const EC_METHOD * |
| 71 | { | 71 | EC_GFp_nist_method(void) |
| 72 | { | ||
| 72 | static const EC_METHOD ret = { | 73 | static const EC_METHOD ret = { |
| 73 | EC_FLAGS_DEFAULT_OCT, | 74 | .flags = EC_FLAGS_DEFAULT_OCT, |
| 74 | NID_X9_62_prime_field, | 75 | .field_type = NID_X9_62_prime_field, |
| 75 | ec_GFp_simple_group_init, | 76 | .group_init = ec_GFp_simple_group_init, |
| 76 | ec_GFp_simple_group_finish, | 77 | .group_finish = ec_GFp_simple_group_finish, |
| 77 | ec_GFp_simple_group_clear_finish, | 78 | .group_clear_finish = ec_GFp_simple_group_clear_finish, |
| 78 | ec_GFp_nist_group_copy, | 79 | .group_copy = ec_GFp_nist_group_copy, |
| 79 | ec_GFp_nist_group_set_curve, | 80 | .group_set_curve = ec_GFp_nist_group_set_curve, |
| 80 | ec_GFp_simple_group_get_curve, | 81 | .group_get_curve = ec_GFp_simple_group_get_curve, |
| 81 | ec_GFp_simple_group_get_degree, | 82 | .group_get_degree = ec_GFp_simple_group_get_degree, |
| 82 | ec_GFp_simple_group_check_discriminant, | 83 | .group_check_discriminant = |
| 83 | ec_GFp_simple_point_init, | 84 | ec_GFp_simple_group_check_discriminant, |
| 84 | ec_GFp_simple_point_finish, | 85 | .point_init = ec_GFp_simple_point_init, |
| 85 | ec_GFp_simple_point_clear_finish, | 86 | .point_finish = ec_GFp_simple_point_finish, |
| 86 | ec_GFp_simple_point_copy, | 87 | .point_clear_finish = ec_GFp_simple_point_clear_finish, |
| 87 | ec_GFp_simple_point_set_to_infinity, | 88 | .point_copy = ec_GFp_simple_point_copy, |
| 88 | ec_GFp_simple_set_Jprojective_coordinates_GFp, | 89 | .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity, |
| 89 | ec_GFp_simple_get_Jprojective_coordinates_GFp, | 90 | .point_set_Jprojective_coordinates_GFp = |
| 90 | ec_GFp_simple_point_set_affine_coordinates, | 91 | ec_GFp_simple_set_Jprojective_coordinates_GFp, |
| 91 | ec_GFp_simple_point_get_affine_coordinates, | 92 | .point_get_Jprojective_coordinates_GFp = |
| 92 | 0,0,0, | 93 | ec_GFp_simple_get_Jprojective_coordinates_GFp, |
| 93 | ec_GFp_simple_add, | 94 | .point_set_affine_coordinates = |
| 94 | ec_GFp_simple_dbl, | 95 | ec_GFp_simple_point_set_affine_coordinates, |
| 95 | ec_GFp_simple_invert, | 96 | .point_get_affine_coordinates = |
| 96 | ec_GFp_simple_is_at_infinity, | 97 | ec_GFp_simple_point_get_affine_coordinates, |
| 97 | ec_GFp_simple_is_on_curve, | 98 | .add = ec_GFp_simple_add, |
| 98 | ec_GFp_simple_cmp, | 99 | .dbl = ec_GFp_simple_dbl, |
| 99 | ec_GFp_simple_make_affine, | 100 | .invert = ec_GFp_simple_invert, |
| 100 | ec_GFp_simple_points_make_affine, | 101 | .is_at_infinity = ec_GFp_simple_is_at_infinity, |
| 101 | 0 /* mul */, | 102 | .is_on_curve = ec_GFp_simple_is_on_curve, |
| 102 | 0 /* precompute_mult */, | 103 | .point_cmp = ec_GFp_simple_cmp, |
| 103 | 0 /* have_precompute_mult */, | 104 | .make_affine = ec_GFp_simple_make_affine, |
| 104 | ec_GFp_nist_field_mul, | 105 | .points_make_affine = ec_GFp_simple_points_make_affine, |
| 105 | ec_GFp_nist_field_sqr, | 106 | .field_mul = ec_GFp_nist_field_mul, |
| 106 | 0 /* field_div */, | 107 | .field_sqr = ec_GFp_nist_field_sqr |
| 107 | 0 /* field_encode */, | 108 | }; |
| 108 | 0 /* field_decode */, | ||
| 109 | 0 /* field_set_to_one */ }; | ||
| 110 | 109 | ||
| 111 | return &ret; | 110 | return &ret; |
| 112 | } | 111 | } |
| 113 | 112 | ||
| 114 | int ec_GFp_nist_group_copy(EC_GROUP *dest, const EC_GROUP *src) | 113 | int ec_GFp_nist_group_copy(EC_GROUP *dest, const EC_GROUP *src) |
| 115 | { | 114 | { |
diff --git a/src/lib/libcrypto/ec/ecp_nistp224.c b/src/lib/libcrypto/ec/ecp_nistp224.c index 03f2d9c1d7..696024a549 100644 --- a/src/lib/libcrypto/ec/ecp_nistp224.c +++ b/src/lib/libcrypto/ec/ecp_nistp224.c | |||
| @@ -233,51 +233,51 @@ typedef struct { | |||
| 233 | int references; | 233 | int references; |
| 234 | } NISTP224_PRE_COMP; | 234 | } NISTP224_PRE_COMP; |
| 235 | 235 | ||
| 236 | const EC_METHOD *EC_GFp_nistp224_method(void) | 236 | const EC_METHOD * |
| 237 | { | 237 | EC_GFp_nistp224_method(void) |
| 238 | { | ||
| 238 | static const EC_METHOD ret = { | 239 | static const EC_METHOD ret = { |
| 239 | EC_FLAGS_DEFAULT_OCT, | 240 | .flags = EC_FLAGS_DEFAULT_OCT, |
| 240 | NID_X9_62_prime_field, | 241 | .field_type = NID_X9_62_prime_field, |
| 241 | ec_GFp_nistp224_group_init, | 242 | .group_init = ec_GFp_nistp224_group_init, |
| 242 | ec_GFp_simple_group_finish, | 243 | .group_finish = ec_GFp_simple_group_finish, |
| 243 | ec_GFp_simple_group_clear_finish, | 244 | .group_clear_finish = ec_GFp_simple_group_clear_finish, |
| 244 | ec_GFp_nist_group_copy, | 245 | .group_copy = ec_GFp_nist_group_copy, |
| 245 | ec_GFp_nistp224_group_set_curve, | 246 | .group_set_curve = ec_GFp_nistp224_group_set_curve, |
| 246 | ec_GFp_simple_group_get_curve, | 247 | .group_get_curve = ec_GFp_simple_group_get_curve, |
| 247 | ec_GFp_simple_group_get_degree, | 248 | .group_get_degree = ec_GFp_simple_group_get_degree, |
| 248 | ec_GFp_simple_group_check_discriminant, | 249 | .group_check_discriminant = |
| 249 | ec_GFp_simple_point_init, | 250 | ec_GFp_simple_group_check_discriminant, |
| 250 | ec_GFp_simple_point_finish, | 251 | .point_init = ec_GFp_simple_point_init, |
| 251 | ec_GFp_simple_point_clear_finish, | 252 | .point_finish = ec_GFp_simple_point_finish, |
| 252 | ec_GFp_simple_point_copy, | 253 | .point_clear_finish = ec_GFp_simple_point_clear_finish, |
| 253 | ec_GFp_simple_point_set_to_infinity, | 254 | .point_copy = ec_GFp_simple_point_copy, |
| 254 | ec_GFp_simple_set_Jprojective_coordinates_GFp, | 255 | .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity, |
| 255 | ec_GFp_simple_get_Jprojective_coordinates_GFp, | 256 | .point_set_Jprojective_coordinates_GFp = |
| 256 | ec_GFp_simple_point_set_affine_coordinates, | 257 | ec_GFp_simple_set_Jprojective_coordinates_GFp, |
| 257 | ec_GFp_nistp224_point_get_affine_coordinates, | 258 | .point_get_Jprojective_coordinates_GFp = |
| 258 | 0 /* point_set_compressed_coordinates */, | 259 | ec_GFp_simple_get_Jprojective_coordinates_GFp, |
| 259 | 0 /* point2oct */, | 260 | .point_set_affine_coordinates = |
| 260 | 0 /* oct2point */, | 261 | ec_GFp_simple_point_set_affine_coordinates, |
| 261 | ec_GFp_simple_add, | 262 | .point_get_affine_coordinates = |
| 262 | ec_GFp_simple_dbl, | 263 | ec_GFp_nistp224_point_get_affine_coordinates, |
| 263 | ec_GFp_simple_invert, | 264 | .add = ec_GFp_simple_add, |
| 264 | ec_GFp_simple_is_at_infinity, | 265 | .dbl = ec_GFp_simple_dbl, |
| 265 | ec_GFp_simple_is_on_curve, | 266 | .invert = ec_GFp_simple_invert, |
| 266 | ec_GFp_simple_cmp, | 267 | .is_at_infinity = ec_GFp_simple_is_at_infinity, |
| 267 | ec_GFp_simple_make_affine, | 268 | .is_on_curve = ec_GFp_simple_is_on_curve, |
| 268 | ec_GFp_simple_points_make_affine, | 269 | .point_cmp = ec_GFp_simple_cmp, |
| 269 | ec_GFp_nistp224_points_mul, | 270 | .make_affine = ec_GFp_simple_make_affine, |
| 270 | ec_GFp_nistp224_precompute_mult, | 271 | .points_make_affine = ec_GFp_simple_points_make_affine, |
| 271 | ec_GFp_nistp224_have_precompute_mult, | 272 | .mul = ec_GFp_nistp224_points_mul, |
| 272 | ec_GFp_nist_field_mul, | 273 | .precompute_mult = ec_GFp_nistp224_precompute_mult, |
| 273 | ec_GFp_nist_field_sqr, | 274 | .have_precompute_mult = ec_GFp_nistp224_have_precompute_mult, |
| 274 | 0 /* field_div */, | 275 | .field_mul = ec_GFp_nist_field_mul, |
| 275 | 0 /* field_encode */, | 276 | .field_sqr = ec_GFp_nist_field_sqr |
| 276 | 0 /* field_decode */, | 277 | }; |
| 277 | 0 /* field_set_to_one */ }; | ||
| 278 | 278 | ||
| 279 | return &ret; | 279 | return &ret; |
| 280 | } | 280 | } |
| 281 | 281 | ||
| 282 | /* Helper functions to convert field elements to/from internal representation */ | 282 | /* Helper functions to convert field elements to/from internal representation */ |
| 283 | static void bin28_to_felem(felem out, const u8 in[28]) | 283 | static void bin28_to_felem(felem out, const u8 in[28]) |
diff --git a/src/lib/libcrypto/ec/ecp_nistp256.c b/src/lib/libcrypto/ec/ecp_nistp256.c index 947fb7eee0..132ca0d250 100644 --- a/src/lib/libcrypto/ec/ecp_nistp256.c +++ b/src/lib/libcrypto/ec/ecp_nistp256.c | |||
| @@ -1613,51 +1613,51 @@ typedef struct { | |||
| 1613 | int references; | 1613 | int references; |
| 1614 | } NISTP256_PRE_COMP; | 1614 | } NISTP256_PRE_COMP; |
| 1615 | 1615 | ||
| 1616 | const EC_METHOD *EC_GFp_nistp256_method(void) | 1616 | const EC_METHOD * |
| 1617 | { | 1617 | EC_GFp_nistp256_method(void) |
| 1618 | { | ||
| 1618 | static const EC_METHOD ret = { | 1619 | static const EC_METHOD ret = { |
| 1619 | EC_FLAGS_DEFAULT_OCT, | 1620 | .flags = EC_FLAGS_DEFAULT_OCT, |
| 1620 | NID_X9_62_prime_field, | 1621 | .field_type = NID_X9_62_prime_field, |
| 1621 | ec_GFp_nistp256_group_init, | 1622 | .group_init = ec_GFp_nistp256_group_init, |
| 1622 | ec_GFp_simple_group_finish, | 1623 | .group_finish = ec_GFp_simple_group_finish, |
| 1623 | ec_GFp_simple_group_clear_finish, | 1624 | .group_clear_finish = ec_GFp_simple_group_clear_finish, |
| 1624 | ec_GFp_nist_group_copy, | 1625 | .group_copy = ec_GFp_nist_group_copy, |
| 1625 | ec_GFp_nistp256_group_set_curve, | 1626 | .group_set_curve = ec_GFp_nistp256_group_set_curve, |
| 1626 | ec_GFp_simple_group_get_curve, | 1627 | .group_get_curve = ec_GFp_simple_group_get_curve, |
| 1627 | ec_GFp_simple_group_get_degree, | 1628 | .group_get_degree = ec_GFp_simple_group_get_degree, |
| 1628 | ec_GFp_simple_group_check_discriminant, | 1629 | .group_check_discriminant = |
| 1629 | ec_GFp_simple_point_init, | 1630 | ec_GFp_simple_group_check_discriminant, |
| 1630 | ec_GFp_simple_point_finish, | 1631 | .point_init = ec_GFp_simple_point_init, |
| 1631 | ec_GFp_simple_point_clear_finish, | 1632 | .point_finish = ec_GFp_simple_point_finish, |
| 1632 | ec_GFp_simple_point_copy, | 1633 | .point_clear_finish = ec_GFp_simple_point_clear_finish, |
| 1633 | ec_GFp_simple_point_set_to_infinity, | 1634 | .point_copy = ec_GFp_simple_point_copy, |
| 1634 | ec_GFp_simple_set_Jprojective_coordinates_GFp, | 1635 | .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity, |
| 1635 | ec_GFp_simple_get_Jprojective_coordinates_GFp, | 1636 | .point_set_Jprojective_coordinates_GFp = |
| 1636 | ec_GFp_simple_point_set_affine_coordinates, | 1637 | ec_GFp_simple_set_Jprojective_coordinates_GFp, |
| 1637 | ec_GFp_nistp256_point_get_affine_coordinates, | 1638 | .point_get_Jprojective_coordinates_GFp = |
| 1638 | 0 /* point_set_compressed_coordinates */, | 1639 | ec_GFp_simple_get_Jprojective_coordinates_GFp, |
| 1639 | 0 /* point2oct */, | 1640 | .point_set_affine_coordinates = |
| 1640 | 0 /* oct2point */, | 1641 | ec_GFp_simple_point_set_affine_coordinates, |
| 1641 | ec_GFp_simple_add, | 1642 | .point_get_affine_coordinates = |
| 1642 | ec_GFp_simple_dbl, | 1643 | ec_GFp_nistp256_point_get_affine_coordinates, |
| 1643 | ec_GFp_simple_invert, | 1644 | .add = ec_GFp_simple_add, |
| 1644 | ec_GFp_simple_is_at_infinity, | 1645 | .dbl = ec_GFp_simple_dbl, |
| 1645 | ec_GFp_simple_is_on_curve, | 1646 | .invert = ec_GFp_simple_invert, |
| 1646 | ec_GFp_simple_cmp, | 1647 | .is_at_infinity = ec_GFp_simple_is_at_infinity, |
| 1647 | ec_GFp_simple_make_affine, | 1648 | .is_on_curve = ec_GFp_simple_is_on_curve, |
| 1648 | ec_GFp_simple_points_make_affine, | 1649 | .point_cmp = ec_GFp_simple_cmp, |
| 1649 | ec_GFp_nistp256_points_mul, | 1650 | .make_affine = ec_GFp_simple_make_affine, |
| 1650 | ec_GFp_nistp256_precompute_mult, | 1651 | .points_make_affine = ec_GFp_simple_points_make_affine, |
| 1651 | ec_GFp_nistp256_have_precompute_mult, | 1652 | .mul = ec_GFp_nistp256_points_mul, |
| 1652 | ec_GFp_nist_field_mul, | 1653 | .precompute_mult = ec_GFp_nistp256_precompute_mult, |
| 1653 | ec_GFp_nist_field_sqr, | 1654 | .have_precompute_mult = ec_GFp_nistp256_have_precompute_mult, |
| 1654 | 0 /* field_div */, | 1655 | .field_mul = ec_GFp_nist_field_mul, |
| 1655 | 0 /* field_encode */, | 1656 | .field_sqr = ec_GFp_nist_field_sqr |
| 1656 | 0 /* field_decode */, | 1657 | }; |
| 1657 | 0 /* field_set_to_one */ }; | ||
| 1658 | 1658 | ||
| 1659 | return &ret; | 1659 | return &ret; |
| 1660 | } | 1660 | } |
| 1661 | 1661 | ||
| 1662 | /******************************************************************************/ | 1662 | /******************************************************************************/ |
| 1663 | /* FUNCTIONS TO MANAGE PRECOMPUTATION | 1663 | /* FUNCTIONS TO MANAGE PRECOMPUTATION |
diff --git a/src/lib/libcrypto/ec/ecp_nistp521.c b/src/lib/libcrypto/ec/ecp_nistp521.c index 24eb032951..c34c38b7e8 100644 --- a/src/lib/libcrypto/ec/ecp_nistp521.c +++ b/src/lib/libcrypto/ec/ecp_nistp521.c | |||
| @@ -1479,51 +1479,51 @@ typedef struct { | |||
| 1479 | int references; | 1479 | int references; |
| 1480 | } NISTP521_PRE_COMP; | 1480 | } NISTP521_PRE_COMP; |
| 1481 | 1481 | ||
| 1482 | const EC_METHOD *EC_GFp_nistp521_method(void) | 1482 | const EC_METHOD * |
| 1483 | { | 1483 | EC_GFp_nistp521_method(void) |
| 1484 | { | ||
| 1484 | static const EC_METHOD ret = { | 1485 | static const EC_METHOD ret = { |
| 1485 | EC_FLAGS_DEFAULT_OCT, | 1486 | .flags = EC_FLAGS_DEFAULT_OCT, |
| 1486 | NID_X9_62_prime_field, | 1487 | .field_type = NID_X9_62_prime_field, |
| 1487 | ec_GFp_nistp521_group_init, | 1488 | .group_init = ec_GFp_nistp521_group_init, |
| 1488 | ec_GFp_simple_group_finish, | 1489 | .group_finish = ec_GFp_simple_group_finish, |
| 1489 | ec_GFp_simple_group_clear_finish, | 1490 | .group_clear_finish = ec_GFp_simple_group_clear_finish, |
| 1490 | ec_GFp_nist_group_copy, | 1491 | .group_copy = ec_GFp_nist_group_copy, |
| 1491 | ec_GFp_nistp521_group_set_curve, | 1492 | .group_set_curve = ec_GFp_nistp521_group_set_curve, |
| 1492 | ec_GFp_simple_group_get_curve, | 1493 | .group_get_curve = ec_GFp_simple_group_get_curve, |
| 1493 | ec_GFp_simple_group_get_degree, | 1494 | .group_get_degree = ec_GFp_simple_group_get_degree, |
| 1494 | ec_GFp_simple_group_check_discriminant, | 1495 | .group_check_discriminant = |
| 1495 | ec_GFp_simple_point_init, | 1496 | ec_GFp_simple_group_check_discriminant, |
| 1496 | ec_GFp_simple_point_finish, | 1497 | .point_init = ec_GFp_simple_point_init, |
| 1497 | ec_GFp_simple_point_clear_finish, | 1498 | .point_finish = ec_GFp_simple_point_finish, |
| 1498 | ec_GFp_simple_point_copy, | 1499 | .point_clear_finish = ec_GFp_simple_point_clear_finish, |
| 1499 | ec_GFp_simple_point_set_to_infinity, | 1500 | .point_copy = ec_GFp_simple_point_copy, |
| 1500 | ec_GFp_simple_set_Jprojective_coordinates_GFp, | 1501 | .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity, |
| 1501 | ec_GFp_simple_get_Jprojective_coordinates_GFp, | 1502 | .point_set_Jprojective_coordinates_GFp = |
| 1502 | ec_GFp_simple_point_set_affine_coordinates, | 1503 | ec_GFp_simple_set_Jprojective_coordinates_GFp, |
| 1503 | ec_GFp_nistp521_point_get_affine_coordinates, | 1504 | .point_get_Jprojective_coordinates_GFp = |
| 1504 | 0 /* point_set_compressed_coordinates */, | 1505 | ec_GFp_simple_get_Jprojective_coordinates_GFp, |
| 1505 | 0 /* point2oct */, | 1506 | .point_set_affine_coordinates = |
| 1506 | 0 /* oct2point */, | 1507 | ec_GFp_simple_point_set_affine_coordinates, |
| 1507 | ec_GFp_simple_add, | 1508 | .point_get_affine_coordinates = |
| 1508 | ec_GFp_simple_dbl, | 1509 | ec_GFp_nistp521_point_get_affine_coordinates, |
| 1509 | ec_GFp_simple_invert, | 1510 | .add = ec_GFp_simple_add, |
| 1510 | ec_GFp_simple_is_at_infinity, | 1511 | .dbl = ec_GFp_simple_dbl, |
| 1511 | ec_GFp_simple_is_on_curve, | 1512 | .invert = ec_GFp_simple_invert, |
| 1512 | ec_GFp_simple_cmp, | 1513 | .is_at_infinity = ec_GFp_simple_is_at_infinity, |
| 1513 | ec_GFp_simple_make_affine, | 1514 | .is_on_curve = ec_GFp_simple_is_on_curve, |
| 1514 | ec_GFp_simple_points_make_affine, | 1515 | .point_cmp = ec_GFp_simple_cmp, |
| 1515 | ec_GFp_nistp521_points_mul, | 1516 | .make_affine = ec_GFp_simple_make_affine, |
| 1516 | ec_GFp_nistp521_precompute_mult, | 1517 | .points_make_affine = ec_GFp_simple_points_make_affine, |
| 1517 | ec_GFp_nistp521_have_precompute_mult, | 1518 | .mul = ec_GFp_nistp521_points_mul, |
| 1518 | ec_GFp_nist_field_mul, | 1519 | .precompute_mult = ec_GFp_nistp521_precompute_mult, |
| 1519 | ec_GFp_nist_field_sqr, | 1520 | .have_precompulte_mult = ec_GFp_nistp521_have_precompute_mult, |
| 1520 | 0 /* field_div */, | 1521 | .field_mul = ec_GFp_nist_field_mul, |
| 1521 | 0 /* field_encode */, | 1522 | .field_sqr = ec_GFp_nist_field_sqr |
| 1522 | 0 /* field_decode */, | 1523 | }; |
| 1523 | 0 /* field_set_to_one */ }; | ||
| 1524 | 1524 | ||
| 1525 | return &ret; | 1525 | return &ret; |
| 1526 | } | 1526 | } |
| 1527 | 1527 | ||
| 1528 | 1528 | ||
| 1529 | /******************************************************************************/ | 1529 | /******************************************************************************/ |
diff --git a/src/lib/libcrypto/ec/ecp_smpl.c b/src/lib/libcrypto/ec/ecp_smpl.c index a146752817..c99348f08f 100644 --- a/src/lib/libcrypto/ec/ecp_smpl.c +++ b/src/lib/libcrypto/ec/ecp_smpl.c | |||
| @@ -66,49 +66,48 @@ | |||
| 66 | 66 | ||
| 67 | #include "ec_lcl.h" | 67 | #include "ec_lcl.h" |
| 68 | 68 | ||
| 69 | const EC_METHOD *EC_GFp_simple_method(void) | 69 | const EC_METHOD * |
| 70 | { | 70 | EC_GFp_simple_method(void) |
| 71 | { | ||
| 71 | static const EC_METHOD ret = { | 72 | static const EC_METHOD ret = { |
| 72 | EC_FLAGS_DEFAULT_OCT, | 73 | .flags = EC_FLAGS_DEFAULT_OCT, |
| 73 | NID_X9_62_prime_field, | 74 | .field_type = NID_X9_62_prime_field, |
| 74 | ec_GFp_simple_group_init, | 75 | .group_init = ec_GFp_simple_group_init, |
| 75 | ec_GFp_simple_group_finish, | 76 | .group_finish = ec_GFp_simple_group_finish, |
| 76 | ec_GFp_simple_group_clear_finish, | 77 | .group_clear_finish = ec_GFp_simple_group_clear_finish, |
| 77 | ec_GFp_simple_group_copy, | 78 | .group_copy = ec_GFp_simple_group_copy, |
| 78 | ec_GFp_simple_group_set_curve, | 79 | .group_set_curve = ec_GFp_simple_group_set_curve, |
| 79 | ec_GFp_simple_group_get_curve, | 80 | .group_get_curve = ec_GFp_simple_group_get_curve, |
| 80 | ec_GFp_simple_group_get_degree, | 81 | .group_get_degree = ec_GFp_simple_group_get_degree, |
| 81 | ec_GFp_simple_group_check_discriminant, | 82 | .group_check_discriminant = |
| 82 | ec_GFp_simple_point_init, | 83 | ec_GFp_simple_group_check_discriminant, |
| 83 | ec_GFp_simple_point_finish, | 84 | .point_init = ec_GFp_simple_point_init, |
| 84 | ec_GFp_simple_point_clear_finish, | 85 | .point_finish = ec_GFp_simple_point_finish, |
| 85 | ec_GFp_simple_point_copy, | 86 | .point_clear_finish = ec_GFp_simple_point_clear_finish, |
| 86 | ec_GFp_simple_point_set_to_infinity, | 87 | .point_copy = ec_GFp_simple_point_copy, |
| 87 | ec_GFp_simple_set_Jprojective_coordinates_GFp, | 88 | .point_set_to_infinity = ec_GFp_simple_point_set_to_infinity, |
| 88 | ec_GFp_simple_get_Jprojective_coordinates_GFp, | 89 | .point_set_Jprojective_coordinates_GFp = |
| 89 | ec_GFp_simple_point_set_affine_coordinates, | 90 | ec_GFp_simple_set_Jprojective_coordinates_GFp, |
| 90 | ec_GFp_simple_point_get_affine_coordinates, | 91 | .point_get_Jprojective_coordinates_GFp = |
| 91 | 0,0,0, | 92 | ec_GFp_simple_get_Jprojective_coordinates_GFp, |
| 92 | ec_GFp_simple_add, | 93 | .point_set_affine_coordinates = |
| 93 | ec_GFp_simple_dbl, | 94 | ec_GFp_simple_point_set_affine_coordinates, |
| 94 | ec_GFp_simple_invert, | 95 | .point_get_affine_coordinates = |
| 95 | ec_GFp_simple_is_at_infinity, | 96 | ec_GFp_simple_point_get_affine_coordinates, |
| 96 | ec_GFp_simple_is_on_curve, | 97 | .add = ec_GFp_simple_add, |
| 97 | ec_GFp_simple_cmp, | 98 | .dbl = ec_GFp_simple_dbl, |
| 98 | ec_GFp_simple_make_affine, | 99 | .invert = ec_GFp_simple_invert, |
| 99 | ec_GFp_simple_points_make_affine, | 100 | .is_at_infinity = ec_GFp_simple_is_at_infinity, |
| 100 | 0 /* mul */, | 101 | .is_on_curve = ec_GFp_simple_is_on_curve, |
| 101 | 0 /* precompute_mult */, | 102 | .point_cmp = ec_GFp_simple_cmp, |
| 102 | 0 /* have_precompute_mult */, | 103 | .make_affine = ec_GFp_simple_make_affine, |
| 103 | ec_GFp_simple_field_mul, | 104 | .points_make_affine = ec_GFp_simple_points_make_affine, |
| 104 | ec_GFp_simple_field_sqr, | 105 | .field_mul = ec_GFp_simple_field_mul, |
| 105 | 0 /* field_div */, | 106 | .field_sqr = ec_GFp_simple_field_sqr |
| 106 | 0 /* field_encode */, | 107 | }; |
| 107 | 0 /* field_decode */, | ||
| 108 | 0 /* field_set_to_one */ }; | ||
| 109 | 108 | ||
| 110 | return &ret; | 109 | return &ret; |
| 111 | } | 110 | } |
| 112 | 111 | ||
| 113 | 112 | ||
| 114 | /* Most method functions in this file are designed to work with | 113 | /* Most method functions in this file are designed to work with |
