xref: /netbsd-src/crypto/external/bsd/openssh/dist/ssh-xmss.c (revision b1066cf3cd3cc4bc809a7791a10cc5857ad5d501)
1*b1066cf3Schristos /*	$NetBSD: ssh-xmss.c,v 1.6 2023/07/26 17:58:16 christos Exp $	*/
2*b1066cf3Schristos /* $OpenBSD: ssh-xmss.c,v 1.14 2022/10/28 00:44:44 djm Exp $*/
3ad340bdfSchristos /*
4ad340bdfSchristos  * Copyright (c) 2017 Stefan-Lukas Gazdag.
5ad340bdfSchristos  * Copyright (c) 2017 Markus Friedl.
6ad340bdfSchristos  *
7ad340bdfSchristos  * Permission to use, copy, modify, and distribute this software for any
8ad340bdfSchristos  * purpose with or without fee is hereby granted, provided that the above
9ad340bdfSchristos  * copyright notice and this permission notice appear in all copies.
10ad340bdfSchristos  *
11ad340bdfSchristos  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12ad340bdfSchristos  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13ad340bdfSchristos  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14ad340bdfSchristos  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15ad340bdfSchristos  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16ad340bdfSchristos  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17ad340bdfSchristos  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18ad340bdfSchristos  */
19ffae97bbSchristos #include "includes.h"
20*b1066cf3Schristos __RCSID("$NetBSD: ssh-xmss.c,v 1.6 2023/07/26 17:58:16 christos Exp $");
21ad340bdfSchristos #define SSHKEY_INTERNAL
22ad340bdfSchristos #include <sys/types.h>
23ad340bdfSchristos #include <limits.h>
24ad340bdfSchristos 
25e160b4e8Schristos #include <stdlib.h>
26ad340bdfSchristos #include <string.h>
27ad340bdfSchristos #include <stdarg.h>
28e160b4e8Schristos #include <stdint.h>
29ad340bdfSchristos #include <unistd.h>
30ad340bdfSchristos 
31ad340bdfSchristos #include "log.h"
32ad340bdfSchristos #include "sshbuf.h"
33ad340bdfSchristos #include "sshkey.h"
34ad340bdfSchristos #include "sshkey-xmss.h"
35ad340bdfSchristos #include "ssherr.h"
36ad340bdfSchristos #include "ssh.h"
37ad340bdfSchristos 
38ad340bdfSchristos #include "xmss_fast.h"
39ad340bdfSchristos 
40*b1066cf3Schristos static void
ssh_xmss_cleanup(struct sshkey * k)41*b1066cf3Schristos ssh_xmss_cleanup(struct sshkey *k)
42*b1066cf3Schristos {
43*b1066cf3Schristos 	freezero(k->xmss_pk, sshkey_xmss_pklen(k));
44*b1066cf3Schristos 	freezero(k->xmss_sk, sshkey_xmss_sklen(k));
45*b1066cf3Schristos 	sshkey_xmss_free_state(k);
46*b1066cf3Schristos 	free(k->xmss_name);
47*b1066cf3Schristos 	free(k->xmss_filename);
48*b1066cf3Schristos 	k->xmss_pk = NULL;
49*b1066cf3Schristos 	k->xmss_sk = NULL;
50*b1066cf3Schristos 	k->xmss_name = NULL;
51*b1066cf3Schristos 	k->xmss_filename = NULL;
52*b1066cf3Schristos }
53*b1066cf3Schristos 
54*b1066cf3Schristos static int
ssh_xmss_equal(const struct sshkey * a,const struct sshkey * b)55*b1066cf3Schristos ssh_xmss_equal(const struct sshkey *a, const struct sshkey *b)
56*b1066cf3Schristos {
57*b1066cf3Schristos 	if (a->xmss_pk == NULL || b->xmss_pk == NULL)
58*b1066cf3Schristos 		return 0;
59*b1066cf3Schristos 	if (sshkey_xmss_pklen(a) != sshkey_xmss_pklen(b))
60*b1066cf3Schristos 		return 0;
61*b1066cf3Schristos 	if (memcmp(a->xmss_pk, b->xmss_pk, sshkey_xmss_pklen(a)) != 0)
62*b1066cf3Schristos 		return 0;
63*b1066cf3Schristos 	return 1;
64*b1066cf3Schristos }
65*b1066cf3Schristos 
66*b1066cf3Schristos static int
ssh_xmss_serialize_public(const struct sshkey * key,struct sshbuf * b,enum sshkey_serialize_rep opts)67*b1066cf3Schristos ssh_xmss_serialize_public(const struct sshkey *key, struct sshbuf *b,
68*b1066cf3Schristos     enum sshkey_serialize_rep opts)
69*b1066cf3Schristos {
70*b1066cf3Schristos 	int r;
71*b1066cf3Schristos 
72*b1066cf3Schristos 	if (key->xmss_name == NULL || key->xmss_pk == NULL ||
73*b1066cf3Schristos 	    sshkey_xmss_pklen(key) == 0)
74*b1066cf3Schristos 		return SSH_ERR_INVALID_ARGUMENT;
75*b1066cf3Schristos 	if ((r = sshbuf_put_cstring(b, key->xmss_name)) != 0 ||
76*b1066cf3Schristos 	    (r = sshbuf_put_string(b, key->xmss_pk,
77*b1066cf3Schristos 	    sshkey_xmss_pklen(key))) != 0 ||
78*b1066cf3Schristos 	    (r = sshkey_xmss_serialize_pk_info(key, b, opts)) != 0)
79*b1066cf3Schristos 		return r;
80*b1066cf3Schristos 
81*b1066cf3Schristos 	return 0;
82*b1066cf3Schristos }
83*b1066cf3Schristos 
84*b1066cf3Schristos static int
ssh_xmss_serialize_private(const struct sshkey * key,struct sshbuf * b,enum sshkey_serialize_rep opts)85*b1066cf3Schristos ssh_xmss_serialize_private(const struct sshkey *key, struct sshbuf *b,
86*b1066cf3Schristos     enum sshkey_serialize_rep opts)
87*b1066cf3Schristos {
88*b1066cf3Schristos 	int r;
89*b1066cf3Schristos 
90*b1066cf3Schristos 	if (key->xmss_name == NULL)
91*b1066cf3Schristos 		return SSH_ERR_INVALID_ARGUMENT;
92*b1066cf3Schristos 	/* Note: can't reuse ssh_xmss_serialize_public because of sk order */
93*b1066cf3Schristos 	if ((r = sshbuf_put_cstring(b, key->xmss_name)) != 0 ||
94*b1066cf3Schristos 	    (r = sshbuf_put_string(b, key->xmss_pk,
95*b1066cf3Schristos 	    sshkey_xmss_pklen(key))) != 0 ||
96*b1066cf3Schristos 	    (r = sshbuf_put_string(b, key->xmss_sk,
97*b1066cf3Schristos 	    sshkey_xmss_sklen(key))) != 0 ||
98*b1066cf3Schristos 	    (r = sshkey_xmss_serialize_state_opt(key, b, opts)) != 0)
99*b1066cf3Schristos 		return r;
100*b1066cf3Schristos 
101*b1066cf3Schristos 	return 0;
102*b1066cf3Schristos }
103*b1066cf3Schristos 
104*b1066cf3Schristos static int
ssh_xmss_copy_public(const struct sshkey * from,struct sshkey * to)105*b1066cf3Schristos ssh_xmss_copy_public(const struct sshkey *from, struct sshkey *to)
106*b1066cf3Schristos {
107*b1066cf3Schristos 	int r = SSH_ERR_INTERNAL_ERROR;
108*b1066cf3Schristos 	u_int32_t left;
109*b1066cf3Schristos 	size_t pklen;
110*b1066cf3Schristos 
111*b1066cf3Schristos 	if ((r = sshkey_xmss_init(to, from->xmss_name)) != 0)
112*b1066cf3Schristos 		return r;
113*b1066cf3Schristos 	if (from->xmss_pk == NULL)
114*b1066cf3Schristos 		return 0; /* XXX SSH_ERR_INTERNAL_ERROR ? */
115*b1066cf3Schristos 
116*b1066cf3Schristos 	if ((pklen = sshkey_xmss_pklen(from)) == 0 ||
117*b1066cf3Schristos 	    sshkey_xmss_pklen(to) != pklen)
118*b1066cf3Schristos 		return SSH_ERR_INTERNAL_ERROR;
119*b1066cf3Schristos 	if ((to->xmss_pk = malloc(pklen)) == NULL)
120*b1066cf3Schristos 		return SSH_ERR_ALLOC_FAIL;
121*b1066cf3Schristos 	memcpy(to->xmss_pk, from->xmss_pk, pklen);
122*b1066cf3Schristos 	/* simulate number of signatures left on pubkey */
123*b1066cf3Schristos 	left = sshkey_xmss_signatures_left(from);
124*b1066cf3Schristos 	if (left)
125*b1066cf3Schristos 		sshkey_xmss_enable_maxsign(to, left);
126*b1066cf3Schristos 	return 0;
127*b1066cf3Schristos }
128*b1066cf3Schristos 
129*b1066cf3Schristos static int
ssh_xmss_deserialize_public(const char * ktype,struct sshbuf * b,struct sshkey * key)130*b1066cf3Schristos ssh_xmss_deserialize_public(const char *ktype, struct sshbuf *b,
131*b1066cf3Schristos     struct sshkey *key)
132*b1066cf3Schristos {
133*b1066cf3Schristos 	size_t len = 0;
134*b1066cf3Schristos 	char *xmss_name = NULL;
135*b1066cf3Schristos 	u_char *pk = NULL;
136*b1066cf3Schristos 	int ret = SSH_ERR_INTERNAL_ERROR;
137*b1066cf3Schristos 
138*b1066cf3Schristos 	if ((ret = sshbuf_get_cstring(b, &xmss_name, NULL)) != 0)
139*b1066cf3Schristos 		goto out;
140*b1066cf3Schristos 	if ((ret = sshkey_xmss_init(key, xmss_name)) != 0)
141*b1066cf3Schristos 		goto out;
142*b1066cf3Schristos 	if ((ret = sshbuf_get_string(b, &pk, &len)) != 0)
143*b1066cf3Schristos 		goto out;
144*b1066cf3Schristos 	if (len == 0 || len != sshkey_xmss_pklen(key)) {
145*b1066cf3Schristos 		ret = SSH_ERR_INVALID_FORMAT;
146*b1066cf3Schristos 		goto out;
147*b1066cf3Schristos 	}
148*b1066cf3Schristos 	key->xmss_pk = pk;
149*b1066cf3Schristos 	pk = NULL;
150*b1066cf3Schristos 	if (!sshkey_is_cert(key) &&
151*b1066cf3Schristos 	    (ret = sshkey_xmss_deserialize_pk_info(key, b)) != 0)
152*b1066cf3Schristos 		goto out;
153*b1066cf3Schristos 	/* success */
154*b1066cf3Schristos 	ret = 0;
155*b1066cf3Schristos  out:
156*b1066cf3Schristos 	free(xmss_name);
157*b1066cf3Schristos 	freezero(pk, len);
158*b1066cf3Schristos 	return ret;
159*b1066cf3Schristos }
160*b1066cf3Schristos 
161*b1066cf3Schristos static int
ssh_xmss_deserialize_private(const char * ktype,struct sshbuf * b,struct sshkey * key)162*b1066cf3Schristos ssh_xmss_deserialize_private(const char *ktype, struct sshbuf *b,
163*b1066cf3Schristos     struct sshkey *key)
164*b1066cf3Schristos {
165*b1066cf3Schristos 	int r;
166*b1066cf3Schristos 	char *xmss_name = NULL;
167*b1066cf3Schristos 	size_t pklen = 0, sklen = 0;
168*b1066cf3Schristos 	u_char *xmss_pk = NULL, *xmss_sk = NULL;
169*b1066cf3Schristos 
170*b1066cf3Schristos 	/* Note: can't reuse ssh_xmss_deserialize_public because of sk order */
171*b1066cf3Schristos 	if ((r = sshbuf_get_cstring(b, &xmss_name, NULL)) != 0 ||
172*b1066cf3Schristos 	    (r = sshbuf_get_string(b, &xmss_pk, &pklen)) != 0 ||
173*b1066cf3Schristos 	    (r = sshbuf_get_string(b, &xmss_sk, &sklen)) != 0)
174*b1066cf3Schristos 		goto out;
175*b1066cf3Schristos 	if (!sshkey_is_cert(key) &&
176*b1066cf3Schristos 	    (r = sshkey_xmss_init(key, xmss_name)) != 0)
177*b1066cf3Schristos 		goto out;
178*b1066cf3Schristos 	if (pklen != sshkey_xmss_pklen(key) ||
179*b1066cf3Schristos 	    sklen != sshkey_xmss_sklen(key)) {
180*b1066cf3Schristos 		r = SSH_ERR_INVALID_FORMAT;
181*b1066cf3Schristos 		goto out;
182*b1066cf3Schristos 	}
183*b1066cf3Schristos 	key->xmss_pk = xmss_pk;
184*b1066cf3Schristos 	key->xmss_sk = xmss_sk;
185*b1066cf3Schristos 	xmss_pk = xmss_sk = NULL;
186*b1066cf3Schristos 	/* optional internal state */
187*b1066cf3Schristos 	if ((r = sshkey_xmss_deserialize_state_opt(key, b)) != 0)
188*b1066cf3Schristos 		goto out;
189*b1066cf3Schristos 	/* success */
190*b1066cf3Schristos 	r = 0;
191*b1066cf3Schristos  out:
192*b1066cf3Schristos 	free(xmss_name);
193*b1066cf3Schristos 	freezero(xmss_pk, pklen);
194*b1066cf3Schristos 	freezero(xmss_sk, sklen);
195*b1066cf3Schristos 	return r;
196*b1066cf3Schristos }
197*b1066cf3Schristos 
198*b1066cf3Schristos static int
ssh_xmss_sign(struct sshkey * key,u_char ** sigp,size_t * lenp,const u_char * data,size_t datalen,const char * alg,const char * sk_provider,const char * sk_pin,u_int compat)199*b1066cf3Schristos ssh_xmss_sign(struct sshkey *key,
200*b1066cf3Schristos     u_char **sigp, size_t *lenp,
201*b1066cf3Schristos     const u_char *data, size_t datalen,
202*b1066cf3Schristos     const char *alg, const char *sk_provider, const char *sk_pin, u_int compat)
203ad340bdfSchristos {
204ad340bdfSchristos 	u_char *sig = NULL;
205ad340bdfSchristos 	size_t slen = 0, len = 0, required_siglen;
206ad340bdfSchristos 	unsigned long long smlen;
207ad340bdfSchristos 	int r, ret;
208ad340bdfSchristos 	struct sshbuf *b = NULL;
209ad340bdfSchristos 
210ad340bdfSchristos 	if (lenp != NULL)
211ad340bdfSchristos 		*lenp = 0;
212ad340bdfSchristos 	if (sigp != NULL)
213ad340bdfSchristos 		*sigp = NULL;
214ad340bdfSchristos 
215ad340bdfSchristos 	if (key == NULL ||
216ad340bdfSchristos 	    sshkey_type_plain(key->type) != KEY_XMSS ||
217ad340bdfSchristos 	    key->xmss_sk == NULL ||
218ad340bdfSchristos 	    sshkey_xmss_params(key) == NULL)
219ad340bdfSchristos 		return SSH_ERR_INVALID_ARGUMENT;
220ad340bdfSchristos 	if ((r = sshkey_xmss_siglen(key, &required_siglen)) != 0)
221ad340bdfSchristos 		return r;
222ad340bdfSchristos 	if (datalen >= INT_MAX - required_siglen)
223ad340bdfSchristos 		return SSH_ERR_INVALID_ARGUMENT;
224ad340bdfSchristos 	smlen = slen = datalen + required_siglen;
225ad340bdfSchristos 	if ((sig = malloc(slen)) == NULL)
226ad340bdfSchristos 		return SSH_ERR_ALLOC_FAIL;
22717418e98Schristos 	if ((r = sshkey_xmss_get_state(key, 1)) != 0)
228ad340bdfSchristos 		goto out;
229ad340bdfSchristos 	if ((ret = xmss_sign(key->xmss_sk, sshkey_xmss_bds_state(key), sig, &smlen,
230ad340bdfSchristos 	    data, datalen, sshkey_xmss_params(key))) != 0 || smlen <= datalen) {
231ad340bdfSchristos 		r = SSH_ERR_INVALID_ARGUMENT; /* XXX better error? */
232ad340bdfSchristos 		goto out;
233ad340bdfSchristos 	}
234ad340bdfSchristos 	/* encode signature */
235ad340bdfSchristos 	if ((b = sshbuf_new()) == NULL) {
236ad340bdfSchristos 		r = SSH_ERR_ALLOC_FAIL;
237ad340bdfSchristos 		goto out;
238ad340bdfSchristos 	}
239ad340bdfSchristos 	if ((r = sshbuf_put_cstring(b, "ssh-xmss@openssh.com")) != 0 ||
240ad340bdfSchristos 	    (r = sshbuf_put_string(b, sig, smlen - datalen)) != 0)
241ad340bdfSchristos 		goto out;
242ad340bdfSchristos 	len = sshbuf_len(b);
243ad340bdfSchristos 	if (sigp != NULL) {
244ad340bdfSchristos 		if ((*sigp = malloc(len)) == NULL) {
245ad340bdfSchristos 			r = SSH_ERR_ALLOC_FAIL;
246ad340bdfSchristos 			goto out;
247ad340bdfSchristos 		}
248ad340bdfSchristos 		memcpy(*sigp, sshbuf_ptr(b), len);
249ad340bdfSchristos 	}
250ad340bdfSchristos 	if (lenp != NULL)
251ad340bdfSchristos 		*lenp = len;
252ad340bdfSchristos 	/* success */
253ad340bdfSchristos 	r = 0;
254ad340bdfSchristos  out:
25517418e98Schristos 	if ((ret = sshkey_xmss_update_state(key, 1)) != 0) {
256ad340bdfSchristos 		/* discard signature since we cannot update the state */
257ad340bdfSchristos 		if (r == 0 && sigp != NULL && *sigp != NULL) {
258ad340bdfSchristos 			explicit_bzero(*sigp, len);
259ad340bdfSchristos 			free(*sigp);
260ad340bdfSchristos 		}
261ad340bdfSchristos 		if (sigp != NULL)
262ad340bdfSchristos 			*sigp = NULL;
263ad340bdfSchristos 		if (lenp != NULL)
264ad340bdfSchristos 			*lenp = 0;
265ad340bdfSchristos 		r = ret;
266ad340bdfSchristos 	}
267ad340bdfSchristos 	sshbuf_free(b);
2688db691beSchristos 	if (sig != NULL)
2698db691beSchristos 		freezero(sig, slen);
270ad340bdfSchristos 
271ad340bdfSchristos 	return r;
272ad340bdfSchristos }
273ad340bdfSchristos 
274*b1066cf3Schristos static int
ssh_xmss_verify(const struct sshkey * key,const u_char * sig,size_t siglen,const u_char * data,size_t dlen,const char * alg,u_int compat,struct sshkey_sig_details ** detailsp)275ad340bdfSchristos ssh_xmss_verify(const struct sshkey *key,
276*b1066cf3Schristos     const u_char *sig, size_t siglen,
277*b1066cf3Schristos     const u_char *data, size_t dlen, const char *alg, u_int compat,
278*b1066cf3Schristos     struct sshkey_sig_details **detailsp)
279ad340bdfSchristos {
280ad340bdfSchristos 	struct sshbuf *b = NULL;
281ad340bdfSchristos 	char *ktype = NULL;
282ad340bdfSchristos 	const u_char *sigblob;
283ad340bdfSchristos 	u_char *sm = NULL, *m = NULL;
284ad340bdfSchristos 	size_t len, required_siglen;
285ad340bdfSchristos 	unsigned long long smlen = 0, mlen = 0;
286ad340bdfSchristos 	int r, ret;
287ad340bdfSchristos 
288ad340bdfSchristos 	if (key == NULL ||
289ad340bdfSchristos 	    sshkey_type_plain(key->type) != KEY_XMSS ||
290ad340bdfSchristos 	    key->xmss_pk == NULL ||
291ad340bdfSchristos 	    sshkey_xmss_params(key) == NULL ||
292*b1066cf3Schristos 	    sig == NULL || siglen == 0)
293ad340bdfSchristos 		return SSH_ERR_INVALID_ARGUMENT;
294ad340bdfSchristos 	if ((r = sshkey_xmss_siglen(key, &required_siglen)) != 0)
295ad340bdfSchristos 		return r;
296*b1066cf3Schristos 	if (dlen >= INT_MAX - required_siglen)
297ad340bdfSchristos 		return SSH_ERR_INVALID_ARGUMENT;
298ad340bdfSchristos 
299*b1066cf3Schristos 	if ((b = sshbuf_from(sig, siglen)) == NULL)
300ad340bdfSchristos 		return SSH_ERR_ALLOC_FAIL;
301ad340bdfSchristos 	if ((r = sshbuf_get_cstring(b, &ktype, NULL)) != 0 ||
302ad340bdfSchristos 	    (r = sshbuf_get_string_direct(b, &sigblob, &len)) != 0)
303ad340bdfSchristos 		goto out;
304ad340bdfSchristos 	if (strcmp("ssh-xmss@openssh.com", ktype) != 0) {
305ad340bdfSchristos 		r = SSH_ERR_KEY_TYPE_MISMATCH;
306ad340bdfSchristos 		goto out;
307ad340bdfSchristos 	}
308ad340bdfSchristos 	if (sshbuf_len(b) != 0) {
309ad340bdfSchristos 		r = SSH_ERR_UNEXPECTED_TRAILING_DATA;
310ad340bdfSchristos 		goto out;
311ad340bdfSchristos 	}
312ad340bdfSchristos 	if (len != required_siglen) {
313ad340bdfSchristos 		r = SSH_ERR_INVALID_FORMAT;
314ad340bdfSchristos 		goto out;
315ad340bdfSchristos 	}
316*b1066cf3Schristos 	if (dlen >= SIZE_MAX - len) {
317ad340bdfSchristos 		r = SSH_ERR_INVALID_ARGUMENT;
318ad340bdfSchristos 		goto out;
319ad340bdfSchristos 	}
320*b1066cf3Schristos 	smlen = len + dlen;
321ad340bdfSchristos 	mlen = smlen;
322ad340bdfSchristos 	if ((sm = malloc(smlen)) == NULL || (m = malloc(mlen)) == NULL) {
323ad340bdfSchristos 		r = SSH_ERR_ALLOC_FAIL;
324ad340bdfSchristos 		goto out;
325ad340bdfSchristos 	}
326ad340bdfSchristos 	memcpy(sm, sigblob, len);
327*b1066cf3Schristos 	memcpy(sm+len, data, dlen);
328ad340bdfSchristos 	if ((ret = xmss_sign_open(m, &mlen, sm, smlen,
329ad340bdfSchristos 	    key->xmss_pk, sshkey_xmss_params(key))) != 0) {
33017418e98Schristos 		debug2_f("xmss_sign_open failed: %d", ret);
331ad340bdfSchristos 	}
332*b1066cf3Schristos 	if (ret != 0 || mlen != dlen) {
333ad340bdfSchristos 		r = SSH_ERR_SIGNATURE_INVALID;
334ad340bdfSchristos 		goto out;
335ad340bdfSchristos 	}
336ad340bdfSchristos 	/* XXX compare 'm' and 'data' ? */
337ad340bdfSchristos 	/* success */
338ad340bdfSchristos 	r = 0;
339ad340bdfSchristos  out:
3408db691beSchristos 	if (sm != NULL)
3418db691beSchristos 		freezero(sm, smlen);
3428db691beSchristos 	if (m != NULL)
3438db691beSchristos 		freezero(m, smlen);
344ad340bdfSchristos 	sshbuf_free(b);
345ad340bdfSchristos 	free(ktype);
346ad340bdfSchristos 	return r;
347ad340bdfSchristos }
348*b1066cf3Schristos 
349*b1066cf3Schristos static const struct sshkey_impl_funcs sshkey_xmss_funcs = {
350*b1066cf3Schristos 	/* .size = */		NULL,
351*b1066cf3Schristos 	/* .alloc = */		NULL,
352*b1066cf3Schristos 	/* .cleanup = */	ssh_xmss_cleanup,
353*b1066cf3Schristos 	/* .equal = */		ssh_xmss_equal,
354*b1066cf3Schristos 	/* .ssh_serialize_public = */ ssh_xmss_serialize_public,
355*b1066cf3Schristos 	/* .ssh_deserialize_public = */ ssh_xmss_deserialize_public,
356*b1066cf3Schristos 	/* .ssh_serialize_private = */ ssh_xmss_serialize_private,
357*b1066cf3Schristos 	/* .ssh_deserialize_private = */ ssh_xmss_deserialize_private,
358*b1066cf3Schristos 	/* .generate = */	sshkey_xmss_generate_private_key,
359*b1066cf3Schristos 	/* .copy_public = */	ssh_xmss_copy_public,
360*b1066cf3Schristos 	/* .sign = */		ssh_xmss_sign,
361*b1066cf3Schristos 	/* .verify = */		ssh_xmss_verify,
362*b1066cf3Schristos };
363*b1066cf3Schristos 
364*b1066cf3Schristos const struct sshkey_impl sshkey_xmss_impl = {
365*b1066cf3Schristos 	/* .name = */		"ssh-xmss@openssh.com",
366*b1066cf3Schristos 	/* .shortname = */	"XMSS",
367*b1066cf3Schristos 	/* .sigalg = */		NULL,
368*b1066cf3Schristos 	/* .type = */		KEY_XMSS,
369*b1066cf3Schristos 	/* .nid = */		0,
370*b1066cf3Schristos 	/* .cert = */		0,
371*b1066cf3Schristos 	/* .sigonly = */	0,
372*b1066cf3Schristos 	/* .keybits = */	256,
373*b1066cf3Schristos 	/* .funcs = */		&sshkey_xmss_funcs,
374*b1066cf3Schristos };
375*b1066cf3Schristos 
376*b1066cf3Schristos const struct sshkey_impl sshkey_xmss_cert_impl = {
377*b1066cf3Schristos 	/* .name = */		"ssh-xmss-cert-v01@openssh.com",
378*b1066cf3Schristos 	/* .shortname = */	"XMSS-CERT",
379*b1066cf3Schristos 	/* .sigalg = */		NULL,
380*b1066cf3Schristos 	/* .type = */		KEY_XMSS_CERT,
381*b1066cf3Schristos 	/* .nid = */		0,
382*b1066cf3Schristos 	/* .cert = */		1,
383*b1066cf3Schristos 	/* .sigonly = */	0,
384*b1066cf3Schristos 	/* .keybits = */	256,
385*b1066cf3Schristos 	/* .funcs = */		&sshkey_xmss_funcs,
386*b1066cf3Schristos };
387