diff options
Diffstat (limited to 'src/lib/libcrypto/ec/ec.h')
| -rw-r--r-- | src/lib/libcrypto/ec/ec.h | 69 |
1 files changed, 5 insertions, 64 deletions
diff --git a/src/lib/libcrypto/ec/ec.h b/src/lib/libcrypto/ec/ec.h index 9d01325af3..ee7078130c 100644 --- a/src/lib/libcrypto/ec/ec.h +++ b/src/lib/libcrypto/ec/ec.h | |||
| @@ -151,24 +151,7 @@ const EC_METHOD *EC_GFp_mont_method(void); | |||
| 151 | */ | 151 | */ |
| 152 | const EC_METHOD *EC_GFp_nist_method(void); | 152 | const EC_METHOD *EC_GFp_nist_method(void); |
| 153 | 153 | ||
| 154 | #ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 | ||
| 155 | /** Returns 64-bit optimized methods for nistp224 | ||
| 156 | * \return EC_METHOD object | ||
| 157 | */ | ||
| 158 | const EC_METHOD *EC_GFp_nistp224_method(void); | ||
| 159 | |||
| 160 | /** Returns 64-bit optimized methods for nistp256 | ||
| 161 | * \return EC_METHOD object | ||
| 162 | */ | ||
| 163 | const EC_METHOD *EC_GFp_nistp256_method(void); | ||
| 164 | |||
| 165 | /** Returns 64-bit optimized methods for nistp521 | ||
| 166 | * \return EC_METHOD object | ||
| 167 | */ | ||
| 168 | const EC_METHOD *EC_GFp_nistp521_method(void); | ||
| 169 | #endif | ||
| 170 | 154 | ||
| 171 | #ifndef OPENSSL_NO_EC2M | ||
| 172 | /********************************************************************/ | 155 | /********************************************************************/ |
| 173 | /* EC_METHOD for curves over GF(2^m) */ | 156 | /* EC_METHOD for curves over GF(2^m) */ |
| 174 | /********************************************************************/ | 157 | /********************************************************************/ |
| @@ -178,8 +161,6 @@ const EC_METHOD *EC_GFp_nistp521_method(void); | |||
| 178 | */ | 161 | */ |
| 179 | const EC_METHOD *EC_GF2m_simple_method(void); | 162 | const EC_METHOD *EC_GF2m_simple_method(void); |
| 180 | 163 | ||
| 181 | #endif | ||
| 182 | |||
| 183 | 164 | ||
| 184 | /********************************************************************/ | 165 | /********************************************************************/ |
| 185 | /* EC_GROUP functions */ | 166 | /* EC_GROUP functions */ |
| @@ -301,7 +282,6 @@ int EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, co | |||
| 301 | */ | 282 | */ |
| 302 | int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *ctx); | 283 | int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *ctx); |
| 303 | 284 | ||
| 304 | #ifndef OPENSSL_NO_EC2M | ||
| 305 | /** Sets the parameter of a ec over GF2m defined by y^2 + x*y = x^3 + a*x^2 + b | 285 | /** Sets the parameter of a ec over GF2m defined by y^2 + x*y = x^3 + a*x^2 + b |
| 306 | * \param group EC_GROUP object | 286 | * \param group EC_GROUP object |
| 307 | * \param p BIGNUM with the polynomial defining the underlying field | 287 | * \param p BIGNUM with the polynomial defining the underlying field |
| @@ -321,7 +301,7 @@ int EC_GROUP_set_curve_GF2m(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, c | |||
| 321 | * \return 1 on success and 0 if an error occured | 301 | * \return 1 on success and 0 if an error occured |
| 322 | */ | 302 | */ |
| 323 | int EC_GROUP_get_curve_GF2m(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *ctx); | 303 | int EC_GROUP_get_curve_GF2m(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *ctx); |
| 324 | #endif | 304 | |
| 325 | /** Returns the number of bits needed to represent a field element | 305 | /** Returns the number of bits needed to represent a field element |
| 326 | * \param group EC_GROUP object | 306 | * \param group EC_GROUP object |
| 327 | * \return number of bits needed to represent a field element | 307 | * \return number of bits needed to represent a field element |
| @@ -362,7 +342,7 @@ int EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx); | |||
| 362 | * \return newly created EC_GROUP object with the specified parameters | 342 | * \return newly created EC_GROUP object with the specified parameters |
| 363 | */ | 343 | */ |
| 364 | EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); | 344 | EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); |
| 365 | #ifndef OPENSSL_NO_EC2M | 345 | |
| 366 | /** Creates a new EC_GROUP object with the specified parameters defined | 346 | /** Creates a new EC_GROUP object with the specified parameters defined |
| 367 | * over GF2m (defined by the equation y^2 + x*y = x^3 + a*x^2 + b) | 347 | * over GF2m (defined by the equation y^2 + x*y = x^3 + a*x^2 + b) |
| 368 | * \param p BIGNUM with the polynomial defining the underlying field | 348 | * \param p BIGNUM with the polynomial defining the underlying field |
| @@ -372,7 +352,7 @@ EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, const BIGNUM | |||
| 372 | * \return newly created EC_GROUP object with the specified parameters | 352 | * \return newly created EC_GROUP object with the specified parameters |
| 373 | */ | 353 | */ |
| 374 | EC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); | 354 | EC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); |
| 375 | #endif | 355 | |
| 376 | /** Creates a EC_GROUP object with a curve specified by a NID | 356 | /** Creates a EC_GROUP object with a curve specified by a NID |
| 377 | * \param nid NID of the OID of the curve name | 357 | * \param nid NID of the OID of the curve name |
| 378 | * \return newly created EC_GROUP object with specified curve or NULL | 358 | * \return newly created EC_GROUP object with specified curve or NULL |
| @@ -501,7 +481,7 @@ int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group, | |||
| 501 | */ | 481 | */ |
| 502 | int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group, EC_POINT *p, | 482 | int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group, EC_POINT *p, |
| 503 | const BIGNUM *x, int y_bit, BN_CTX *ctx); | 483 | const BIGNUM *x, int y_bit, BN_CTX *ctx); |
| 504 | #ifndef OPENSSL_NO_EC2M | 484 | |
| 505 | /** Sets the affine coordinates of a EC_POINT over GF2m | 485 | /** Sets the affine coordinates of a EC_POINT over GF2m |
| 506 | * \param group underlying EC_GROUP object | 486 | * \param group underlying EC_GROUP object |
| 507 | * \param p EC_POINT object | 487 | * \param p EC_POINT object |
| @@ -534,7 +514,7 @@ int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group, | |||
| 534 | */ | 514 | */ |
| 535 | int EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *group, EC_POINT *p, | 515 | int EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *group, EC_POINT *p, |
| 536 | const BIGNUM *x, int y_bit, BN_CTX *ctx); | 516 | const BIGNUM *x, int y_bit, BN_CTX *ctx); |
| 537 | #endif | 517 | |
| 538 | /** Encodes a EC_POINT object to a octet string | 518 | /** Encodes a EC_POINT object to a octet string |
| 539 | * \param group underlying EC_GROUP object | 519 | * \param group underlying EC_GROUP object |
| 540 | * \param p EC_POINT object | 520 | * \param p EC_POINT object |
| @@ -673,11 +653,9 @@ int EC_GROUP_have_precompute_mult(const EC_GROUP *group); | |||
| 673 | /* EC_GROUP_get_basis_type() returns the NID of the basis type | 653 | /* EC_GROUP_get_basis_type() returns the NID of the basis type |
| 674 | * used to represent the field elements */ | 654 | * used to represent the field elements */ |
| 675 | int EC_GROUP_get_basis_type(const EC_GROUP *); | 655 | int EC_GROUP_get_basis_type(const EC_GROUP *); |
| 676 | #ifndef OPENSSL_NO_EC2M | ||
| 677 | int EC_GROUP_get_trinomial_basis(const EC_GROUP *, unsigned int *k); | 656 | int EC_GROUP_get_trinomial_basis(const EC_GROUP *, unsigned int *k); |
| 678 | int EC_GROUP_get_pentanomial_basis(const EC_GROUP *, unsigned int *k1, | 657 | int EC_GROUP_get_pentanomial_basis(const EC_GROUP *, unsigned int *k1, |
| 679 | unsigned int *k2, unsigned int *k3); | 658 | unsigned int *k2, unsigned int *k3); |
| 680 | #endif | ||
| 681 | 659 | ||
| 682 | #define OPENSSL_EC_NAMED_CURVE 0x001 | 660 | #define OPENSSL_EC_NAMED_CURVE 0x001 |
| 683 | 661 | ||
| @@ -711,21 +689,11 @@ typedef struct ec_key_st EC_KEY; | |||
| 711 | #define EC_PKEY_NO_PARAMETERS 0x001 | 689 | #define EC_PKEY_NO_PARAMETERS 0x001 |
| 712 | #define EC_PKEY_NO_PUBKEY 0x002 | 690 | #define EC_PKEY_NO_PUBKEY 0x002 |
| 713 | 691 | ||
| 714 | /* some values for the flags field */ | ||
| 715 | #define EC_FLAG_NON_FIPS_ALLOW 0x1 | ||
| 716 | #define EC_FLAG_FIPS_CHECKED 0x2 | ||
| 717 | |||
| 718 | /** Creates a new EC_KEY object. | 692 | /** Creates a new EC_KEY object. |
| 719 | * \return EC_KEY object or NULL if an error occurred. | 693 | * \return EC_KEY object or NULL if an error occurred. |
| 720 | */ | 694 | */ |
| 721 | EC_KEY *EC_KEY_new(void); | 695 | EC_KEY *EC_KEY_new(void); |
| 722 | 696 | ||
| 723 | int EC_KEY_get_flags(const EC_KEY *key); | ||
| 724 | |||
| 725 | void EC_KEY_set_flags(EC_KEY *key, int flags); | ||
| 726 | |||
| 727 | void EC_KEY_clear_flags(EC_KEY *key, int flags); | ||
| 728 | |||
| 729 | /** Creates a new EC_KEY object using a named curve as underlying | 697 | /** Creates a new EC_KEY object using a named curve as underlying |
| 730 | * EC_GROUP object. | 698 | * EC_GROUP object. |
| 731 | * \param nid NID of the named curve. | 699 | * \param nid NID of the named curve. |
| @@ -831,15 +799,6 @@ int EC_KEY_generate_key(EC_KEY *key); | |||
| 831 | */ | 799 | */ |
| 832 | int EC_KEY_check_key(const EC_KEY *key); | 800 | int EC_KEY_check_key(const EC_KEY *key); |
| 833 | 801 | ||
| 834 | /** Sets a public key from affine coordindates performing | ||
| 835 | * neccessary NIST PKV tests. | ||
| 836 | * \param key the EC_KEY object | ||
| 837 | * \param x public key x coordinate | ||
| 838 | * \param y public key y coordinate | ||
| 839 | * \return 1 on success and 0 otherwise. | ||
| 840 | */ | ||
| 841 | int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x, BIGNUM *y); | ||
| 842 | |||
| 843 | 802 | ||
| 844 | /********************************************************************/ | 803 | /********************************************************************/ |
| 845 | /* de- and encoding functions for SEC1 ECPrivateKey */ | 804 | /* de- and encoding functions for SEC1 ECPrivateKey */ |
| @@ -967,7 +926,6 @@ void ERR_load_EC_strings(void); | |||
| 967 | /* Error codes for the EC functions. */ | 926 | /* Error codes for the EC functions. */ |
| 968 | 927 | ||
| 969 | /* Function codes. */ | 928 | /* Function codes. */ |
| 970 | #define EC_F_BN_TO_FELEM 224 | ||
| 971 | #define EC_F_COMPUTE_WNAF 143 | 929 | #define EC_F_COMPUTE_WNAF 143 |
| 972 | #define EC_F_D2I_ECPARAMETERS 144 | 930 | #define EC_F_D2I_ECPARAMETERS 144 |
| 973 | #define EC_F_D2I_ECPKPARAMETERS 145 | 931 | #define EC_F_D2I_ECPKPARAMETERS 145 |
| @@ -1010,15 +968,6 @@ void ERR_load_EC_strings(void); | |||
| 1010 | #define EC_F_EC_GFP_MONT_FIELD_SQR 132 | 968 | #define EC_F_EC_GFP_MONT_FIELD_SQR 132 |
| 1011 | #define EC_F_EC_GFP_MONT_GROUP_SET_CURVE 189 | 969 | #define EC_F_EC_GFP_MONT_GROUP_SET_CURVE 189 |
| 1012 | #define EC_F_EC_GFP_MONT_GROUP_SET_CURVE_GFP 135 | 970 | #define EC_F_EC_GFP_MONT_GROUP_SET_CURVE_GFP 135 |
| 1013 | #define EC_F_EC_GFP_NISTP224_GROUP_SET_CURVE 225 | ||
| 1014 | #define EC_F_EC_GFP_NISTP224_POINTS_MUL 228 | ||
| 1015 | #define EC_F_EC_GFP_NISTP224_POINT_GET_AFFINE_COORDINATES 226 | ||
| 1016 | #define EC_F_EC_GFP_NISTP256_GROUP_SET_CURVE 230 | ||
| 1017 | #define EC_F_EC_GFP_NISTP256_POINTS_MUL 231 | ||
| 1018 | #define EC_F_EC_GFP_NISTP256_POINT_GET_AFFINE_COORDINATES 232 | ||
| 1019 | #define EC_F_EC_GFP_NISTP521_GROUP_SET_CURVE 233 | ||
| 1020 | #define EC_F_EC_GFP_NISTP521_POINTS_MUL 234 | ||
| 1021 | #define EC_F_EC_GFP_NISTP521_POINT_GET_AFFINE_COORDINATES 235 | ||
| 1022 | #define EC_F_EC_GFP_NIST_FIELD_MUL 200 | 971 | #define EC_F_EC_GFP_NIST_FIELD_MUL 200 |
| 1023 | #define EC_F_EC_GFP_NIST_FIELD_SQR 201 | 972 | #define EC_F_EC_GFP_NIST_FIELD_SQR 201 |
| 1024 | #define EC_F_EC_GFP_NIST_GROUP_SET_CURVE 202 | 973 | #define EC_F_EC_GFP_NIST_GROUP_SET_CURVE 202 |
| @@ -1061,7 +1010,6 @@ void ERR_load_EC_strings(void); | |||
| 1061 | #define EC_F_EC_KEY_NEW 182 | 1010 | #define EC_F_EC_KEY_NEW 182 |
| 1062 | #define EC_F_EC_KEY_PRINT 180 | 1011 | #define EC_F_EC_KEY_PRINT 180 |
| 1063 | #define EC_F_EC_KEY_PRINT_FP 181 | 1012 | #define EC_F_EC_KEY_PRINT_FP 181 |
| 1064 | #define EC_F_EC_KEY_SET_PUBLIC_KEY_AFFINE_COORDINATES 229 | ||
| 1065 | #define EC_F_EC_POINTS_MAKE_AFFINE 136 | 1013 | #define EC_F_EC_POINTS_MAKE_AFFINE 136 |
| 1066 | #define EC_F_EC_POINT_ADD 112 | 1014 | #define EC_F_EC_POINT_ADD 112 |
| 1067 | #define EC_F_EC_POINT_CMP 113 | 1015 | #define EC_F_EC_POINT_CMP 113 |
| @@ -1092,9 +1040,6 @@ void ERR_load_EC_strings(void); | |||
| 1092 | #define EC_F_I2D_ECPKPARAMETERS 191 | 1040 | #define EC_F_I2D_ECPKPARAMETERS 191 |
| 1093 | #define EC_F_I2D_ECPRIVATEKEY 192 | 1041 | #define EC_F_I2D_ECPRIVATEKEY 192 |
| 1094 | #define EC_F_I2O_ECPUBLICKEY 151 | 1042 | #define EC_F_I2O_ECPUBLICKEY 151 |
| 1095 | #define EC_F_NISTP224_PRE_COMP_NEW 227 | ||
| 1096 | #define EC_F_NISTP256_PRE_COMP_NEW 236 | ||
| 1097 | #define EC_F_NISTP521_PRE_COMP_NEW 237 | ||
| 1098 | #define EC_F_O2I_ECPUBLICKEY 152 | 1043 | #define EC_F_O2I_ECPUBLICKEY 152 |
| 1099 | #define EC_F_OLD_EC_PRIV_DECODE 222 | 1044 | #define EC_F_OLD_EC_PRIV_DECODE 222 |
| 1100 | #define EC_F_PKEY_EC_CTRL 197 | 1045 | #define EC_F_PKEY_EC_CTRL 197 |
| @@ -1107,15 +1052,12 @@ void ERR_load_EC_strings(void); | |||
| 1107 | /* Reason codes. */ | 1052 | /* Reason codes. */ |
| 1108 | #define EC_R_ASN1_ERROR 115 | 1053 | #define EC_R_ASN1_ERROR 115 |
| 1109 | #define EC_R_ASN1_UNKNOWN_FIELD 116 | 1054 | #define EC_R_ASN1_UNKNOWN_FIELD 116 |
| 1110 | #define EC_R_BIGNUM_OUT_OF_RANGE 144 | ||
| 1111 | #define EC_R_BUFFER_TOO_SMALL 100 | 1055 | #define EC_R_BUFFER_TOO_SMALL 100 |
| 1112 | #define EC_R_COORDINATES_OUT_OF_RANGE 146 | ||
| 1113 | #define EC_R_D2I_ECPKPARAMETERS_FAILURE 117 | 1056 | #define EC_R_D2I_ECPKPARAMETERS_FAILURE 117 |
| 1114 | #define EC_R_DECODE_ERROR 142 | 1057 | #define EC_R_DECODE_ERROR 142 |
| 1115 | #define EC_R_DISCRIMINANT_IS_ZERO 118 | 1058 | #define EC_R_DISCRIMINANT_IS_ZERO 118 |
| 1116 | #define EC_R_EC_GROUP_NEW_BY_NAME_FAILURE 119 | 1059 | #define EC_R_EC_GROUP_NEW_BY_NAME_FAILURE 119 |
| 1117 | #define EC_R_FIELD_TOO_LARGE 143 | 1060 | #define EC_R_FIELD_TOO_LARGE 143 |
| 1118 | #define EC_R_GF2M_NOT_SUPPORTED 147 | ||
| 1119 | #define EC_R_GROUP2PKPARAMETERS_FAILURE 120 | 1061 | #define EC_R_GROUP2PKPARAMETERS_FAILURE 120 |
| 1120 | #define EC_R_I2D_ECPKPARAMETERS_FAILURE 121 | 1062 | #define EC_R_I2D_ECPKPARAMETERS_FAILURE 121 |
| 1121 | #define EC_R_INCOMPATIBLE_OBJECTS 101 | 1063 | #define EC_R_INCOMPATIBLE_OBJECTS 101 |
| @@ -1150,7 +1092,6 @@ void ERR_load_EC_strings(void); | |||
| 1150 | #define EC_R_UNKNOWN_GROUP 129 | 1092 | #define EC_R_UNKNOWN_GROUP 129 |
| 1151 | #define EC_R_UNKNOWN_ORDER 114 | 1093 | #define EC_R_UNKNOWN_ORDER 114 |
| 1152 | #define EC_R_UNSUPPORTED_FIELD 131 | 1094 | #define EC_R_UNSUPPORTED_FIELD 131 |
| 1153 | #define EC_R_WRONG_CURVE_PARAMETERS 145 | ||
| 1154 | #define EC_R_WRONG_ORDER 130 | 1095 | #define EC_R_WRONG_ORDER 130 |
| 1155 | 1096 | ||
| 1156 | #ifdef __cplusplus | 1097 | #ifdef __cplusplus |
