}
} else if (ssh->kex->main_type == KEXTYPE_ECDH) {
- logeventf(ssh, "Doing ECDH key exchange with hash %s",
+ logeventf(ssh, "Doing ECDH key exchange with curve %s and hash %s",
+ ssh_ecdhkex_curve_textname(ssh->kex),
ssh->kex->hash->text_name);
ssh->pkt_kctx = SSH2_PKTCTX_ECDHKEX;
struct ec_curve {
enum { EC_WEIERSTRASS, EC_MONTGOMERY, EC_EDWARDS } type;
- const char *name;
+ /* '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 {
* SSH2 ECDH key exchange functions
*/
struct ssh_kex;
+const char *ssh_ecdhkex_curve_textname(const struct ssh_kex *kex);
void *ssh_ecdhkex_newkey(const struct ssh_kex *kex);
void ssh_ecdhkex_freekey(void *key);
char *ssh_ecdhkex_getpublic(void *key, int *len);
};
initialise_wcurve(&curve, 256, p, a, b, n, Gx, Gy);
- curve.name = "nistp256";
+ curve.textname = curve.name = "nistp256";
/* Now initialised, no need to do it again */
initialised = 1;
};
initialise_wcurve(&curve, 384, p, a, b, n, Gx, Gy);
- curve.name = "nistp384";
+ curve.textname = curve.name = "nistp384";
/* Now initialised, no need to do it again */
initialised = 1;
};
initialise_wcurve(&curve, 521, p, a, b, n, Gx, Gy);
- curve.name = "nistp521";
+ curve.textname = curve.name = "nistp521";
/* Now initialised, no need to do it again */
initialised = 1;
/* This curve doesn't need a name, because it's never used in
* any format that embeds the curve name */
curve.name = NULL;
+ curve.textname = "Curve25519";
/* Now initialised, no need to do it again */
initialised = 1;
curve.name = NULL;
initialise_ecurve(&curve, 256, q, l, d, Bx, By);
+ curve.textname = "Ed25519";
/* Now initialised, no need to do it again */
initialised = 1;
return ret;
}
+const char *ssh_ecdhkex_curve_textname(const struct ssh_kex *kex)
+{
+ const struct eckex_extra *extra = (const struct eckex_extra *)kex->extra;
+ struct ec_curve *curve = extra->curve();
+ return curve->textname;
+}
+
void *ssh_ecdhkex_newkey(const struct ssh_kex *kex)
{
const struct eckex_extra *extra = (const struct eckex_extra *)kex->extra;