diff options
Diffstat (limited to 'kex.c')
-rw-r--r-- | kex.c | 17 |
1 files changed, 6 insertions, 11 deletions
@@ -23,7 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "includes.h" | 25 | #include "includes.h" |
26 | RCSID("$OpenBSD: kex.c,v 1.20 2001/02/08 19:30:51 itojun Exp $"); | 26 | RCSID("$OpenBSD: kex.c,v 1.21 2001/02/11 12:59:24 markus Exp $"); |
27 | 27 | ||
28 | #include <openssl/crypto.h> | 28 | #include <openssl/crypto.h> |
29 | #include <openssl/bio.h> | 29 | #include <openssl/bio.h> |
@@ -41,6 +41,7 @@ RCSID("$OpenBSD: kex.c,v 1.20 2001/02/08 19:30:51 itojun Exp $"); | |||
41 | #include "kex.h" | 41 | #include "kex.h" |
42 | #include "key.h" | 42 | #include "key.h" |
43 | #include "log.h" | 43 | #include "log.h" |
44 | #include "mac.h" | ||
44 | 45 | ||
45 | #define KEX_COOKIE_LEN 16 | 46 | #define KEX_COOKIE_LEN 16 |
46 | 47 | ||
@@ -412,18 +413,12 @@ choose_mac(Mac *mac, char *client, char *server) | |||
412 | char *name = get_match(client, server); | 413 | char *name = get_match(client, server); |
413 | if (name == NULL) | 414 | if (name == NULL) |
414 | fatal("no matching mac found: client %s server %s", client, server); | 415 | fatal("no matching mac found: client %s server %s", client, server); |
415 | if (strcmp(name, "hmac-md5") == 0) { | 416 | if (mac_init(mac, name) < 0) |
416 | mac->md = EVP_md5(); | ||
417 | } else if (strcmp(name, "hmac-sha1") == 0) { | ||
418 | mac->md = EVP_sha1(); | ||
419 | } else if (strcmp(name, "hmac-ripemd160@openssh.com") == 0) { | ||
420 | mac->md = EVP_ripemd160(); | ||
421 | } else { | ||
422 | fatal("unsupported mac %s", name); | 417 | fatal("unsupported mac %s", name); |
423 | } | 418 | /* truncate the key */ |
419 | if (datafellows & SSH_BUG_HMAC) | ||
420 | mac->key_len = 16; | ||
424 | mac->name = name; | 421 | mac->name = name; |
425 | mac->mac_len = mac->md->md_size; | ||
426 | mac->key_len = (datafellows & SSH_BUG_HMAC) ? 16 : mac->mac_len; | ||
427 | mac->key = NULL; | 422 | mac->key = NULL; |
428 | mac->enabled = 0; | 423 | mac->enabled = 0; |
429 | } | 424 | } |