For now disable EC_GFp_nistp224_method() for WIN32 so the WIN32 build
[openssl.git] / crypto / ec / ec.h
index b937f6419ada8d95b975550e0207fef68ff0f99f..5f92cdd83d1dbf7e3ace2b31051cbb76fc5e0ec3 100644 (file)
@@ -96,6 +96,11 @@ extern "C" {
 # endif
 #endif
 
+  
+#ifndef OPENSSL_ECC_MAX_FIELD_BITS
+# define OPENSSL_ECC_MAX_FIELD_BITS 661
+#endif
+
 /** Enum for the point conversion form as defined in X9.62 (ECDSA)
  *  for the encoding of a elliptic curve point (x,y) */
 typedef enum {
@@ -146,6 +151,15 @@ const EC_METHOD *EC_GFp_mont_method(void);
  */
 const EC_METHOD *EC_GFp_nist_method(void);
 
+#ifdef EC_NISTP224_64_GCC_128
+/** Returns 64-bit optimized methods for nistp224
+ *  \return  EC_METHOD object
+ */
+#ifndef OPENSSL_SYS_WIN32
+const EC_METHOD *EC_GFp_nistp224_method(void);
+#endif
+#endif
+
 
 /********************************************************************/ 
 /*           EC_METHOD for curves over GF(2^m)                      */
@@ -794,6 +808,15 @@ int EC_KEY_generate_key(EC_KEY *key);
  */
 int EC_KEY_check_key(const EC_KEY *key);
 
+/** Sets a public key from affine coordindates performing
+ *  neccessary NIST PKV tests.
+ *  \param  key  the EC_KEY object
+ *  \param  x    public key x coordinate
+ *  \param  y    public key y coordinate
+ *  \return 1 on success and 0 otherwise.
+ */
+int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x, BIGNUM *y);
+
 
 /********************************************************************/
 /*        de- and encoding functions for SEC1 ECPrivateKey          */
@@ -905,6 +928,13 @@ int        EC_KEY_print_fp(FILE *fp, const EC_KEY *key, int off);
 # endif
 #endif
 
+#define EVP_PKEY_CTX_set_ec_paramgen_curve_nid(ctx, nid) \
+       EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, EVP_PKEY_OP_PARAMGEN, \
+                               EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID, nid, NULL)
+
+
+#define EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID            (EVP_PKEY_ALG_CTRL + 1)
+
 /* BEGIN ERROR CODES */
 /* The following lines are auto generated by the script mkerr.pl. Any changes
  * made after this point may be overwritten when the script is next run.
@@ -914,17 +944,19 @@ void ERR_load_EC_strings(void);
 /* Error codes for the EC functions. */
 
 /* Function codes. */
+#define EC_F_BN_TO_FELEM                                224
 #define EC_F_COMPUTE_WNAF                               143
 #define EC_F_D2I_ECPARAMETERS                           144
 #define EC_F_D2I_ECPKPARAMETERS                                 145
 #define EC_F_D2I_ECPRIVATEKEY                           146
-#define EC_F_ECKEY_PARAM2TYPE                           211
-#define EC_F_ECKEY_PARAM_DECODE                                 196
-#define EC_F_ECKEY_PRIV_DECODE                          212
-#define EC_F_ECKEY_PRIV_ENCODE                          213
-#define EC_F_ECKEY_PUB_DECODE                           214
-#define EC_F_ECKEY_PUB_ENCODE                           215
-#define EC_F_ECKEY_TYPE2PARAM                           216
+#define EC_F_DO_EC_KEY_PRINT                            221
+#define EC_F_ECKEY_PARAM2TYPE                           223
+#define EC_F_ECKEY_PARAM_DECODE                                 212
+#define EC_F_ECKEY_PRIV_DECODE                          213
+#define EC_F_ECKEY_PRIV_ENCODE                          214
+#define EC_F_ECKEY_PUB_DECODE                           215
+#define EC_F_ECKEY_PUB_ENCODE                           216
+#define EC_F_ECKEY_TYPE2PARAM                           220
 #define EC_F_ECPARAMETERS_PRINT                                 147
 #define EC_F_ECPARAMETERS_PRINT_FP                      148
 #define EC_F_ECPKPARAMETERS_PRINT                       149
@@ -955,6 +987,9 @@ void ERR_load_EC_strings(void);
 #define EC_F_EC_GFP_MONT_FIELD_SQR                      132
 #define EC_F_EC_GFP_MONT_GROUP_SET_CURVE                189
 #define EC_F_EC_GFP_MONT_GROUP_SET_CURVE_GFP            135
+#define EC_F_EC_GFP_NISTP224_GROUP_SET_CURVE            225
+#define EC_F_EC_GFP_NISTP224_POINTS_MUL                         228
+#define EC_F_EC_GFP_NISTP224_POINT_GET_AFFINE_COORDINATES 226
 #define EC_F_EC_GFP_NIST_FIELD_MUL                      200
 #define EC_F_EC_GFP_NIST_FIELD_SQR                      201
 #define EC_F_EC_GFP_NIST_GROUP_SET_CURVE                202
