X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Fopenssl%2Fec.h;h=e67439b73d316b5a86c03deab7ad8404708c7a7c;hb=114de5b59502e1764c14082e14f07562ad4e6a15;hp=f0d648ec86da36eb7a34df334dfca6b11eb89301;hpb=83f0e802abf4e3f9b4f3e815cf81c41637cb79f1;p=oweals%2Fopenssl.git diff --git a/include/openssl/ec.h b/include/openssl/ec.h index f0d648ec86..e67439b73d 100644 --- a/include/openssl/ec.h +++ b/include/openssl/ec.h @@ -115,19 +115,10 @@ typedef enum { } 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) */ @@ -410,6 +401,7 @@ EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, 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 @@ -417,6 +409,38 @@ EC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a, */ 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 */ /********************************************************************/ @@ -740,6 +764,9 @@ int EC_GROUP_have_precompute_mult(const EC_GROUP *group); /* 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 @@ -754,8 +781,6 @@ int EC_GROUP_get_pentanomial_basis(const EC_GROUP *, unsigned int *k1, # 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); @@ -1231,14 +1256,10 @@ void EC_KEY_METHOD_set_keygen(EC_KEY_METHOD *meth, 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, @@ -1279,14 +1300,10 @@ void EC_KEY_METHOD_get_keygen(EC_KEY_METHOD *meth, 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, @@ -1497,12 +1514,16 @@ void ERR_load_EC_strings(void); # 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 @@ -1594,6 +1615,7 @@ void ERR_load_EC_strings(void); # 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