summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2002-01-31 13:35:12 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2002-01-31 13:35:12 +0000
commit389bedd6a791d86b959aea1928f431f892bb4280 (patch)
tree26b76deb1b87ef5bf43760f2325fef93ad73da48
parentae9ae65f89532d6252dfb38ceffc18f9c13faa77 (diff)
cross check announced key type and type from key blob
-rw-r--r--usr.bin/ssh/kexdh.c5
-rw-r--r--usr.bin/ssh/kexgex.c5
2 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/ssh/kexdh.c b/usr.bin/ssh/kexdh.c
index 60d13a8b9a0..f87d5295211 100644
--- a/usr.bin/ssh/kexdh.c
+++ b/usr.bin/ssh/kexdh.c
@@ -23,7 +23,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: kexdh.c,v 1.13 2002/01/25 22:07:40 markus Exp $");
+RCSID("$OpenBSD: kexdh.c,v 1.14 2002/01/31 13:35:11 markus Exp $");
#include <openssl/crypto.h>
#include <openssl/bn.h>
@@ -121,7 +121,8 @@ kexdh_client(Kex *kex)
server_host_key = key_from_blob(server_host_key_blob, sbloblen);
if (server_host_key == NULL)
fatal("cannot decode server_host_key_blob");
-
+ if (server_host_key->type != kex->hostkey_type)
+ fatal("type mismatch for decoded server_host_key_blob");
if (kex->verify_host_key == NULL)
fatal("cannot verify server_host_key");
if (kex->verify_host_key(server_host_key) == -1)
diff --git a/usr.bin/ssh/kexgex.c b/usr.bin/ssh/kexgex.c
index b50a7114f29..dc2fa672393 100644
--- a/usr.bin/ssh/kexgex.c
+++ b/usr.bin/ssh/kexgex.c
@@ -24,7 +24,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: kexgex.c,v 1.16 2002/01/25 22:07:40 markus Exp $");
+RCSID("$OpenBSD: kexgex.c,v 1.17 2002/01/31 13:35:11 markus Exp $");
#include <openssl/bn.h>
@@ -176,7 +176,8 @@ kexgex_client(Kex *kex)
server_host_key = key_from_blob(server_host_key_blob, sbloblen);
if (server_host_key == NULL)
fatal("cannot decode server_host_key_blob");
-
+ if (server_host_key->type != kex->hostkey_type)
+ fatal("type mismatch for decoded server_host_key_blob");
if (kex->verify_host_key == NULL)
fatal("cannot verify server_host_key");
if (kex->verify_host_key(server_host_key) == -1)