2022-10-28 00:44:44 +00:00
|
|
|
/* $OpenBSD: sshkey.h,v 1.61 2022/10/28 00:44:44 djm Exp $ */
|
2014-07-02 05:28:02 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
#ifndef SSHKEY_H
|
|
|
|
#define SSHKEY_H
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
|
|
#ifdef WITH_OPENSSL
|
|
|
|
#include <openssl/rsa.h>
|
|
|
|
#include <openssl/dsa.h>
|
2014-08-20 01:06:50 +00:00
|
|
|
# ifdef OPENSSL_HAS_ECC
|
|
|
|
# include <openssl/ec.h>
|
2019-01-20 22:51:37 +00:00
|
|
|
# include <openssl/ecdsa.h>
|
2014-08-20 01:06:50 +00:00
|
|
|
# else /* OPENSSL_HAS_ECC */
|
|
|
|
# define EC_KEY void
|
|
|
|
# define EC_GROUP void
|
|
|
|
# define EC_POINT void
|
|
|
|
# endif /* OPENSSL_HAS_ECC */
|
2020-11-08 11:46:12 +00:00
|
|
|
#define SSH_OPENSSL_VERSION OpenSSL_version(OPENSSL_VERSION)
|
2014-08-20 01:06:50 +00:00
|
|
|
#else /* WITH_OPENSSL */
|
2018-09-13 02:08:33 +00:00
|
|
|
# define BIGNUM void
|
2014-08-20 01:06:50 +00:00
|
|
|
# define RSA void
|
|
|
|
# define DSA void
|
|
|
|
# define EC_KEY void
|
|
|
|
# define EC_GROUP void
|
|
|
|
# define EC_POINT void
|
2020-11-08 11:46:12 +00:00
|
|
|
#define SSH_OPENSSL_VERSION "without OpenSSL"
|
2014-07-02 05:28:02 +00:00
|
|
|
#endif /* WITH_OPENSSL */
|
|
|
|
|
2017-05-07 23:15:59 +00:00
|
|
|
#define SSH_RSA_MINIMUM_MODULUS_SIZE 1024
|
2014-07-02 05:28:02 +00:00
|
|
|
#define SSH_KEY_MAX_SIGN_DATA_SIZE (1 << 20)
|
|
|
|
|
|
|
|
struct sshbuf;
|
|
|
|
|
|
|
|
/* Key types */
|
|
|
|
enum sshkey_types {
|
|
|
|
KEY_RSA,
|
|
|
|
KEY_DSA,
|
|
|
|
KEY_ECDSA,
|
|
|
|
KEY_ED25519,
|
|
|
|
KEY_RSA_CERT,
|
|
|
|
KEY_DSA_CERT,
|
|
|
|
KEY_ECDSA_CERT,
|
|
|
|
KEY_ED25519_CERT,
|
2018-02-23 15:58:37 +00:00
|
|
|
KEY_XMSS,
|
|
|
|
KEY_XMSS_CERT,
|
2019-10-31 21:15:14 +00:00
|
|
|
KEY_ECDSA_SK,
|
|
|
|
KEY_ECDSA_SK_CERT,
|
2019-11-12 19:29:24 +00:00
|
|
|
KEY_ED25519_SK,
|
|
|
|
KEY_ED25519_SK_CERT,
|
2014-07-02 05:28:02 +00:00
|
|
|
KEY_UNSPEC
|
|
|
|
};
|
|
|
|
|
2014-12-21 22:27:55 +00:00
|
|
|
/* Default fingerprint hash */
|
|
|
|
#define SSH_FP_HASH_DEFAULT SSH_DIGEST_SHA256
|
2014-07-02 05:28:02 +00:00
|
|
|
|
|
|
|
/* Fingerprint representation formats */
|
|
|
|
enum sshkey_fp_rep {
|
2014-12-21 22:27:55 +00:00
|
|
|
SSH_FP_DEFAULT = 0,
|
2014-07-02 05:28:02 +00:00
|
|
|
SSH_FP_HEX,
|
2014-12-21 22:27:55 +00:00
|
|
|
SSH_FP_BASE64,
|
2014-07-02 05:28:02 +00:00
|
|
|
SSH_FP_BUBBLEBABBLE,
|
|
|
|
SSH_FP_RANDOMART
|
|
|
|
};
|
|
|
|
|
2018-02-23 15:58:37 +00:00
|
|
|
/* Private key serialisation formats, used on the wire */
|
|
|
|
enum sshkey_serialize_rep {
|
|
|
|
SSHKEY_SERIALIZE_DEFAULT = 0,
|
2019-11-13 07:53:10 +00:00
|
|
|
SSHKEY_SERIALIZE_STATE = 1, /* only state is serialized */
|
|
|
|
SSHKEY_SERIALIZE_FULL = 2, /* include keys for saving to disk */
|
|
|
|
SSHKEY_SERIALIZE_SHIELD = 3, /* everything, for encrypting in ram */
|
|
|
|
SSHKEY_SERIALIZE_INFO = 254, /* minimal information */
|
2018-02-23 15:58:37 +00:00
|
|
|
};
|
|
|
|
|
2019-07-15 13:16:29 +00:00
|
|
|
/* Private key disk formats */
|
|
|
|
enum sshkey_private_format {
|
|
|
|
SSHKEY_PRIVATE_OPENSSH = 0,
|
|
|
|
SSHKEY_PRIVATE_PEM = 1,
|
|
|
|
SSHKEY_PRIVATE_PKCS8 = 2,
|
|
|
|
};
|
|
|
|
|
2014-07-02 05:28:02 +00:00
|
|
|
/* key is stored in external hardware */
|
|
|
|
#define SSHKEY_FLAG_EXT 0x0001
|
|
|
|
|
|
|
|
#define SSHKEY_CERT_MAX_PRINCIPALS 256
|
|
|
|
/* XXX opaquify? */
|
|
|
|
struct sshkey_cert {
|
|
|
|
struct sshbuf *certblob; /* Kept around for use on wire */
|
|
|
|
u_int type; /* SSH2_CERT_TYPE_USER or SSH2_CERT_TYPE_HOST */
|
|
|
|
u_int64_t serial;
|
|
|
|
char *key_id;
|
|
|
|
u_int nprincipals;
|
|
|
|
char **principals;
|
|
|
|
u_int64_t valid_after, valid_before;
|
|
|
|
struct sshbuf *critical;
|
|
|
|
struct sshbuf *extensions;
|
|
|
|
struct sshkey *signature_key;
|
2018-09-12 01:31:30 +00:00
|
|
|
char *signature_type;
|
2014-07-02 05:28:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* XXX opaquify? */
|
|
|
|
struct sshkey {
|
|
|
|
int type;
|
|
|
|
int flags;
|
2019-10-31 21:15:14 +00:00
|
|
|
/* KEY_RSA */
|
2014-07-02 05:28:02 +00:00
|
|
|
RSA *rsa;
|
2019-10-31 21:15:14 +00:00
|
|
|
/* KEY_DSA */
|
2014-07-02 05:28:02 +00:00
|
|
|
DSA *dsa;
|
2019-10-31 21:15:14 +00:00
|
|
|
/* KEY_ECDSA and KEY_ECDSA_SK */
|
2014-07-02 05:28:02 +00:00
|
|
|
int ecdsa_nid; /* NID of curve */
|
|
|
|
EC_KEY *ecdsa;
|
2019-11-12 19:33:08 +00:00
|
|
|
/* KEY_ED25519 and KEY_ED25519_SK */
|
2014-07-02 05:28:02 +00:00
|
|
|
u_char *ed25519_sk;
|
|
|
|
u_char *ed25519_pk;
|
2019-10-31 21:15:14 +00:00
|
|
|
/* KEY_XMSS */
|
2018-02-23 15:58:37 +00:00
|
|
|
char *xmss_name;
|
|
|
|
char *xmss_filename; /* for state file updates */
|
|
|
|
void *xmss_state; /* depends on xmss_name, opaque */
|
|
|
|
u_char *xmss_sk;
|
|
|
|
u_char *xmss_pk;
|
2019-11-12 19:33:08 +00:00
|
|
|
/* KEY_ECDSA_SK and KEY_ED25519_SK */
|
2019-10-31 21:15:14 +00:00
|
|
|
char *sk_application;
|
|
|
|
uint8_t sk_flags;
|
|
|
|
struct sshbuf *sk_key_handle;
|
|
|
|
struct sshbuf *sk_reserved;
|
|
|
|
/* Certificates */
|
2014-07-02 05:28:02 +00:00
|
|
|
struct sshkey_cert *cert;
|
2019-10-31 21:15:14 +00:00
|
|
|
/* Private key shielding */
|
2019-06-21 04:21:04 +00:00
|
|
|
u_char *shielded_private;
|
|
|
|
size_t shielded_len;
|
|
|
|
u_char *shield_prekey;
|
|
|
|
size_t shield_prekey_len;
|
2014-07-02 05:28:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define ED25519_SK_SZ crypto_sign_ed25519_SECRETKEYBYTES
|
|
|
|
#define ED25519_PK_SZ crypto_sign_ed25519_PUBLICKEYBYTES
|
|
|
|
|
2019-11-25 00:51:37 +00:00
|
|
|
/* Additional fields contained in signature */
|
|
|
|
struct sshkey_sig_details {
|
|
|
|
uint32_t sk_counter; /* U2F signature counter */
|
|
|
|
uint8_t sk_flags; /* U2F signature flags; see ssh-sk.h */
|
|
|
|
};
|
|
|
|
|
2022-10-28 00:35:40 +00:00
|
|
|
struct sshkey_impl_funcs {
|
|
|
|
u_int (*size)(const struct sshkey *); /* optional */
|
|
|
|
int (*alloc)(struct sshkey *); /* optional */
|
|
|
|
void (*cleanup)(struct sshkey *); /* optional */
|
2022-10-28 00:36:31 +00:00
|
|
|
int (*equal)(const struct sshkey *, const struct sshkey *);
|
2022-10-28 00:37:24 +00:00
|
|
|
int (*serialize_public)(const struct sshkey *, struct sshbuf *,
|
2022-10-28 00:41:52 +00:00
|
|
|
enum sshkey_serialize_rep);
|
|
|
|
int (*deserialize_public)(const char *, struct sshbuf *,
|
|
|
|
struct sshkey *);
|
2022-10-28 00:44:17 +00:00
|
|
|
int (*serialize_private)(const struct sshkey *, struct sshbuf *,
|
|
|
|
enum sshkey_serialize_rep);
|
2022-10-28 00:44:44 +00:00
|
|
|
int (*deserialize_private)(const char *, struct sshbuf *,
|
|
|
|
struct sshkey *);
|
2022-10-28 00:39:29 +00:00
|
|
|
int (*generate)(struct sshkey *, int); /* optional */
|
2022-10-28 00:41:17 +00:00
|
|
|
int (*copy_public)(const struct sshkey *, struct sshkey *);
|
2022-10-28 00:43:08 +00:00
|
|
|
int (*sign)(struct sshkey *, u_char **, size_t *,
|
|
|
|
const u_char *, size_t, const char *,
|
|
|
|
const char *, const char *, u_int); /* optional */
|
|
|
|
int (*verify)(const struct sshkey *, const u_char *, size_t,
|
|
|
|
const u_char *, size_t, const char *, u_int,
|
|
|
|
struct sshkey_sig_details **);
|
2022-10-28 00:35:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct sshkey_impl {
|
|
|
|
const char *name;
|
|
|
|
const char *shortname;
|
|
|
|
const char *sigalg;
|
|
|
|
int type;
|
|
|
|
int nid;
|
|
|
|
int cert;
|
|
|
|
int sigonly;
|
|
|
|
int keybits;
|
|
|
|
const struct sshkey_impl_funcs *funcs;
|
|
|
|
};
|
|
|
|
|
2014-07-02 05:28:02 +00:00
|
|
|
struct sshkey *sshkey_new(int);
|
|
|
|
void sshkey_free(struct sshkey *);
|
|
|
|
int sshkey_equal_public(const struct sshkey *,
|
|
|
|
const struct sshkey *);
|
|
|
|
int sshkey_equal(const struct sshkey *, const struct sshkey *);
|
|
|
|
char *sshkey_fingerprint(const struct sshkey *,
|
2014-12-21 22:27:55 +00:00
|
|
|
int, enum sshkey_fp_rep);
|
2014-07-02 05:28:02 +00:00
|
|
|
int sshkey_fingerprint_raw(const struct sshkey *k,
|
2014-12-21 22:27:55 +00:00
|
|
|
int, u_char **retp, size_t *lenp);
|
2014-07-02 05:28:02 +00:00
|
|
|
const char *sshkey_type(const struct sshkey *);
|
|
|
|
const char *sshkey_cert_type(const struct sshkey *);
|
2017-06-13 11:22:15 +00:00
|
|
|
int sshkey_format_text(const struct sshkey *, struct sshbuf *);
|
2014-07-02 05:28:02 +00:00
|
|
|
int sshkey_write(const struct sshkey *, FILE *);
|
|
|
|
int sshkey_read(struct sshkey *, char **);
|
|
|
|
u_int sshkey_size(const struct sshkey *);
|
|
|
|
|
|
|
|
int sshkey_generate(int type, u_int bits, struct sshkey **keyp);
|
|
|
|
int sshkey_from_private(const struct sshkey *, struct sshkey **);
|
2019-06-21 04:21:04 +00:00
|
|
|
|
|
|
|
int sshkey_is_shielded(struct sshkey *);
|
|
|
|
int sshkey_shield_private(struct sshkey *);
|
|
|
|
int sshkey_unshield_private(struct sshkey *);
|
|
|
|
|
2014-07-02 05:28:02 +00:00
|
|
|
int sshkey_type_from_name(const char *);
|
|
|
|
int sshkey_is_cert(const struct sshkey *);
|
2019-11-12 19:33:08 +00:00
|
|
|
int sshkey_is_sk(const struct sshkey *);
|
2014-07-02 05:28:02 +00:00
|
|
|
int sshkey_type_is_cert(int);
|
|
|
|
int sshkey_type_plain(int);
|
2022-01-06 22:05:42 +00:00
|
|
|
|
|
|
|
/* Returns non-zero if key name match sigalgs pattern list. (handles RSA) */
|
|
|
|
int sshkey_match_keyname_to_sigalgs(const char *, const char *);
|
|
|
|
|
2015-07-03 03:43:18 +00:00
|
|
|
int sshkey_to_certified(struct sshkey *);
|
2014-07-02 05:28:02 +00:00
|
|
|
int sshkey_drop_cert(struct sshkey *);
|
|
|
|
int sshkey_cert_copy(const struct sshkey *, struct sshkey *);
|
2021-01-26 00:49:30 +00:00
|
|
|
int sshkey_cert_check_authority(const struct sshkey *, int, int, int,
|
2021-07-23 03:37:52 +00:00
|
|
|
uint64_t, const char *, const char **);
|
|
|
|
int sshkey_cert_check_authority_now(const struct sshkey *, int, int, int,
|
2014-07-02 05:28:02 +00:00
|
|
|
const char *, const char **);
|
2021-01-26 00:49:30 +00:00
|
|
|
int sshkey_cert_check_host(const struct sshkey *, const char *,
|
|
|
|
int , const char *, const char **);
|
2015-11-19 01:08:55 +00:00
|
|
|
size_t sshkey_format_cert_validity(const struct sshkey_cert *,
|
|
|
|
char *, size_t) __attribute__((__bounded__(__string__, 2, 3)));
|
2018-09-12 01:32:54 +00:00
|
|
|
int sshkey_check_cert_sigtype(const struct sshkey *, const char *);
|
2014-07-02 05:28:02 +00:00
|
|
|
|
2019-10-31 21:23:19 +00:00
|
|
|
int sshkey_certify(struct sshkey *, struct sshkey *,
|
2020-08-27 01:06:18 +00:00
|
|
|
const char *, const char *, const char *);
|
2017-06-28 01:09:22 +00:00
|
|
|
/* Variant allowing use of a custom signature function (e.g. for ssh-agent) */
|
2019-06-21 04:21:04 +00:00
|
|
|
typedef int sshkey_certify_signer(struct sshkey *, u_char **, size_t *,
|
2020-08-27 01:06:18 +00:00
|
|
|
const u_char *, size_t, const char *, const char *, const char *,
|
|
|
|
u_int, void *);
|
2017-06-28 01:09:22 +00:00
|
|
|
int sshkey_certify_custom(struct sshkey *, struct sshkey *, const char *,
|
2020-08-27 01:06:18 +00:00
|
|
|
const char *, const char *, sshkey_certify_signer *, void *);
|
2017-06-28 01:09:22 +00:00
|
|
|
|
2014-07-02 05:28:02 +00:00
|
|
|
int sshkey_ecdsa_nid_from_name(const char *);
|
|
|
|
int sshkey_curve_name_to_nid(const char *);
|
|
|
|
const char * sshkey_curve_nid_to_name(int);
|
|
|
|
u_int sshkey_curve_nid_to_bits(int);
|
|
|
|
int sshkey_ecdsa_bits_to_nid(int);
|
|
|
|
int sshkey_ecdsa_key_to_nid(EC_KEY *);
|
|
|
|
int sshkey_ec_nid_to_hash_alg(int nid);
|
|
|
|
int sshkey_ec_validate_public(const EC_GROUP *, const EC_POINT *);
|
|
|
|
int sshkey_ec_validate_private(const EC_KEY *);
|
|
|
|
const char *sshkey_ssh_name(const struct sshkey *);
|
|
|
|
const char *sshkey_ssh_name_plain(const struct sshkey *);
|
2015-01-13 07:39:19 +00:00
|
|
|
int sshkey_names_valid2(const char *, int);
|
2017-03-10 04:07:20 +00:00
|
|
|
char *sshkey_alg_list(int, int, int, char);
|
2014-07-02 05:28:02 +00:00
|
|
|
|
|
|
|
int sshkey_from_blob(const u_char *, size_t, struct sshkey **);
|
2015-01-26 02:59:11 +00:00
|
|
|
int sshkey_fromb(struct sshbuf *, struct sshkey **);
|
|
|
|
int sshkey_froms(struct sshbuf *, struct sshkey **);
|
2014-07-02 05:28:02 +00:00
|
|
|
int sshkey_to_blob(const struct sshkey *, u_char **, size_t *);
|
2015-05-21 04:55:51 +00:00
|
|
|
int sshkey_to_base64(const struct sshkey *, char **);
|
2015-01-26 02:59:11 +00:00
|
|
|
int sshkey_putb(const struct sshkey *, struct sshbuf *);
|
|
|
|
int sshkey_puts(const struct sshkey *, struct sshbuf *);
|
2018-02-23 15:58:37 +00:00
|
|
|
int sshkey_puts_opts(const struct sshkey *, struct sshbuf *,
|
|
|
|
enum sshkey_serialize_rep);
|
2014-07-02 05:28:02 +00:00
|
|
|
int sshkey_plain_to_blob(const struct sshkey *, u_char **, size_t *);
|
2015-01-26 02:59:11 +00:00
|
|
|
int sshkey_putb_plain(const struct sshkey *, struct sshbuf *);
|
2014-07-02 05:28:02 +00:00
|
|
|
|
2019-06-21 04:21:04 +00:00
|
|
|
int sshkey_sign(struct sshkey *, u_char **, size_t *,
|
2020-08-27 01:06:18 +00:00
|
|
|
const u_char *, size_t, const char *, const char *, const char *, u_int);
|
2014-07-02 05:28:02 +00:00
|
|
|
int sshkey_verify(const struct sshkey *, const u_char *, size_t,
|
2019-11-25 00:51:37 +00:00
|
|
|
const u_char *, size_t, const char *, u_int, struct sshkey_sig_details **);
|
2018-07-03 11:39:54 +00:00
|
|
|
int sshkey_check_sigtype(const u_char *, size_t, const char *);
|
2018-07-03 13:20:25 +00:00
|
|
|
const char *sshkey_sigalg_by_name(const char *);
|
2019-09-03 08:31:20 +00:00
|
|
|
int sshkey_get_sigtype(const u_char *, size_t, char **);
|
2014-07-02 05:28:02 +00:00
|
|
|
|
|
|
|
/* for debug */
|
|
|
|
void sshkey_dump_ec_point(const EC_GROUP *, const EC_POINT *);
|
|
|
|
void sshkey_dump_ec_key(const EC_KEY *);
|
|
|
|
|
|
|
|
/* private key parsing and serialisation */
|
2019-06-21 04:21:04 +00:00
|
|
|
int sshkey_private_serialize(struct sshkey *key, struct sshbuf *buf);
|
|
|
|
int sshkey_private_serialize_opt(struct sshkey *key, struct sshbuf *buf,
|
2018-02-23 15:58:37 +00:00
|
|
|
enum sshkey_serialize_rep);
|
2014-07-02 05:28:02 +00:00
|
|
|
int sshkey_private_deserialize(struct sshbuf *buf, struct sshkey **keyp);
|
|
|
|
|
|
|
|
/* private key file format parsing and serialisation */
|
|
|
|
int sshkey_private_to_fileblob(struct sshkey *key, struct sshbuf *blob,
|
|
|
|
const char *passphrase, const char *comment,
|
2019-07-15 13:16:29 +00:00
|
|
|
int format, const char *openssh_format_cipher, int openssh_format_rounds);
|
2014-07-02 05:28:02 +00:00
|
|
|
int sshkey_parse_private_fileblob(struct sshbuf *buffer,
|
2015-09-13 14:39:16 +00:00
|
|
|
const char *passphrase, struct sshkey **keyp, char **commentp);
|
2014-07-02 05:28:02 +00:00
|
|
|
int sshkey_parse_private_fileblob_type(struct sshbuf *blob, int type,
|
|
|
|
const char *passphrase, struct sshkey **keyp, char **commentp);
|
2020-04-08 00:08:46 +00:00
|
|
|
int sshkey_parse_pubkey_from_private_fileblob_type(struct sshbuf *blob,
|
|
|
|
int type, struct sshkey **pubkeyp);
|
2014-07-02 05:28:02 +00:00
|
|
|
|
2022-09-17 10:30:45 +00:00
|
|
|
int sshkey_check_rsa_length(const struct sshkey *, int);
|
2017-07-01 13:50:45 +00:00
|
|
|
/* XXX should be internal, but used by ssh-keygen */
|
2018-09-13 02:08:33 +00:00
|
|
|
int ssh_rsa_complete_crt_parameters(struct sshkey *, const BIGNUM *);
|
2017-07-01 13:50:45 +00:00
|
|
|
|
2018-02-23 15:58:37 +00:00
|
|
|
/* stateful keys (e.g. XMSS) */
|
|
|
|
int sshkey_set_filename(struct sshkey *, const char *);
|
|
|
|
int sshkey_enable_maxsign(struct sshkey *, u_int32_t);
|
|
|
|
u_int32_t sshkey_signatures_left(const struct sshkey *);
|
2020-10-19 22:49:23 +00:00
|
|
|
int sshkey_forward_state(const struct sshkey *, u_int32_t, int);
|
|
|
|
int sshkey_private_serialize_maxsign(struct sshkey *key,
|
|
|
|
struct sshbuf *buf, u_int32_t maxsign, int);
|
2018-02-23 15:58:37 +00:00
|
|
|
|
2019-11-25 00:51:37 +00:00
|
|
|
void sshkey_sig_details_free(struct sshkey_sig_details *);
|
|
|
|
|
2014-07-02 05:28:02 +00:00
|
|
|
#ifdef SSHKEY_INTERNAL
|
2022-10-28 00:36:31 +00:00
|
|
|
int sshkey_sk_fields_equal(const struct sshkey *a, const struct sshkey *b);
|
|
|
|
void sshkey_sk_cleanup(struct sshkey *k);
|
2022-10-28 00:37:24 +00:00
|
|
|
int sshkey_serialize_sk(const struct sshkey *key, struct sshbuf *b);
|
2022-10-28 00:41:17 +00:00
|
|
|
int sshkey_copy_public_sk(const struct sshkey *from, struct sshkey *to);
|
2022-10-28 00:41:52 +00:00
|
|
|
int sshkey_deserialize_sk(struct sshbuf *b, struct sshkey *key);
|
2022-10-28 00:44:17 +00:00
|
|
|
int sshkey_serialize_private_sk(const struct sshkey *key,
|
|
|
|
struct sshbuf *buf);
|
2022-10-28 00:44:44 +00:00
|
|
|
int sshkey_private_deserialize_sk(struct sshbuf *buf, struct sshkey *k);
|
2022-10-28 00:41:52 +00:00
|
|
|
#ifdef WITH_OPENSSL
|
|
|
|
int check_rsa_length(const RSA *rsa); /* XXX remove */
|
|
|
|
#endif
|
2014-07-02 05:28:02 +00:00
|
|
|
#endif
|
|
|
|
|
2014-08-20 01:06:50 +00:00
|
|
|
#if !defined(WITH_OPENSSL)
|
|
|
|
# undef RSA
|
|
|
|
# undef DSA
|
|
|
|
# undef EC_KEY
|
|
|
|
# undef EC_GROUP
|
|
|
|
# undef EC_POINT
|
|
|
|
#elif !defined(OPENSSL_HAS_ECC)
|
|
|
|
# undef EC_KEY
|
|
|
|
# undef EC_GROUP
|
|
|
|
# undef EC_POINT
|
|
|
|
#endif
|
2014-07-02 05:28:02 +00:00
|
|
|
|
|
|
|
#endif /* SSHKEY_H */
|