summaryrefslogtreecommitdiff
path: root/sshkey.c
diff options
context:
space:
mode:
authormarkus@openbsd.org <markus@openbsd.org>2018-03-22 07:05:48 +0000
committerDamien Miller <djm@mindrot.org>2018-03-23 11:05:39 +1100
commit27979da9e4074322611355598f69175b9ff10d39 (patch)
tree23ebe1ac4d58cf0755722be6ec982a2f9b33b7e7 /sshkey.c
parentc6cb2565c9285eb54fa9dfbb3890f5464aff410f (diff)
upstream: ssh/xmss: fix deserialize for certs; ok djm@
OpenBSD-Commit-ID: f44c41636c16ec83502039828beaf521c057dddc
Diffstat (limited to 'sshkey.c')
-rw-r--r--sshkey.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sshkey.c b/sshkey.c
index b7c392be..7712fba2 100644
--- a/sshkey.c
+++ b/sshkey.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshkey.c,v 1.63 2018/03/02 02:08:03 djm Exp $ */
+/* $OpenBSD: sshkey.c,v 1.64 2018/03/22 07:05:48 markus Exp $ */
/*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
* Copyright (c) 2008 Alexander von Gernler. All rights reserved.
@@ -3005,9 +3005,14 @@ sshkey_private_deserialize(struct sshbuf *buf, struct sshkey **kp)
case KEY_XMSS_CERT:
if ((r = sshkey_froms(buf, &k)) != 0 ||
(r = sshkey_add_private(k)) != 0 ||
+ (r = sshbuf_get_cstring(buf, &xmss_name, NULL)) != 0 ||
(r = sshbuf_get_string(buf, &xmss_pk, &pklen)) != 0 ||
(r = sshbuf_get_string(buf, &xmss_sk, &sklen)) != 0)
goto out;
+ if (strcmp(xmss_name, k->xmss_name)) {
+ r = SSH_ERR_INVALID_FORMAT;
+ goto out;
+ }
if (pklen != sshkey_xmss_pklen(k) ||
sklen != sshkey_xmss_sklen(k)) {
r = SSH_ERR_INVALID_FORMAT;