upstream: only call sshkey_xmss_init() once for KEY_XMSS_CERT; ok

djm

OpenBSD-Commit-ID: d0002ffb7f20f538b014d1d0735facd5a81ff096
This commit is contained in:
markus@openbsd.org 2020-06-24 15:07:33 +00:00 committed by Damien Miller
parent 37f2da069c
commit e3fa6249e6
1 changed files with 4 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $OpenBSD: sshkey.c,v 1.109 2020/06/22 05:58:35 djm Exp $ */ /* $OpenBSD: sshkey.c,v 1.110 2020/06/24 15:07:33 markus Exp $ */
/* /*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
* Copyright (c) 2008 Alexander von Gernler. All rights reserved. * Copyright (c) 2008 Alexander von Gernler. All rights reserved.
@ -3600,10 +3600,12 @@ sshkey_private_deserialize(struct sshbuf *buf, struct sshkey **kp)
case KEY_XMSS: case KEY_XMSS:
case KEY_XMSS_CERT: case KEY_XMSS_CERT:
if ((r = sshbuf_get_cstring(buf, &xmss_name, NULL)) != 0 || if ((r = sshbuf_get_cstring(buf, &xmss_name, NULL)) != 0 ||
(r = sshkey_xmss_init(k, xmss_name)) != 0 ||
(r = sshbuf_get_string(buf, &xmss_pk, &pklen)) != 0 || (r = sshbuf_get_string(buf, &xmss_pk, &pklen)) != 0 ||
(r = sshbuf_get_string(buf, &xmss_sk, &sklen)) != 0) (r = sshbuf_get_string(buf, &xmss_sk, &sklen)) != 0)
goto out; goto out;
if (type == KEY_XMSS &&
(r = sshkey_xmss_init(k, xmss_name)) != 0)
goto out;
if (pklen != sshkey_xmss_pklen(k) || if (pklen != sshkey_xmss_pklen(k) ||
sklen != sshkey_xmss_sklen(k)) { sklen != sshkey_xmss_sklen(k)) {
r = SSH_ERR_INVALID_FORMAT; r = SSH_ERR_INVALID_FORMAT;