/* Use custom formats for EC_GROUP, EC_POINT and EC_KEY */
#define EC_FLAGS_CUSTOM_CURVE 0x2
+/* Curve does not support signing operations */
+#define EC_FLAGS_NO_SIGN 0x4
+
/*
* Structure details are not part of the exported interface, so all this may
* change in future versions.
BN_CTX *);
/* used by EC_GROUP_get_degree: */
int (*group_get_degree) (const EC_GROUP *);
+ int (*group_order_bits) (const EC_GROUP *);
/* used by EC_GROUP_check: */
int (*group_check_discriminant) (const EC_GROUP *, BN_CTX *);
/*
EC_GROUP *group;
EC_POINT *pub_key;
BIGNUM *priv_key;
+ /*
+ * Arbitrary extra data.
+ * For example in X25519 this contains the raw private key in a 32 byte
+ * buffer.
+ */
+ void *custom_data;
unsigned int enc_flag;
point_conversion_form_t conv_form;
int references;
* Z) represents (X/Z^2, Y/Z^3) if Z != 0 */
int Z_is_one; /* enable optimized point arithmetics for
* special case */
+ /*
+ * Arbitrary extra data.
+ * For example in X25519 this contains the public key in a 32 byte buffer.
+ */
+ void *custom_data;
} /* EC_POINT */ ;
NISTP224_PRE_COMP *EC_nistp224_pre_comp_dup(NISTP224_PRE_COMP *);
unsigned char *digit, unsigned char in);
#endif
int ec_precompute_mont_data(EC_GROUP *);
+int ec_group_simple_order_bits(const EC_GROUP *group);
#ifdef ECP_NISTZ256_ASM
/** Returns GFp methods using montgomery multiplication, with x86-64 optimized
const EC_METHOD *EC_GFp_nistz256_method(void);
#endif
+size_t ec_key_simple_priv2oct(const EC_KEY *eckey,
+ unsigned char *buf, size_t len);
+int ec_key_simple_oct2priv(EC_KEY *eckey, unsigned char *buf, size_t len);
+int ec_key_simple_generate_key(EC_KEY *eckey);
+int ec_key_simple_generate_public_key(EC_KEY *eckey);
+int ec_key_simple_check_key(const EC_KEY *eckey);
+
/* EC_METHOD definitions */
struct ec_key_method_st {
const EC_KEY *ecdh,
void *(*KDF) (const void *in, size_t inlen,
void *out, size_t *outlen));
+int ecdh_simple_compute_key(void *out, size_t outlen, const EC_POINT *pub_key,
+ const EC_KEY *ecdh,
+ void *(*KDF) (const void *in, size_t inlen,
+ void *out, size_t *outlen));
struct ECDSA_SIG_st {
BIGNUM *r;
const unsigned char *sigbuf, int sig_len, EC_KEY *eckey);
int ossl_ecdsa_verify_sig(const unsigned char *dgst, int dgst_len,
const ECDSA_SIG *sig, EC_KEY *eckey);
+
+const EC_METHOD *ec_x25519_meth(void);
+
+int X25519(uint8_t out_shared_key[32], const uint8_t private_key[32],
+ const uint8_t peer_public_value[32]);
+void X25519_public_from_private(uint8_t out_public_value[32],
+ const uint8_t private_key[32]);