summaryrefslogtreecommitdiff
path: root/sshkey.c
diff options
context:
space:
mode:
Diffstat (limited to 'sshkey.c')
-rw-r--r--sshkey.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sshkey.c b/sshkey.c
index 7ff61c85b..a134e5816 100644
--- a/sshkey.c
+++ b/sshkey.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshkey.c,v 1.104 2020/04/08 00:04:32 djm Exp $ */ 1/* $OpenBSD: sshkey.c,v 1.105 2020/04/08 00:05:59 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
4 * Copyright (c) 2008 Alexander von Gernler. All rights reserved. 4 * Copyright (c) 2008 Alexander von Gernler. All rights reserved.
@@ -4326,6 +4326,12 @@ sshkey_parse_private2(struct sshbuf *blob, int type, const char *passphrase,
4326 &decrypted, &pubkey)) != 0) 4326 &decrypted, &pubkey)) != 0)
4327 goto out; 4327 goto out;
4328 4328
4329 if (type != KEY_UNSPEC &&
4330 sshkey_type_plain(type) != sshkey_type_plain(pubkey->type)) {
4331 r = SSH_ERR_KEY_TYPE_MISMATCH;
4332 goto out;
4333 }
4334
4329 /* Load the private key and comment */ 4335 /* Load the private key and comment */
4330 if ((r = sshkey_private_deserialize(decrypted, &k)) != 0 || 4336 if ((r = sshkey_private_deserialize(decrypted, &k)) != 0 ||
4331 (r = sshbuf_get_cstring(decrypted, &comment, NULL)) != 0) 4337 (r = sshbuf_get_cstring(decrypted, &comment, NULL)) != 0)