+struct ec_curve;
+
+struct ec_point {
+ const struct ec_curve *curve;
+ Bignum x, y;
+ Bignum z; /* Jacobian denominator */
+ unsigned char infinity;
+};
+
+void ec_point_free(struct ec_point *point);
+
+/* Weierstrass form curve */
+struct ec_wcurve
+{
+ Bignum a, b, n;
+ struct ec_point G;
+};
+
+/* Montgomery form curve */
+struct ec_mcurve
+{
+ Bignum a, b;
+ struct ec_point G;
+};
+
+/* Edwards form curve */
+struct ec_ecurve
+{
+ Bignum l, d;
+ struct ec_point B;
+};
+
+struct ec_curve {
+ enum { EC_WEIERSTRASS, EC_MONTGOMERY, EC_EDWARDS } type;
+ /* 'name' is the identifier of the curve when it has to appear in
+ * wire protocol encodings, as it does in e.g. the public key and
+ * signature formats for NIST curves. Curves which do not format
+ * their keys or signatures in this way just have name==NULL.
+ *
+ * 'textname' is non-NULL for all curves, and is a human-readable
+ * identification suitable for putting in log messages. */
+ const char *name, *textname;
+ unsigned int fieldBits;
+ Bignum p;
+ union {
+ struct ec_wcurve w;
+ struct ec_mcurve m;
+ struct ec_ecurve e;
+ };
+};
+
+const struct ssh_signkey *ec_alg_by_oid(int len, const void *oid,
+ const struct ec_curve **curve);
+const unsigned char *ec_alg_oid(const struct ssh_signkey *alg, int *oidlen);
+extern const int ec_nist_curve_lengths[], n_ec_nist_curve_lengths;
+int ec_nist_alg_and_curve_by_bits(int bits,
+ const struct ec_curve **curve,
+ const struct ssh_signkey **alg);
+int ec_ed_alg_and_curve_by_bits(int bits,
+ const struct ec_curve **curve,
+ const struct ssh_signkey **alg);
+
+struct ssh_signkey;
+
+struct ec_key {
+ const struct ssh_signkey *signalg;
+ struct ec_point publicKey;
+ Bignum privateKey;
+};
+
+struct ec_point *ec_public(const Bignum privateKey, const struct ec_curve *curve);
+
+int makekey(const unsigned char *data, int len, struct RSAKey *result,
+ const unsigned char **keystr, int order);
+int makeprivate(const unsigned char *data, int len, struct RSAKey *result);