xref: /dragonfly/crypto/openssh/sshkey-xmss.h (revision 50a69bb5)
150a69bb5SSascha Wildner /* $OpenBSD: sshkey-xmss.h,v 1.3 2021/04/03 06:18:41 djm Exp $ */
2664f4763Szrj /*
3664f4763Szrj  * Copyright (c) 2017 Markus Friedl.  All rights reserved.
4664f4763Szrj  *
5664f4763Szrj  * Redistribution and use in source and binary forms, with or without
6664f4763Szrj  * modification, are permitted provided that the following conditions
7664f4763Szrj  * are met:
8664f4763Szrj  * 1. Redistributions of source code must retain the above copyright
9664f4763Szrj  *    notice, this list of conditions and the following disclaimer.
10664f4763Szrj  * 2. Redistributions in binary form must reproduce the above copyright
11664f4763Szrj  *    notice, this list of conditions and the following disclaimer in the
12664f4763Szrj  *    documentation and/or other materials provided with the distribution.
13664f4763Szrj  *
14664f4763Szrj  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15664f4763Szrj  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16664f4763Szrj  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17664f4763Szrj  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18664f4763Szrj  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19664f4763Szrj  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20664f4763Szrj  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21664f4763Szrj  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22664f4763Szrj  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23664f4763Szrj  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24664f4763Szrj  */
25664f4763Szrj #ifndef SSHKEY_XMSS_H
26664f4763Szrj #define SSHKEY_XMSS_H
27664f4763Szrj 
28664f4763Szrj #define XMSS_SHA2_256_W16_H10_NAME	"XMSS_SHA2-256_W16_H10"
29664f4763Szrj #define XMSS_SHA2_256_W16_H16_NAME	"XMSS_SHA2-256_W16_H16"
30664f4763Szrj #define XMSS_SHA2_256_W16_H20_NAME	"XMSS_SHA2-256_W16_H20"
31664f4763Szrj #define XMSS_DEFAULT_NAME		XMSS_SHA2_256_W16_H10_NAME
32664f4763Szrj 
33664f4763Szrj size_t	 sshkey_xmss_pklen(const struct sshkey *);
34664f4763Szrj size_t	 sshkey_xmss_sklen(const struct sshkey *);
35664f4763Szrj int	 sshkey_xmss_init(struct sshkey *, const char *);
36664f4763Szrj void	 sshkey_xmss_free_state(struct sshkey *);
37664f4763Szrj int	 sshkey_xmss_generate_private_key(struct sshkey *, u_int);
38664f4763Szrj int	 sshkey_xmss_serialize_state(const struct sshkey *, struct sshbuf *);
39664f4763Szrj int	 sshkey_xmss_serialize_state_opt(const struct sshkey *, struct sshbuf *,
40664f4763Szrj 	    enum sshkey_serialize_rep);
41664f4763Szrj int	 sshkey_xmss_serialize_pk_info(const struct sshkey *, struct sshbuf *,
42664f4763Szrj 	    enum sshkey_serialize_rep);
43664f4763Szrj int	 sshkey_xmss_deserialize_state(struct sshkey *, struct sshbuf *);
44664f4763Szrj int	 sshkey_xmss_deserialize_state_opt(struct sshkey *, struct sshbuf *);
45664f4763Szrj int	 sshkey_xmss_deserialize_pk_info(struct sshkey *, struct sshbuf *);
46664f4763Szrj 
47664f4763Szrj int	 sshkey_xmss_siglen(const struct sshkey *, size_t *);
48664f4763Szrj void	*sshkey_xmss_params(const struct sshkey *);
49664f4763Szrj void	*sshkey_xmss_bds_state(const struct sshkey *);
5050a69bb5SSascha Wildner int	 sshkey_xmss_get_state(const struct sshkey *, int);
51664f4763Szrj int	 sshkey_xmss_enable_maxsign(struct sshkey *, u_int32_t);
52664f4763Szrj int	 sshkey_xmss_forward_state(const struct sshkey *, u_int32_t);
5350a69bb5SSascha Wildner int	 sshkey_xmss_update_state(const struct sshkey *, int);
54664f4763Szrj u_int32_t sshkey_xmss_signatures_left(const struct sshkey *);
55664f4763Szrj 
56664f4763Szrj #endif /* SSHKEY_XMSS_H */
57