} point_conversion_form_t;
typedef struct ec_method_st EC_METHOD;
-
-typedef struct ec_group_st
- /*-
- EC_METHOD *meth;
- -- field definition
- -- curve coefficients
- -- optional generator with associated information (order, cofactor)
- -- optional extra data (precomputed table for fast computation of multiples of generator)
- -- ASN1 stuff
- */
- EC_GROUP;
-
+typedef struct ec_group_st EC_GROUP;
typedef struct ec_point_st EC_POINT;
+typedef struct ecpk_parameters_st ECPKPARAMETERS;
+typedef struct ec_parameters_st ECPARAMETERS;
/********************************************************************/
/* EC_METHODs for curves over GF(p) */
/** Gets the order of a EC_GROUP
* \param group EC_GROUP object
* \param order BIGNUM to which the order is copied
- * \param ctx BN_CTX object (optional)
+ * \param ctx unused
* \return 1 on success and 0 if an error occurred
*/
int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx);
/** Gets the cofactor of a EC_GROUP
* \param group EC_GROUP object
* \param cofactor BIGNUM to which the cofactor is copied
- * \param ctx BN_CTX object (optional)
+ * \param ctx unused
* \return 1 on success and 0 if an error occurred
*/
int EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor,
EC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a,
const BIGNUM *b, BN_CTX *ctx);
# endif
+
/** Creates a EC_GROUP object with a curve specified by a NID
* \param nid NID of the OID of the curve name
* \return newly created EC_GROUP object with specified curve or NULL
*/
EC_GROUP *EC_GROUP_new_by_curve_name(int nid);
+/** Creates a new EC_GROUP object from an ECPARAMETERS object
+ * \param params pointer to the ECPARAMETERS object
+ * \return newly created EC_GROUP object with specified curve or NULL
+ * if an error occurred
+ */
+EC_GROUP *EC_GROUP_new_from_ecparameters(const ECPARAMETERS *params);
+
+/** Creates an ECPARAMETERS object for the the given EC_GROUP object.
+ * \param group pointer to the EC_GROUP object
+ * \param params pointer to an existing ECPARAMETERS object or NULL
+ * \return pointer to the new ECPARAMETERS object or NULL
+ * if an error occurred.
+ */
+ECPARAMETERS *EC_GROUP_get_ecparameters(const EC_GROUP *group,
+ ECPARAMETERS *params);
+
+/** Creates a new EC_GROUP object from an ECPKPARAMETERS object
+ * \param params pointer to an existing ECPKPARAMETERS object, or NULL
+ * \return newly created EC_GROUP object with specified curve, or NULL
+ * if an error occurred
+ */
+EC_GROUP *EC_GROUP_new_from_ecpkparameters(const ECPKPARAMETERS *params);
+
+/** Creates an ECPKPARAMETERS object for the the given EC_GROUP object.
+ * \param group pointer to the EC_GROUP object
+ * \param params pointer to an existing ECPKPARAMETERS object or NULL
+ * \return pointer to the new ECPKPARAMETERS object or NULL
+ * if an error occurred.
+ */
+ECPKPARAMETERS *EC_GROUP_get_ecpkparameters(const EC_GROUP *group,
+ ECPKPARAMETERS *params);
+
/********************************************************************/
/* handling of internal curves */
/********************************************************************/
/* ASN1 stuff */
/********************************************************************/
+DECLARE_ASN1_ITEM(ECPKPARAMETERS)
+DECLARE_ASN1_ITEM(ECPARAMETERS)
+
/*
* EC_GROUP_get_basis_type() returns the NID of the basis type used to
* represent the field elements
# define OPENSSL_EC_EXPLICIT_CURVE 0x000
# define OPENSSL_EC_NAMED_CURVE 0x001
-typedef struct ecpk_parameters_st ECPKPARAMETERS;
-
EC_GROUP *d2i_ECPKParameters(EC_GROUP **, const unsigned char **in, long len);
int i2d_ECPKParameters(const EC_GROUP *, unsigned char **out);
*/
int EC_KEY_check_key(const EC_KEY *key);
+/** Indicates if an EC_KEY can be used for signing.
+ * \param key the EC_KEY object
+ * \return 1 if can can sign and 0 otherwise.
+ */
+int EC_KEY_can_sign(const EC_KEY *eckey);
+
/** Sets a public key from affine coordindates performing
* necessary NIST PKV tests.
* \param key the EC_KEY object
* \param pr pointer to BIGNUM pointer for r (may be NULL)
* \param ps pointer to BIGNUM pointer for s (may be NULL)
*/
-void ECDSA_SIG_get0(BIGNUM **pr, BIGNUM **ps, ECDSA_SIG *sig);
+void ECDSA_SIG_get0(BIGNUM **pr, BIGNUM **ps, const ECDSA_SIG *sig);
/** Computes the ECDSA signature of the given hash value using
* the supplied private key and returns the created signature.
int (*keygen)(EC_KEY *key));
void EC_KEY_METHOD_set_compute_key(EC_KEY_METHOD *meth,
- int (*ckey)(void *out,
- size_t outlen,
+ int (*ckey)(unsigned char **psec,
+ size_t *pseclen,
const EC_POINT *pub_key,
- const EC_KEY *ecdh,
- void *(*KDF) (const void *in,
- size_t inlen,
- void *out,
- size_t *outlen)));
+ const EC_KEY *ecdh));
void EC_KEY_METHOD_set_sign(EC_KEY_METHOD *meth,
int (*sign)(int type, const unsigned char *dgst,
int (**pkeygen)(EC_KEY *key));
void EC_KEY_METHOD_get_compute_key(EC_KEY_METHOD *meth,
- int (**pck)(void *out,
- size_t outlen,
+ int (**pck)(unsigned char **psec,
+ size_t *pseclen,
const EC_POINT *pub_key,
- const EC_KEY *ecdh,
- void *(*KDF) (const void *in,
- size_t inlen,
- void *out,
- size_t *outlen)));
+ const EC_KEY *ecdh));
void EC_KEY_METHOD_get_sign(EC_KEY_METHOD *meth,
int (**psign)(int type, const unsigned char *dgst,
# define EC_F_ECDH_CMS_DECRYPT 238
# define EC_F_ECDH_CMS_SET_SHARED_INFO 239
# define EC_F_ECDH_COMPUTE_KEY 246
+# define EC_F_ECDH_SIMPLE_COMPUTE_KEY 257
# define EC_F_ECDSA_DO_SIGN_EX 251
# define EC_F_ECDSA_DO_VERIFY 252
# define EC_F_ECDSA_SIGN_EX 254
# define EC_F_EC_GROUP_GET_CURVE_GF2M 172
# define EC_F_EC_GROUP_GET_CURVE_GFP 130
# define EC_F_EC_GROUP_GET_DEGREE 173
+# define EC_F_EC_GROUP_GET_ECPARAMETERS 261
+# define EC_F_EC_GROUP_GET_ECPKPARAMETERS 262
# define EC_F_EC_GROUP_GET_ORDER 141
# define EC_F_EC_GROUP_GET_PENTANOMIAL_BASIS 193
# define EC_F_EC_GROUP_GET_TRINOMIAL_BASIS 194
# define EC_F_EC_GROUP_NEW 108
# define EC_F_EC_GROUP_NEW_BY_CURVE_NAME 174
# define EC_F_EC_GROUP_NEW_FROM_DATA 175
+# define EC_F_EC_GROUP_NEW_FROM_ECPARAMETERS 263
+# define EC_F_EC_GROUP_NEW_FROM_ECPKPARAMETERS 264
# define EC_F_EC_GROUP_PRECOMPUTE_MULT 142
# define EC_F_EC_GROUP_SET_CURVE_GF2M 176
# define EC_F_EC_GROUP_SET_CURVE_GFP 109
# define EC_F_EC_KEY_PRINT_FP 181
# define EC_F_EC_KEY_PRIV2OCT 256
# define EC_F_EC_KEY_SET_PUBLIC_KEY_AFFINE_COORDINATES 229
+# define EC_F_EC_KEY_SIMPLE_CHECK_KEY 258
+# define EC_F_EC_KEY_SIMPLE_OCT2PRIV 259
+# define EC_F_EC_KEY_SIMPLE_PRIV2OCT 260
# define EC_F_EC_POINTS_MAKE_AFFINE 136
# define EC_F_EC_POINT_ADD 112
# define EC_F_EC_POINT_CMP 113
# 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_CURVE_DOES_NOT_SUPPORT_ECDH 160
+# define EC_R_CURVE_DOES_NOT_SUPPORT_SIGNING 159
# define EC_R_D2I_ECPKPARAMETERS_FAILURE 117
# define EC_R_DECODE_ERROR 142
# define EC_R_DISCRIMINANT_IS_ZERO 118
# define EC_R_INVALID_FIELD 103
# define EC_R_INVALID_FORM 104
# define EC_R_INVALID_GROUP_ORDER 122
+# define EC_R_INVALID_OUTPUT_LENGTH 161
# define EC_R_INVALID_PENTANOMIAL_BASIS 132
# define EC_R_INVALID_PRIVATE_KEY 123
# define EC_R_INVALID_TRINOMIAL_BASIS 137