@@ -997,8 +1032,8 @@ void ERR_load_EC_strings(void);
 #define EC_F_EC_KEY_NEW                                         182
 #define EC_F_EC_KEY_PRINT                               180
 #define EC_F_EC_KEY_PRINT_FP                            181
+#define EC_F_EC_KEY_SET_PUBLIC_KEY_AFFINE_COORDINATES   229
 #define EC_F_EC_POINTS_MAKE_AFFINE                      136
-#define EC_F_EC_POINTS_MUL                              138
 #define EC_F_EC_POINT_ADD                               112
 #define EC_F_EC_POINT_CMP                               113
 #define EC_F_EC_POINT_COPY                              114
@@ -1021,33 +1056,50 @@ void ERR_load_EC_strings(void);
 #define EC_F_EC_POINT_SET_JPROJECTIVE_COORDINATES_GFP   126
 #define EC_F_EC_POINT_SET_TO_INFINITY                   127
 #define EC_F_EC_PRE_COMP_DUP                            207
+#define EC_F_EC_PRE_COMP_NEW                            196
 #define EC_F_EC_WNAF_MUL                                187
 #define EC_F_EC_WNAF_PRECOMPUTE_MULT                    188
 #define EC_F_I2D_ECPARAMETERS                           190
 #define EC_F_I2D_ECPKPARAMETERS                                 191
 #define EC_F_I2D_ECPRIVATEKEY                           192
 #define EC_F_I2O_ECPUBLICKEY                            151
+#define EC_F_NISTP224_PRE_COMP_NEW                      227
 #define EC_F_O2I_ECPUBLICKEY                            152
+#define EC_F_OLD_EC_PRIV_DECODE                                 222
+#define EC_F_PKEY_EC_CTRL                               197
+#define EC_F_PKEY_EC_CTRL_STR                           198
+#define EC_F_PKEY_EC_DERIVE                             217
+#define EC_F_PKEY_EC_KEYGEN                             199
+#define EC_F_PKEY_EC_PARAMGEN                           219
+#define EC_F_PKEY_EC_SIGN                               218
 
 /* Reason codes. */
 #define EC_R_ASN1_ERROR                                         115
 #define EC_R_ASN1_UNKNOWN_FIELD                                 116
+#define EC_R_BIGNUM_OUT_OF_RANGE                        144
 #define EC_R_BUFFER_TOO_SMALL                           100
+#define EC_R_COORDINATES_OUT_OF_RANGE                   146
 #define EC_R_D2I_ECPKPARAMETERS_FAILURE                         117
-#define EC_R_DECODE_ERROR                               137
+#define EC_R_DECODE_ERROR                               142
 #define EC_R_DISCRIMINANT_IS_ZERO                       118
 #define EC_R_EC_GROUP_NEW_BY_NAME_FAILURE               119
+#define EC_R_FIELD_TOO_LARGE                            143
 #define EC_R_GROUP2PKPARAMETERS_FAILURE                         120
 #define EC_R_I2D_ECPKPARAMETERS_FAILURE                         121
 #define EC_R_INCOMPATIBLE_OBJECTS                       101
 #define EC_R_INVALID_ARGUMENT                           112
 #define EC_R_INVALID_COMPRESSED_POINT                   110
 #define EC_R_INVALID_COMPRESSION_BIT                    109
+#define EC_R_INVALID_CURVE                              141
+#define EC_R_INVALID_DIGEST_TYPE                        138
 #define EC_R_INVALID_ENCODING                           102
 #define EC_R_INVALID_FIELD                              103
 #define EC_R_INVALID_FORM                               104
 #define EC_R_INVALID_GROUP_ORDER                        122
+#define EC_R_INVALID_PENTANOMIAL_BASIS                  132
 #define EC_R_INVALID_PRIVATE_KEY                        123
+#define EC_R_INVALID_TRINOMIAL_BASIS                    137
+#define EC_R_KEYS_NOT_SET                               140
 #define EC_R_MISSING_PARAMETERS                                 124
 #define EC_R_MISSING_PRIVATE_KEY                        125
 #define EC_R_NOT_A_NIST_PRIME                           135
@@ -1055,6 +1107,7 @@ void ERR_load_EC_strings(void);
 #define EC_R_NOT_IMPLEMENTED                            126
 #define EC_R_NOT_INITIALIZED                            111
 #define EC_R_NO_FIELD_MOD                               133
+#define EC_R_NO_PARAMETERS_SET                          139
 #define EC_R_PASSED_NULL_PARAMETER                      134
 #define EC_R_PKPARAMETERS2GROUP_FAILURE                         127
 #define EC_R_POINT_AT_INFINITY                          106
@@ -1065,6 +1118,7 @@ void ERR_load_EC_strings(void);
 #define EC_R_UNKNOWN_GROUP                              129
 #define EC_R_UNKNOWN_ORDER                              114
 #define EC_R_UNSUPPORTED_FIELD                          131
+#define EC_R_WRONG_CURVE_PARAMETERS                     145
 #define EC_R_WRONG_ORDER                                130
 
 #ifdef  __cplusplus