summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/kex.c
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2010-08-31 11:54:46 +0000
committerDamien Miller <djm@cvs.openbsd.org>2010-08-31 11:54:46 +0000
commitb7d7ad1eba8cc5d3a33da1372036c3cc489d724c (patch)
treea9dbf56090f8345253e8c8e944160a23f922cc30 /usr.bin/ssh/kex.c
parent12ed26cb2111068191436c2c2d5ea96bfabc55c3 (diff)
Implement Elliptic Curve Cryptography modes for key exchange (ECDH) and
host/user keys (ECDSA) as specified by RFC5656. ECDH and ECDSA offer better performance than plain DH and DSA at the same equivalent symmetric key length, as well as much shorter keys. Only the mandatory sections of RFC5656 are implemented, specifically the three REQUIRED curves nistp256, nistp384 and nistp521 and only ECDH and ECDSA. Point compression (optional in RFC5656 is NOT implemented). Certificate host and user keys using the new ECDSA key types are supported. Note that this code has not been tested for interoperability and may be subject to change. feedback and ok markus@
Diffstat (limited to 'usr.bin/ssh/kex.c')
-rw-r--r--usr.bin/ssh/kex.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.bin/ssh/kex.c b/usr.bin/ssh/kex.c
index c8d339824f3..27774f2d6c8 100644
--- a/usr.bin/ssh/kex.c
+++ b/usr.bin/ssh/kex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kex.c,v 1.83 2010/08/31 09:58:37 djm Exp $ */
+/* $OpenBSD: kex.c,v 1.84 2010/08/31 11:54:45 djm Exp $ */
/*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
*
@@ -313,6 +313,10 @@ choose_kex(Kex *k, char *client, char *server)
} else if (strcmp(k->name, KEX_DHGEX_SHA256) == 0) {
k->kex_type = KEX_DH_GEX_SHA256;
k->evp_md = EVP_sha256();
+ } else if (strncmp(k->name, KEX_ECDH_SHA256,
+ sizeof(KEX_ECDH_SHA256) - 1) == 0) {
+ k->kex_type = KEX_ECDH_SHA2;
+ k->evp_md = EVP_sha256();
} else
fatal("bad kex alg %s", k->name);
}
@@ -546,11 +550,11 @@ derive_ssh1_session_id(BIGNUM *host_modulus, BIGNUM *server_modulus,
memset(&md, 0, sizeof(md));
}
-#if defined(DEBUG_KEX) || defined(DEBUG_KEXDH)
+#if defined(DEBUG_KEX) || defined(DEBUG_KEXDH) || defined(DEBUG_KEXECDH)
void
dump_digest(char *msg, u_char *digest, int len)
{
- u_int i;
+ int i;
fprintf(stderr, "%s\n", msg);
for (i = 0; i < len; i++) {