diff options
author | Damien Miller <djm@mindrot.org> | 2010-09-10 11:23:34 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2010-09-10 11:23:34 +1000 |
commit | 041ab7c1e7d6514ed84a539a767f79ffb356e807 (patch) | |
tree | c6528487bfc1cfa824655e48ef884b2c268c8588 /kexecdh.c | |
parent | 3796ab47d3f68f69512c360f178b77bf0fb12b4f (diff) |
- djm@cvs.openbsd.org 2010/09/09 10:45:45
[kex.c kex.h kexecdh.c key.c key.h monitor.c ssh-ecdsa.c]
ECDH/ECDSA compliance fix: these methods vary the hash function they use
(SHA256/384/512) depending on the length of the curve in use. The previous
code incorrectly used SHA256 in all cases.
This fix will cause authentication failure when using 384 or 521-bit curve
keys if one peer hasn't been upgraded and the other has. (256-bit curve
keys work ok). In particular you may need to specify HostkeyAlgorithms
when connecting to a server that has not been upgraded from an upgraded
client.
ok naddy@
Diffstat (limited to 'kexecdh.c')
-rw-r--r-- | kexecdh.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: kexecdh.c,v 1.1 2010/08/31 11:54:45 djm Exp $ */ | 1 | /* $OpenBSD: kexecdh.c,v 1.2 2010/09/09 10:45:45 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2001 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2001 Markus Friedl. All rights reserved. |
4 | * Copyright (c) 2010 Damien Miller. All rights reserved. | 4 | * Copyright (c) 2010 Damien Miller. All rights reserved. |
@@ -48,15 +48,23 @@ kex_ecdh_name_to_nid(const char *kexname) | |||
48 | { | 48 | { |
49 | int ret; | 49 | int ret; |
50 | 50 | ||
51 | if (strlen(kexname) < sizeof(KEX_ECDH_SHA256) - 1) | 51 | if (strlen(kexname) < sizeof(KEX_ECDH_SHA2_STEM) - 1) |
52 | fatal("%s: kexname too short \"%s\"", __func__, kexname); | 52 | fatal("%s: kexname too short \"%s\"", __func__, kexname); |
53 | ret = key_curve_name_to_nid(kexname + sizeof(KEX_ECDH_SHA256) - 1); | 53 | ret = key_curve_name_to_nid(kexname + sizeof(KEX_ECDH_SHA2_STEM) - 1); |
54 | if (ret == -1) | 54 | if (ret == -1) |
55 | fatal("%s: unsupported curve negotiated \"%s\"", __func__, | 55 | fatal("%s: unsupported curve negotiated \"%s\"", __func__, |
56 | kexname); | 56 | kexname); |
57 | return ret; | 57 | return ret; |
58 | } | 58 | } |
59 | 59 | ||
60 | const EVP_MD * | ||
61 | kex_ecdh_name_to_evpmd(const char *kexname) | ||
62 | { | ||
63 | int nid = kex_ecdh_name_to_nid(kexname); | ||
64 | |||
65 | return key_ec_nid_to_evpmd(nid); | ||
66 | } | ||
67 | |||
60 | void | 68 | void |
61 | kex_ecdh_hash( | 69 | kex_ecdh_hash( |
62 | const EVP_MD *evp_md, | 70 | const EVP_MD *evp_md, |