summaryrefslogtreecommitdiff
path: root/sshkey.h
diff options
context:
space:
mode:
Diffstat (limited to 'sshkey.h')
-rw-r--r--sshkey.h31
1 files changed, 24 insertions, 7 deletions
diff --git a/sshkey.h b/sshkey.h
index c11106c93..1bf30d055 100644
--- a/sshkey.h
+++ b/sshkey.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshkey.h,v 1.31 2019/01/20 22:51:37 djm Exp $ */ 1/* $OpenBSD: sshkey.h,v 1.34 2019/09/03 08:31:20 djm Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. 4 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
@@ -89,6 +89,13 @@ enum sshkey_serialize_rep {
89 SSHKEY_SERIALIZE_INFO = 254, 89 SSHKEY_SERIALIZE_INFO = 254,
90}; 90};
91 91
92/* Private key disk formats */
93enum sshkey_private_format {
94 SSHKEY_PRIVATE_OPENSSH = 0,
95 SSHKEY_PRIVATE_PEM = 1,
96 SSHKEY_PRIVATE_PKCS8 = 2,
97};
98
92/* key is stored in external hardware */ 99/* key is stored in external hardware */
93#define SSHKEY_FLAG_EXT 0x0001 100#define SSHKEY_FLAG_EXT 0x0001
94 101
@@ -124,6 +131,10 @@ struct sshkey {
124 u_char *xmss_sk; 131 u_char *xmss_sk;
125 u_char *xmss_pk; 132 u_char *xmss_pk;
126 struct sshkey_cert *cert; 133 struct sshkey_cert *cert;
134 u_char *shielded_private;
135 size_t shielded_len;
136 u_char *shield_prekey;
137 size_t shield_prekey_len;
127}; 138};
128 139
129#define ED25519_SK_SZ crypto_sign_ed25519_SECRETKEYBYTES 140#define ED25519_SK_SZ crypto_sign_ed25519_SECRETKEYBYTES
@@ -147,6 +158,11 @@ u_int sshkey_size(const struct sshkey *);
147 158
148int sshkey_generate(int type, u_int bits, struct sshkey **keyp); 159int sshkey_generate(int type, u_int bits, struct sshkey **keyp);
149int sshkey_from_private(const struct sshkey *, struct sshkey **); 160int sshkey_from_private(const struct sshkey *, struct sshkey **);
161
162int sshkey_is_shielded(struct sshkey *);
163int sshkey_shield_private(struct sshkey *);
164int sshkey_unshield_private(struct sshkey *);
165
150int sshkey_type_from_name(const char *); 166int sshkey_type_from_name(const char *);
151int sshkey_is_cert(const struct sshkey *); 167int sshkey_is_cert(const struct sshkey *);
152int sshkey_type_is_cert(int); 168int sshkey_type_is_cert(int);
@@ -162,7 +178,7 @@ int sshkey_check_cert_sigtype(const struct sshkey *, const char *);
162 178
163int sshkey_certify(struct sshkey *, struct sshkey *, const char *); 179int sshkey_certify(struct sshkey *, struct sshkey *, const char *);
164/* Variant allowing use of a custom signature function (e.g. for ssh-agent) */ 180/* Variant allowing use of a custom signature function (e.g. for ssh-agent) */
165typedef int sshkey_certify_signer(const struct sshkey *, u_char **, size_t *, 181typedef int sshkey_certify_signer(struct sshkey *, u_char **, size_t *,
166 const u_char *, size_t, const char *, u_int, void *); 182 const u_char *, size_t, const char *, u_int, void *);
167int sshkey_certify_custom(struct sshkey *, struct sshkey *, const char *, 183int sshkey_certify_custom(struct sshkey *, struct sshkey *, const char *,
168 sshkey_certify_signer *, void *); 184 sshkey_certify_signer *, void *);
@@ -193,27 +209,28 @@ int sshkey_puts_opts(const struct sshkey *, struct sshbuf *,
193int sshkey_plain_to_blob(const struct sshkey *, u_char **, size_t *); 209int sshkey_plain_to_blob(const struct sshkey *, u_char **, size_t *);
194int sshkey_putb_plain(const struct sshkey *, struct sshbuf *); 210int sshkey_putb_plain(const struct sshkey *, struct sshbuf *);
195 211
196int sshkey_sign(const struct sshkey *, u_char **, size_t *, 212int sshkey_sign(struct sshkey *, u_char **, size_t *,
197 const u_char *, size_t, const char *, u_int); 213 const u_char *, size_t, const char *, u_int);
198int sshkey_verify(const struct sshkey *, const u_char *, size_t, 214int sshkey_verify(const struct sshkey *, const u_char *, size_t,
199 const u_char *, size_t, const char *, u_int); 215 const u_char *, size_t, const char *, u_int);
200int sshkey_check_sigtype(const u_char *, size_t, const char *); 216int sshkey_check_sigtype(const u_char *, size_t, const char *);
201const char *sshkey_sigalg_by_name(const char *); 217const char *sshkey_sigalg_by_name(const char *);
218int sshkey_get_sigtype(const u_char *, size_t, char **);
202 219
203/* for debug */ 220/* for debug */
204void sshkey_dump_ec_point(const EC_GROUP *, const EC_POINT *); 221void sshkey_dump_ec_point(const EC_GROUP *, const EC_POINT *);
205void sshkey_dump_ec_key(const EC_KEY *); 222void sshkey_dump_ec_key(const EC_KEY *);
206 223
207/* private key parsing and serialisation */ 224/* private key parsing and serialisation */
208int sshkey_private_serialize(const struct sshkey *key, struct sshbuf *buf); 225int sshkey_private_serialize(struct sshkey *key, struct sshbuf *buf);
209int sshkey_private_serialize_opt(const struct sshkey *key, struct sshbuf *buf, 226int sshkey_private_serialize_opt(struct sshkey *key, struct sshbuf *buf,
210 enum sshkey_serialize_rep); 227 enum sshkey_serialize_rep);
211int sshkey_private_deserialize(struct sshbuf *buf, struct sshkey **keyp); 228int sshkey_private_deserialize(struct sshbuf *buf, struct sshkey **keyp);
212 229
213/* private key file format parsing and serialisation */ 230/* private key file format parsing and serialisation */
214int sshkey_private_to_fileblob(struct sshkey *key, struct sshbuf *blob, 231int sshkey_private_to_fileblob(struct sshkey *key, struct sshbuf *blob,
215 const char *passphrase, const char *comment, 232 const char *passphrase, const char *comment,
216 int force_new_format, const char *new_format_cipher, int new_format_rounds); 233 int format, const char *openssh_format_cipher, int openssh_format_rounds);
217int sshkey_parse_private_fileblob(struct sshbuf *buffer, 234int sshkey_parse_private_fileblob(struct sshbuf *buffer,
218 const char *passphrase, struct sshkey **keyp, char **commentp); 235 const char *passphrase, struct sshkey **keyp, char **commentp);
219int sshkey_parse_private_fileblob_type(struct sshbuf *blob, int type, 236int sshkey_parse_private_fileblob_type(struct sshbuf *blob, int type,
@@ -232,7 +249,7 @@ int sshkey_set_filename(struct sshkey *, const char *);
232int sshkey_enable_maxsign(struct sshkey *, u_int32_t); 249int sshkey_enable_maxsign(struct sshkey *, u_int32_t);
233u_int32_t sshkey_signatures_left(const struct sshkey *); 250u_int32_t sshkey_signatures_left(const struct sshkey *);
234int sshkey_forward_state(const struct sshkey *, u_int32_t, sshkey_printfn *); 251int sshkey_forward_state(const struct sshkey *, u_int32_t, sshkey_printfn *);
235int sshkey_private_serialize_maxsign(const struct sshkey *key, struct sshbuf *buf, 252int sshkey_private_serialize_maxsign(struct sshkey *key, struct sshbuf *buf,
236 u_int32_t maxsign, sshkey_printfn *pr); 253 u_int32_t maxsign, sshkey_printfn *pr);
237 254
238#ifdef SSHKEY_INTERNAL 255#ifdef SSHKEY_INTERNAL