upstream: ssh/xmss: fix deserialize for certs; ok djm@

OpenBSD-Commit-ID: f44c41636c16ec83502039828beaf521c057dddc
This commit is contained in:
markus@openbsd.org 2018-03-22 07:05:48 +00:00 committed by Damien Miller
parent c6cb2565c9
commit 27979da9e4

View File

@ -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;