Add OPENSSL_NO_ECDH guards
[oweals/openssl.git] / crypto / ec / ec_lcl.h
index 6f714c7575df1ac34bf33e00b4b6e2c701982f02..abd73eeee85f009a11489168e8f64420d7f7bab7 100644 (file)
@@ -190,7 +190,7 @@ struct ec_group_st {
        const EC_METHOD *meth;
 
        EC_POINT *generator; /* optional */
-       BIGNUM order, cofactor;
+       BIGNUM *order, *cofactor;
 
        int curve_name;/* optional NID for named curve */
        int asn1_flag; /* flag to control the asn1 encoding */
@@ -204,7 +204,7 @@ struct ec_group_st {
        /* The following members are handled by the method functions,
         * even if they appear generic */
        
-       BIGNUM field; /* Field specification.
+       BIGNUM *field; /* Field specification.
                       * For curves over GF(p), this is the modulus;
                       * for curves over GF(2^m), this is the 
                       * irreducible polynomial defining the field.
@@ -219,7 +219,7 @@ struct ec_group_st {
                      * non-zero terms.
                      */
 
-       BIGNUM a, b; /* Curve coefficients.
+       BIGNUM *a, *b; /* Curve coefficients.
                      * (Here the assumption is that BIGNUMs can be used
                      * or abused for all kinds of fields, not just GF(p).)
                      * For characteristic  > 3,  the curve is defined
@@ -235,6 +235,8 @@ struct ec_group_st {
        void *field_data1; /* method-specific (e.g., Montgomery structure) */
        void *field_data2; /* method-specific */
        int (*field_mod_func)(BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *); /* method-specific */
+
+       BN_MONT_CTX *mont_data;    /* data for ECDSA inverse */
 } /* EC_GROUP */;
 
 struct ec_key_st {
@@ -246,7 +248,6 @@ struct ec_key_st {
        BIGNUM   *priv_key;
 
        unsigned int enc_flag;
-       char nonce_from_hash_flag;
        point_conversion_form_t conv_form;
 
        int     references;
@@ -279,9 +280,9 @@ struct ec_point_st {
        /* All members except 'meth' are handled by the method functions,
         * even if they appear generic */
 
-       BIGNUM X;
-       BIGNUM Y;
-       BIGNUM Z; /* Jacobian projective coordinates:
+       BIGNUM *X;
+       BIGNUM *Y;
+       BIGNUM *Z; /* Jacobian projective coordinates:
                   * (X, Y, Z)  represents  (X/Z^2, Y/Z^3)  if  Z != 0 */
        int Z_is_one; /* enable optimized point arithmetics for special case */
 } /* EC_POINT */;
@@ -405,7 +406,7 @@ int ec_GF2m_simple_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
 int ec_GF2m_precompute_mult(EC_GROUP *group, BN_CTX *ctx);
 int ec_GF2m_have_precompute_mult(const EC_GROUP *group);
 
-#ifndef OPENSSL_EC_NISTP_64_GCC_128
+#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
 /* method functions in ecp_nistp224.c */
 int ec_GFp_nistp224_group_init(EC_GROUP *group);
 int ec_GFp_nistp224_group_set_curve(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, const BIGNUM *n, BN_CTX *);
@@ -445,3 +446,12 @@ void ec_GFp_nistp_points_make_affine_internal(size_t num, void *point_array,
        void (*felem_contract)(void *out, const void *in));
 void ec_GFp_nistp_recode_scalar_bits(unsigned char *sign, unsigned char *digit, unsigned char in);
 #endif
+int ec_precompute_mont_data(EC_GROUP *);
+
+#ifdef ECP_NISTZ256_ASM
+/** Returns GFp methods using montgomery multiplication, with x86-64 optimized
+ * P256. See http://eprint.iacr.org/2013/816.
+ *  \return  EC_METHOD object
+ */
+const EC_METHOD *EC_GFp_nistz256_method(void);
+#endif