summaryrefslogtreecommitdiffstats
path: root/usr.bin/ssh/sshkey.c
diff options
context:
space:
mode:
authormarkus <markus@openbsd.org>2019-11-13 22:00:21 +0000
committermarkus <markus@openbsd.org>2019-11-13 22:00:21 +0000
commit9d8a210628dc68fe478c57b6b616c78e3bcf7cb8 (patch)
tree26f324941b9dd3a8d65a90a40edb4ae3881ed863 /usr.bin/ssh/sshkey.c
parentNon root user must not use ioctl(2) to mess around with the address (diff)
downloadwireguard-openbsd-9d8a210628dc68fe478c57b6b616c78e3bcf7cb8.tar.xz
wireguard-openbsd-9d8a210628dc68fe478c57b6b616c78e3bcf7cb8.zip
in order to be able to figure out the number of signatures left on
a shielded key, we need to transfer the number of signatures left from the private to the public key. ok djm@
Diffstat (limited to 'usr.bin/ssh/sshkey.c')
-rw-r--r--usr.bin/ssh/sshkey.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.bin/ssh/sshkey.c b/usr.bin/ssh/sshkey.c
index 5ecf1ee21d2..7a138fe3130 100644
--- a/usr.bin/ssh/sshkey.c
+++ b/usr.bin/ssh/sshkey.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshkey.c,v 1.91 2019/11/13 07:53:10 markus Exp $ */
+/* $OpenBSD: sshkey.c,v 1.92 2019/11/13 22:00:21 markus Exp $ */
/*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
* Copyright (c) 2008 Alexander von Gernler. All rights reserved.
@@ -1910,6 +1910,7 @@ sshkey_from_private(const struct sshkey *k, struct sshkey **pkp)
if ((r = sshkey_xmss_init(n, k->xmss_name)) != 0)
goto out;
if (k->xmss_pk != NULL) {
+ u_int32_t left;
size_t pklen = sshkey_xmss_pklen(k);
if (pklen == 0 || sshkey_xmss_pklen(n) != pklen) {
r = SSH_ERR_INTERNAL_ERROR;
@@ -1920,6 +1921,10 @@ sshkey_from_private(const struct sshkey *k, struct sshkey **pkp)
goto out;
}
memcpy(n->xmss_pk, k->xmss_pk, pklen);
+ /* simulate number of signatures left on pubkey */
+ left = sshkey_xmss_signatures_left(k);
+ if (left)
+ sshkey_xmss_enable_maxsign(n, left);
}
break;
#endif /* WITH_XMSS */