xref: /netbsd-src/crypto/external/bsd/openssh/dist/sshkey-xmss.h (revision b1066cf3cd3cc4bc809a7791a10cc5857ad5d501)
1*b1066cf3Schristos /*	$NetBSD: sshkey-xmss.h,v 1.5 2023/07/26 17:58:16 christos Exp $	*/
2*b1066cf3Schristos /* $OpenBSD: sshkey-xmss.h,v 1.4 2022/10/28 00:39:29 djm Exp $ */
3ad340bdfSchristos /*
4ad340bdfSchristos  * Copyright (c) 2017 Markus Friedl.  All rights reserved.
5ad340bdfSchristos  *
6ad340bdfSchristos  * Redistribution and use in source and binary forms, with or without
7ad340bdfSchristos  * modification, are permitted provided that the following conditions
8ad340bdfSchristos  * are met:
9ad340bdfSchristos  * 1. Redistributions of source code must retain the above copyright
10ad340bdfSchristos  *    notice, this list of conditions and the following disclaimer.
11ad340bdfSchristos  * 2. Redistributions in binary form must reproduce the above copyright
12ad340bdfSchristos  *    notice, this list of conditions and the following disclaimer in the
13ad340bdfSchristos  *    documentation and/or other materials provided with the distribution.
14ad340bdfSchristos  *
15ad340bdfSchristos  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16ad340bdfSchristos  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17ad340bdfSchristos  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18ad340bdfSchristos  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19ad340bdfSchristos  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20ad340bdfSchristos  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21ad340bdfSchristos  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22ad340bdfSchristos  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23ad340bdfSchristos  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24ad340bdfSchristos  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25ad340bdfSchristos  */
26ad340bdfSchristos #ifndef SSHKEY_XMSS_H
27ad340bdfSchristos #define SSHKEY_XMSS_H
28ad340bdfSchristos 
29ad340bdfSchristos #define XMSS_SHA2_256_W16_H10_NAME	"XMSS_SHA2-256_W16_H10"
30ad340bdfSchristos #define XMSS_SHA2_256_W16_H16_NAME	"XMSS_SHA2-256_W16_H16"
31ad340bdfSchristos #define XMSS_SHA2_256_W16_H20_NAME	"XMSS_SHA2-256_W16_H20"
32ad340bdfSchristos #define XMSS_DEFAULT_NAME		XMSS_SHA2_256_W16_H10_NAME
33ad340bdfSchristos 
34ad340bdfSchristos size_t	 sshkey_xmss_pklen(const struct sshkey *);
35ad340bdfSchristos size_t	 sshkey_xmss_sklen(const struct sshkey *);
36ad340bdfSchristos int	 sshkey_xmss_init(struct sshkey *, const char *);
37ad340bdfSchristos void	 sshkey_xmss_free_state(struct sshkey *);
38*b1066cf3Schristos int	 sshkey_xmss_generate_private_key(struct sshkey *, int);
39ad340bdfSchristos int	 sshkey_xmss_serialize_state(const struct sshkey *, struct sshbuf *);
40ad340bdfSchristos int	 sshkey_xmss_serialize_state_opt(const struct sshkey *, struct sshbuf *,
41ad340bdfSchristos 	    enum sshkey_serialize_rep);
42ad340bdfSchristos int	 sshkey_xmss_serialize_pk_info(const struct sshkey *, struct sshbuf *,
43ad340bdfSchristos 	    enum sshkey_serialize_rep);
44ad340bdfSchristos int	 sshkey_xmss_deserialize_state(struct sshkey *, struct sshbuf *);
45ad340bdfSchristos int	 sshkey_xmss_deserialize_state_opt(struct sshkey *, struct sshbuf *);
46ad340bdfSchristos int	 sshkey_xmss_deserialize_pk_info(struct sshkey *, struct sshbuf *);
47ad340bdfSchristos 
48ad340bdfSchristos int	 sshkey_xmss_siglen(const struct sshkey *, size_t *);
49ad340bdfSchristos void	*sshkey_xmss_params(const struct sshkey *);
50ad340bdfSchristos void	*sshkey_xmss_bds_state(const struct sshkey *);
5117418e98Schristos int	 sshkey_xmss_get_state(const struct sshkey *, int);
52ad340bdfSchristos int	 sshkey_xmss_enable_maxsign(struct sshkey *, u_int32_t);
53ad340bdfSchristos int	 sshkey_xmss_forward_state(const struct sshkey *, u_int32_t);
5417418e98Schristos int	 sshkey_xmss_update_state(const struct sshkey *, int);
55ad340bdfSchristos u_int32_t sshkey_xmss_signatures_left(const struct sshkey *);
56ad340bdfSchristos 
57ad340bdfSchristos #endif /* SSHKEY_XMSS_H */
58