xref: /openssh-portable/sshkey.h (revision 3b44f251)
1*3b44f251Sdjm@openbsd.org /* $OpenBSD: sshkey.h,v 1.49 2021/01/26 00:49:30 djm Exp $ */
28668706dSDamien Miller 
38668706dSDamien Miller /*
48668706dSDamien Miller  * Copyright (c) 2000, 2001 Markus Friedl.  All rights reserved.
58668706dSDamien Miller  *
68668706dSDamien Miller  * Redistribution and use in source and binary forms, with or without
78668706dSDamien Miller  * modification, are permitted provided that the following conditions
88668706dSDamien Miller  * are met:
98668706dSDamien Miller  * 1. Redistributions of source code must retain the above copyright
108668706dSDamien Miller  *    notice, this list of conditions and the following disclaimer.
118668706dSDamien Miller  * 2. Redistributions in binary form must reproduce the above copyright
128668706dSDamien Miller  *    notice, this list of conditions and the following disclaimer in the
138668706dSDamien Miller  *    documentation and/or other materials provided with the distribution.
148668706dSDamien Miller  *
158668706dSDamien Miller  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
168668706dSDamien Miller  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
178668706dSDamien Miller  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
188668706dSDamien Miller  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
198668706dSDamien Miller  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
208668706dSDamien Miller  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
218668706dSDamien Miller  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
228668706dSDamien Miller  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
238668706dSDamien Miller  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
248668706dSDamien Miller  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
258668706dSDamien Miller  */
268668706dSDamien Miller #ifndef SSHKEY_H
278668706dSDamien Miller #define SSHKEY_H
288668706dSDamien Miller 
298668706dSDamien Miller #include <sys/types.h>
308668706dSDamien Miller 
318668706dSDamien Miller #ifdef WITH_OPENSSL
328668706dSDamien Miller #include <openssl/rsa.h>
338668706dSDamien Miller #include <openssl/dsa.h>
34f0935698SDamien Miller # ifdef OPENSSL_HAS_ECC
358668706dSDamien Miller #  include <openssl/ec.h>
3693f02107Sdjm@openbsd.org #  include <openssl/ecdsa.h>
37f0935698SDamien Miller # else /* OPENSSL_HAS_ECC */
38f0935698SDamien Miller #  define EC_KEY	void
39f0935698SDamien Miller #  define EC_GROUP	void
40f0935698SDamien Miller #  define EC_POINT	void
41f0935698SDamien Miller # endif /* OPENSSL_HAS_ECC */
424d94b031Sdtucker@openbsd.org #define SSH_OPENSSL_VERSION OpenSSL_version(OPENSSL_VERSION)
43f0935698SDamien Miller #else /* WITH_OPENSSL */
44482d23bcSdjm@openbsd.org # define BIGNUM		void
458668706dSDamien Miller # define RSA		void
468668706dSDamien Miller # define DSA		void
478668706dSDamien Miller # define EC_KEY		void
488668706dSDamien Miller # define EC_GROUP	void
498668706dSDamien Miller # define EC_POINT	void
504d94b031Sdtucker@openbsd.org #define SSH_OPENSSL_VERSION "without OpenSSL"
518668706dSDamien Miller #endif /* WITH_OPENSSL */
528668706dSDamien Miller 
53bd636f40Sdjm@openbsd.org #define SSH_RSA_MINIMUM_MODULUS_SIZE	1024
548668706dSDamien Miller #define SSH_KEY_MAX_SIGN_DATA_SIZE	(1 << 20)
558668706dSDamien Miller 
568668706dSDamien Miller struct sshbuf;
578668706dSDamien Miller 
588668706dSDamien Miller /* Key types */
598668706dSDamien Miller enum sshkey_types {
608668706dSDamien Miller 	KEY_RSA,
618668706dSDamien Miller 	KEY_DSA,
628668706dSDamien Miller 	KEY_ECDSA,
638668706dSDamien Miller 	KEY_ED25519,
648668706dSDamien Miller 	KEY_RSA_CERT,
658668706dSDamien Miller 	KEY_DSA_CERT,
668668706dSDamien Miller 	KEY_ECDSA_CERT,
678668706dSDamien Miller 	KEY_ED25519_CERT,
681b11ea7cSmarkus@openbsd.org 	KEY_XMSS,
691b11ea7cSmarkus@openbsd.org 	KEY_XMSS_CERT,
7002bb0768Sdjm@openbsd.org 	KEY_ECDSA_SK,
7102bb0768Sdjm@openbsd.org 	KEY_ECDSA_SK_CERT,
727c096c45Smarkus@openbsd.org 	KEY_ED25519_SK,
737c096c45Smarkus@openbsd.org 	KEY_ED25519_SK_CERT,
748668706dSDamien Miller 	KEY_UNSPEC
758668706dSDamien Miller };
768668706dSDamien Miller 
7756d1c83cSdjm@openbsd.org /* Default fingerprint hash */
7856d1c83cSdjm@openbsd.org #define SSH_FP_HASH_DEFAULT	SSH_DIGEST_SHA256
798668706dSDamien Miller 
808668706dSDamien Miller /* Fingerprint representation formats */
818668706dSDamien Miller enum sshkey_fp_rep {
8256d1c83cSdjm@openbsd.org 	SSH_FP_DEFAULT = 0,
838668706dSDamien Miller 	SSH_FP_HEX,
8456d1c83cSdjm@openbsd.org 	SSH_FP_BASE64,
858668706dSDamien Miller 	SSH_FP_BUBBLEBABBLE,
868668706dSDamien Miller 	SSH_FP_RANDOMART
878668706dSDamien Miller };
888668706dSDamien Miller 
891b11ea7cSmarkus@openbsd.org /* Private key serialisation formats, used on the wire */
901b11ea7cSmarkus@openbsd.org enum sshkey_serialize_rep {
911b11ea7cSmarkus@openbsd.org 	SSHKEY_SERIALIZE_DEFAULT = 0,
92bf219920Smarkus@openbsd.org 	SSHKEY_SERIALIZE_STATE = 1,	/* only state is serialized */
93bf219920Smarkus@openbsd.org 	SSHKEY_SERIALIZE_FULL = 2,	/* include keys for saving to disk */
94bf219920Smarkus@openbsd.org 	SSHKEY_SERIALIZE_SHIELD = 3,	/* everything, for encrypting in ram */
95bf219920Smarkus@openbsd.org 	SSHKEY_SERIALIZE_INFO = 254,	/* minimal information */
961b11ea7cSmarkus@openbsd.org };
971b11ea7cSmarkus@openbsd.org 
98eb0d8e70Sdjm@openbsd.org /* Private key disk formats */
99eb0d8e70Sdjm@openbsd.org enum sshkey_private_format {
100eb0d8e70Sdjm@openbsd.org 	SSHKEY_PRIVATE_OPENSSH = 0,
101eb0d8e70Sdjm@openbsd.org 	SSHKEY_PRIVATE_PEM = 1,
102eb0d8e70Sdjm@openbsd.org 	SSHKEY_PRIVATE_PKCS8 = 2,
103eb0d8e70Sdjm@openbsd.org };
104eb0d8e70Sdjm@openbsd.org 
1058668706dSDamien Miller /* key is stored in external hardware */
1068668706dSDamien Miller #define SSHKEY_FLAG_EXT		0x0001
1078668706dSDamien Miller 
1088668706dSDamien Miller #define SSHKEY_CERT_MAX_PRINCIPALS	256
1098668706dSDamien Miller /* XXX opaquify? */
1108668706dSDamien Miller struct sshkey_cert {
1118668706dSDamien Miller 	struct sshbuf	*certblob; /* Kept around for use on wire */
1128668706dSDamien Miller 	u_int		 type; /* SSH2_CERT_TYPE_USER or SSH2_CERT_TYPE_HOST */
1138668706dSDamien Miller 	u_int64_t	 serial;
1148668706dSDamien Miller 	char		*key_id;
1158668706dSDamien Miller 	u_int		 nprincipals;
1168668706dSDamien Miller 	char		**principals;
1178668706dSDamien Miller 	u_int64_t	 valid_after, valid_before;
1188668706dSDamien Miller 	struct sshbuf	*critical;
1198668706dSDamien Miller 	struct sshbuf	*extensions;
1208668706dSDamien Miller 	struct sshkey	*signature_key;
121a70fd4adSdjm@openbsd.org 	char		*signature_type;
1228668706dSDamien Miller };
1238668706dSDamien Miller 
1248668706dSDamien Miller /* XXX opaquify? */
1258668706dSDamien Miller struct sshkey {
1268668706dSDamien Miller 	int	 type;
1278668706dSDamien Miller 	int	 flags;
12802bb0768Sdjm@openbsd.org 	/* KEY_RSA */
1298668706dSDamien Miller 	RSA	*rsa;
13002bb0768Sdjm@openbsd.org 	/* KEY_DSA */
1318668706dSDamien Miller 	DSA	*dsa;
13202bb0768Sdjm@openbsd.org 	/* KEY_ECDSA and KEY_ECDSA_SK */
1338668706dSDamien Miller 	int	 ecdsa_nid;	/* NID of curve */
1348668706dSDamien Miller 	EC_KEY	*ecdsa;
1352c55744aSmarkus@openbsd.org 	/* KEY_ED25519 and KEY_ED25519_SK */
1368668706dSDamien Miller 	u_char	*ed25519_sk;
1378668706dSDamien Miller 	u_char	*ed25519_pk;
13802bb0768Sdjm@openbsd.org 	/* KEY_XMSS */
1391b11ea7cSmarkus@openbsd.org 	char	*xmss_name;
1401b11ea7cSmarkus@openbsd.org 	char	*xmss_filename;	/* for state file updates */
1411b11ea7cSmarkus@openbsd.org 	void	*xmss_state;	/* depends on xmss_name, opaque */
1421b11ea7cSmarkus@openbsd.org 	u_char	*xmss_sk;
1431b11ea7cSmarkus@openbsd.org 	u_char	*xmss_pk;
1442c55744aSmarkus@openbsd.org 	/* KEY_ECDSA_SK and KEY_ED25519_SK */
14502bb0768Sdjm@openbsd.org 	char	*sk_application;
14602bb0768Sdjm@openbsd.org 	uint8_t	sk_flags;
14702bb0768Sdjm@openbsd.org 	struct sshbuf *sk_key_handle;
14802bb0768Sdjm@openbsd.org 	struct sshbuf *sk_reserved;
14902bb0768Sdjm@openbsd.org 	/* Certificates */
1508668706dSDamien Miller 	struct sshkey_cert *cert;
15102bb0768Sdjm@openbsd.org 	/* Private key shielding */
1524f7a56d5Sdjm@openbsd.org 	u_char	*shielded_private;
1534f7a56d5Sdjm@openbsd.org 	size_t	shielded_len;
1544f7a56d5Sdjm@openbsd.org 	u_char	*shield_prekey;
1554f7a56d5Sdjm@openbsd.org 	size_t	shield_prekey_len;
1568668706dSDamien Miller };
1578668706dSDamien Miller 
1588668706dSDamien Miller #define	ED25519_SK_SZ	crypto_sign_ed25519_SECRETKEYBYTES
1598668706dSDamien Miller #define	ED25519_PK_SZ	crypto_sign_ed25519_PUBLICKEYBYTES
1608668706dSDamien Miller 
161b7e74ea0Sdjm@openbsd.org /* Additional fields contained in signature */
162b7e74ea0Sdjm@openbsd.org struct sshkey_sig_details {
163b7e74ea0Sdjm@openbsd.org 	uint32_t sk_counter;	/* U2F signature counter */
164b7e74ea0Sdjm@openbsd.org 	uint8_t sk_flags;	/* U2F signature flags; see ssh-sk.h */
165b7e74ea0Sdjm@openbsd.org };
166b7e74ea0Sdjm@openbsd.org 
1678668706dSDamien Miller struct sshkey	*sshkey_new(int);
1688668706dSDamien Miller void		 sshkey_free(struct sshkey *);
1698668706dSDamien Miller int		 sshkey_equal_public(const struct sshkey *,
1708668706dSDamien Miller     const struct sshkey *);
1718668706dSDamien Miller int		 sshkey_equal(const struct sshkey *, const struct sshkey *);
1728668706dSDamien Miller char		*sshkey_fingerprint(const struct sshkey *,
17356d1c83cSdjm@openbsd.org     int, enum sshkey_fp_rep);
1748668706dSDamien Miller int		 sshkey_fingerprint_raw(const struct sshkey *k,
17556d1c83cSdjm@openbsd.org     int, u_char **retp, size_t *lenp);
1768668706dSDamien Miller const char	*sshkey_type(const struct sshkey *);
1778668706dSDamien Miller const char	*sshkey_cert_type(const struct sshkey *);
1786026f48dSdjm@openbsd.org int		 sshkey_format_text(const struct sshkey *, struct sshbuf *);
1798668706dSDamien Miller int		 sshkey_write(const struct sshkey *, FILE *);
1808668706dSDamien Miller int		 sshkey_read(struct sshkey *, char **);
1818668706dSDamien Miller u_int		 sshkey_size(const struct sshkey *);
1828668706dSDamien Miller 
1838668706dSDamien Miller int		 sshkey_generate(int type, u_int bits, struct sshkey **keyp);
1848668706dSDamien Miller int		 sshkey_from_private(const struct sshkey *, struct sshkey **);
1854f7a56d5Sdjm@openbsd.org 
1864f7a56d5Sdjm@openbsd.org int		 sshkey_is_shielded(struct sshkey *);
1874f7a56d5Sdjm@openbsd.org int		 sshkey_shield_private(struct sshkey *);
1884f7a56d5Sdjm@openbsd.org int		 sshkey_unshield_private(struct sshkey *);
1894f7a56d5Sdjm@openbsd.org 
1908668706dSDamien Miller int	 sshkey_type_from_name(const char *);
1918668706dSDamien Miller int	 sshkey_is_cert(const struct sshkey *);
1922c55744aSmarkus@openbsd.org int	 sshkey_is_sk(const struct sshkey *);
1938668706dSDamien Miller int	 sshkey_type_is_cert(int);
1948668706dSDamien Miller int	 sshkey_type_plain(int);
195c28fc62dSdjm@openbsd.org int	 sshkey_to_certified(struct sshkey *);
1968668706dSDamien Miller int	 sshkey_drop_cert(struct sshkey *);
1978668706dSDamien Miller int	 sshkey_cert_copy(const struct sshkey *, struct sshkey *);
198*3b44f251Sdjm@openbsd.org int	 sshkey_cert_check_authority(const struct sshkey *, int, int, int,
1998668706dSDamien Miller     const char *, const char **);
200*3b44f251Sdjm@openbsd.org int	 sshkey_cert_check_host(const struct sshkey *, const char *,
201*3b44f251Sdjm@openbsd.org     int , const char *, const char **);
202499cf36fSdjm@openbsd.org size_t	 sshkey_format_cert_validity(const struct sshkey_cert *,
203499cf36fSdjm@openbsd.org     char *, size_t) __attribute__((__bounded__(__string__, 2, 3)));
204ba9e7883Sdjm@openbsd.org int	 sshkey_check_cert_sigtype(const struct sshkey *, const char *);
2058668706dSDamien Miller 
2069a14c64cSdjm@openbsd.org int	 sshkey_certify(struct sshkey *, struct sshkey *,
2079b8ad938Sdjm@openbsd.org     const char *, const char *, const char *);
208a98339edSdjm@openbsd.org /* Variant allowing use of a custom signature function (e.g. for ssh-agent) */
2094f7a56d5Sdjm@openbsd.org typedef int sshkey_certify_signer(struct sshkey *, u_char **, size_t *,
2109b8ad938Sdjm@openbsd.org     const u_char *, size_t, const char *, const char *, const char *,
2119b8ad938Sdjm@openbsd.org     u_int, void *);
212a98339edSdjm@openbsd.org int	 sshkey_certify_custom(struct sshkey *, struct sshkey *, const char *,
2139b8ad938Sdjm@openbsd.org     const char *, const char *, sshkey_certify_signer *, void *);
214a98339edSdjm@openbsd.org 
2158668706dSDamien Miller int		 sshkey_ecdsa_nid_from_name(const char *);
2168668706dSDamien Miller int		 sshkey_curve_name_to_nid(const char *);
2178668706dSDamien Miller const char *	 sshkey_curve_nid_to_name(int);
2188668706dSDamien Miller u_int		 sshkey_curve_nid_to_bits(int);
2198668706dSDamien Miller int		 sshkey_ecdsa_bits_to_nid(int);
2208668706dSDamien Miller int		 sshkey_ecdsa_key_to_nid(EC_KEY *);
2218668706dSDamien Miller int		 sshkey_ec_nid_to_hash_alg(int nid);
2228668706dSDamien Miller int		 sshkey_ec_validate_public(const EC_GROUP *, const EC_POINT *);
2238668706dSDamien Miller int		 sshkey_ec_validate_private(const EC_KEY *);
2248668706dSDamien Miller const char	*sshkey_ssh_name(const struct sshkey *);
2258668706dSDamien Miller const char	*sshkey_ssh_name_plain(const struct sshkey *);
2261f729f06Sdjm@openbsd.org int		 sshkey_names_valid2(const char *, int);
227183ba55aSdjm@openbsd.org char		*sshkey_alg_list(int, int, int, char);
2288668706dSDamien Miller 
2298668706dSDamien Miller int	 sshkey_from_blob(const u_char *, size_t, struct sshkey **);
23060b18252Sdjm@openbsd.org int	 sshkey_fromb(struct sshbuf *, struct sshkey **);
23160b18252Sdjm@openbsd.org int	 sshkey_froms(struct sshbuf *, struct sshkey **);
2328668706dSDamien Miller int	 sshkey_to_blob(const struct sshkey *, u_char **, size_t *);
233d80fbe41Sdjm@openbsd.org int	 sshkey_to_base64(const struct sshkey *, char **);
23460b18252Sdjm@openbsd.org int	 sshkey_putb(const struct sshkey *, struct sshbuf *);
23560b18252Sdjm@openbsd.org int	 sshkey_puts(const struct sshkey *, struct sshbuf *);
2361b11ea7cSmarkus@openbsd.org int	 sshkey_puts_opts(const struct sshkey *, struct sshbuf *,
2371b11ea7cSmarkus@openbsd.org     enum sshkey_serialize_rep);
2388668706dSDamien Miller int	 sshkey_plain_to_blob(const struct sshkey *, u_char **, size_t *);
23960b18252Sdjm@openbsd.org int	 sshkey_putb_plain(const struct sshkey *, struct sshbuf *);
2408668706dSDamien Miller 
2414f7a56d5Sdjm@openbsd.org int	 sshkey_sign(struct sshkey *, u_char **, size_t *,
2429b8ad938Sdjm@openbsd.org     const u_char *, size_t, const char *, const char *, const char *, u_int);
2438668706dSDamien Miller int	 sshkey_verify(const struct sshkey *, const u_char *, size_t,
244b7e74ea0Sdjm@openbsd.org     const u_char *, size_t, const char *, u_int, struct sshkey_sig_details **);
2454ba0d547Sdjm@openbsd.org int	 sshkey_check_sigtype(const u_char *, size_t, const char *);
246b4d4eda6Sdjm@openbsd.org const char *sshkey_sigalg_by_name(const char *);
247f8df0413Sdjm@openbsd.org int	 sshkey_get_sigtype(const u_char *, size_t, char **);
2488668706dSDamien Miller 
2498668706dSDamien Miller /* for debug */
2508668706dSDamien Miller void	sshkey_dump_ec_point(const EC_GROUP *, const EC_POINT *);
2518668706dSDamien Miller void	sshkey_dump_ec_key(const EC_KEY *);
2528668706dSDamien Miller 
2538668706dSDamien Miller /* private key parsing and serialisation */
2544f7a56d5Sdjm@openbsd.org int	sshkey_private_serialize(struct sshkey *key, struct sshbuf *buf);
2554f7a56d5Sdjm@openbsd.org int	sshkey_private_serialize_opt(struct sshkey *key, struct sshbuf *buf,
2561b11ea7cSmarkus@openbsd.org     enum sshkey_serialize_rep);
2578668706dSDamien Miller int	sshkey_private_deserialize(struct sshbuf *buf,  struct sshkey **keyp);
2588668706dSDamien Miller 
2598668706dSDamien Miller /* private key file format parsing and serialisation */
2608668706dSDamien Miller int	sshkey_private_to_fileblob(struct sshkey *key, struct sshbuf *blob,
2618668706dSDamien Miller     const char *passphrase, const char *comment,
262eb0d8e70Sdjm@openbsd.org     int format, const char *openssh_format_cipher, int openssh_format_rounds);
2638668706dSDamien Miller int	sshkey_parse_private_fileblob(struct sshbuf *buffer,
2643c019a93Stim@openbsd.org     const char *passphrase, struct sshkey **keyp, char **commentp);
2658668706dSDamien Miller int	sshkey_parse_private_fileblob_type(struct sshbuf *blob, int type,
2668668706dSDamien Miller     const char *passphrase, struct sshkey **keyp, char **commentp);
267f290ab08Sdjm@openbsd.org int	sshkey_parse_pubkey_from_private_fileblob_type(struct sshbuf *blob,
268f290ab08Sdjm@openbsd.org     int type, struct sshkey **pubkeyp);
2698668706dSDamien Miller 
27083fa3a04Sdjm@openbsd.org /* XXX should be internal, but used by ssh-keygen */
271482d23bcSdjm@openbsd.org int ssh_rsa_complete_crt_parameters(struct sshkey *, const BIGNUM *);
27283fa3a04Sdjm@openbsd.org 
2731b11ea7cSmarkus@openbsd.org /* stateful keys (e.g. XMSS) */
2741b11ea7cSmarkus@openbsd.org int	 sshkey_set_filename(struct sshkey *, const char *);
2751b11ea7cSmarkus@openbsd.org int	 sshkey_enable_maxsign(struct sshkey *, u_int32_t);
2761b11ea7cSmarkus@openbsd.org u_int32_t sshkey_signatures_left(const struct sshkey *);
277eab2888cSdtucker@openbsd.org int	 sshkey_forward_state(const struct sshkey *, u_int32_t, int);
278eab2888cSdtucker@openbsd.org int	 sshkey_private_serialize_maxsign(struct sshkey *key,
279eab2888cSdtucker@openbsd.org     struct sshbuf *buf, u_int32_t maxsign, int);
2801b11ea7cSmarkus@openbsd.org 
281b7e74ea0Sdjm@openbsd.org void	 sshkey_sig_details_free(struct sshkey_sig_details *);
282b7e74ea0Sdjm@openbsd.org 
2838668706dSDamien Miller #ifdef SSHKEY_INTERNAL
28476c9fbbeSmarkus@openbsd.org int ssh_rsa_sign(const struct sshkey *key,
28576c9fbbeSmarkus@openbsd.org     u_char **sigp, size_t *lenp, const u_char *data, size_t datalen,
28676c9fbbeSmarkus@openbsd.org     const char *ident);
2878668706dSDamien Miller int ssh_rsa_verify(const struct sshkey *key,
28804c7e28fSdjm@openbsd.org     const u_char *sig, size_t siglen, const u_char *data, size_t datalen,
28904c7e28fSdjm@openbsd.org     const char *alg);
2908668706dSDamien Miller int ssh_dss_sign(const struct sshkey *key, u_char **sigp, size_t *lenp,
2918668706dSDamien Miller     const u_char *data, size_t datalen, u_int compat);
2928668706dSDamien Miller int ssh_dss_verify(const struct sshkey *key,
2938668706dSDamien Miller     const u_char *signature, size_t signaturelen,
2948668706dSDamien Miller     const u_char *data, size_t datalen, u_int compat);
2958668706dSDamien Miller int ssh_ecdsa_sign(const struct sshkey *key, u_char **sigp, size_t *lenp,
2968668706dSDamien Miller     const u_char *data, size_t datalen, u_int compat);
2978668706dSDamien Miller int ssh_ecdsa_verify(const struct sshkey *key,
2988668706dSDamien Miller     const u_char *signature, size_t signaturelen,
2998668706dSDamien Miller     const u_char *data, size_t datalen, u_int compat);
30002bb0768Sdjm@openbsd.org int ssh_ecdsa_sk_verify(const struct sshkey *key,
30102bb0768Sdjm@openbsd.org     const u_char *signature, size_t signaturelen,
302b7e74ea0Sdjm@openbsd.org     const u_char *data, size_t datalen, u_int compat,
303b7e74ea0Sdjm@openbsd.org     struct sshkey_sig_details **detailsp);
3048668706dSDamien Miller int ssh_ed25519_sign(const struct sshkey *key, u_char **sigp, size_t *lenp,
3058668706dSDamien Miller     const u_char *data, size_t datalen, u_int compat);
3068668706dSDamien Miller int ssh_ed25519_verify(const struct sshkey *key,
3078668706dSDamien Miller     const u_char *signature, size_t signaturelen,
3088668706dSDamien Miller     const u_char *data, size_t datalen, u_int compat);
3097c096c45Smarkus@openbsd.org int ssh_ed25519_sk_verify(const struct sshkey *key,
3107c096c45Smarkus@openbsd.org     const u_char *signature, size_t signaturelen,
311b7e74ea0Sdjm@openbsd.org     const u_char *data, size_t datalen, u_int compat,
312b7e74ea0Sdjm@openbsd.org     struct sshkey_sig_details **detailsp);
3131b11ea7cSmarkus@openbsd.org int ssh_xmss_sign(const struct sshkey *key, u_char **sigp, size_t *lenp,
3141b11ea7cSmarkus@openbsd.org     const u_char *data, size_t datalen, u_int compat);
3151b11ea7cSmarkus@openbsd.org int ssh_xmss_verify(const struct sshkey *key,
3161b11ea7cSmarkus@openbsd.org     const u_char *signature, size_t signaturelen,
3171b11ea7cSmarkus@openbsd.org     const u_char *data, size_t datalen, u_int compat);
3188668706dSDamien Miller #endif
3198668706dSDamien Miller 
320f0935698SDamien Miller #if !defined(WITH_OPENSSL)
3218668706dSDamien Miller # undef RSA
3228668706dSDamien Miller # undef DSA
3238668706dSDamien Miller # undef EC_KEY
3248668706dSDamien Miller # undef EC_GROUP
3258668706dSDamien Miller # undef EC_POINT
326f0935698SDamien Miller #elif !defined(OPENSSL_HAS_ECC)
327f0935698SDamien Miller # undef EC_KEY
328f0935698SDamien Miller # undef EC_GROUP
329f0935698SDamien Miller # undef EC_POINT
330f0935698SDamien Miller #endif
3318668706dSDamien Miller 
3328668706dSDamien Miller #endif /* SSHKEY_H */
333