diff options
author | djm@openbsd.org <djm@openbsd.org> | 2019-11-25 00:51:37 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2019-11-25 12:23:33 +1100 |
commit | b7e74ea072919b31391bc0f5ff653f80b9f5e84f (patch) | |
tree | adb2a736c1b9f6346d342600877818631f9dbb3d /sshkey.h | |
parent | d2b0f88178ec9e3f11b606bf1004ac2fe541a2c3 (diff) |
upstream: Add new structure for signature options
This is populated during signature verification with additional fields
that are present in and covered by the signature. At the moment, it is
only used to record security key-specific options, especially the flags
field.
with and ok markus@
OpenBSD-Commit-ID: 338a1f0e04904008836130bedb9ece4faafd4e49
Diffstat (limited to 'sshkey.h')
-rw-r--r-- | sshkey.h | 18 |
1 files changed, 14 insertions, 4 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sshkey.h,v 1.39 2019/11/13 07:53:10 markus Exp $ */ | 1 | /* $OpenBSD: sshkey.h,v 1.40 2019/11/25 00:51:37 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. |
@@ -156,6 +156,12 @@ struct sshkey { | |||
156 | #define ED25519_SK_SZ crypto_sign_ed25519_SECRETKEYBYTES | 156 | #define ED25519_SK_SZ crypto_sign_ed25519_SECRETKEYBYTES |
157 | #define ED25519_PK_SZ crypto_sign_ed25519_PUBLICKEYBYTES | 157 | #define ED25519_PK_SZ crypto_sign_ed25519_PUBLICKEYBYTES |
158 | 158 | ||
159 | /* Additional fields contained in signature */ | ||
160 | struct sshkey_sig_details { | ||
161 | uint32_t sk_counter; /* U2F signature counter */ | ||
162 | uint8_t sk_flags; /* U2F signature flags; see ssh-sk.h */ | ||
163 | }; | ||
164 | |||
159 | struct sshkey *sshkey_new(int); | 165 | struct sshkey *sshkey_new(int); |
160 | void sshkey_free(struct sshkey *); | 166 | void sshkey_free(struct sshkey *); |
161 | int sshkey_equal_public(const struct sshkey *, | 167 | int sshkey_equal_public(const struct sshkey *, |
@@ -230,7 +236,7 @@ int sshkey_putb_plain(const struct sshkey *, struct sshbuf *); | |||
230 | int sshkey_sign(struct sshkey *, u_char **, size_t *, | 236 | int sshkey_sign(struct sshkey *, u_char **, size_t *, |
231 | const u_char *, size_t, const char *, const char *, u_int); | 237 | const u_char *, size_t, const char *, const char *, u_int); |
232 | int sshkey_verify(const struct sshkey *, const u_char *, size_t, | 238 | int sshkey_verify(const struct sshkey *, const u_char *, size_t, |
233 | const u_char *, size_t, const char *, u_int); | 239 | const u_char *, size_t, const char *, u_int, struct sshkey_sig_details **); |
234 | int sshkey_check_sigtype(const u_char *, size_t, const char *); | 240 | int sshkey_check_sigtype(const u_char *, size_t, const char *); |
235 | const char *sshkey_sigalg_by_name(const char *); | 241 | const char *sshkey_sigalg_by_name(const char *); |
236 | int sshkey_get_sigtype(const u_char *, size_t, char **); | 242 | int sshkey_get_sigtype(const u_char *, size_t, char **); |
@@ -270,6 +276,8 @@ int sshkey_forward_state(const struct sshkey *, u_int32_t, sshkey_printfn *); | |||
270 | int sshkey_private_serialize_maxsign(struct sshkey *key, struct sshbuf *buf, | 276 | int sshkey_private_serialize_maxsign(struct sshkey *key, struct sshbuf *buf, |
271 | u_int32_t maxsign, sshkey_printfn *pr); | 277 | u_int32_t maxsign, sshkey_printfn *pr); |
272 | 278 | ||
279 | void sshkey_sig_details_free(struct sshkey_sig_details *); | ||
280 | |||
273 | #ifdef SSHKEY_INTERNAL | 281 | #ifdef SSHKEY_INTERNAL |
274 | int ssh_rsa_sign(const struct sshkey *key, | 282 | int ssh_rsa_sign(const struct sshkey *key, |
275 | u_char **sigp, size_t *lenp, const u_char *data, size_t datalen, | 283 | u_char **sigp, size_t *lenp, const u_char *data, size_t datalen, |
@@ -289,7 +297,8 @@ int ssh_ecdsa_verify(const struct sshkey *key, | |||
289 | const u_char *data, size_t datalen, u_int compat); | 297 | const u_char *data, size_t datalen, u_int compat); |
290 | int ssh_ecdsa_sk_verify(const struct sshkey *key, | 298 | int ssh_ecdsa_sk_verify(const struct sshkey *key, |
291 | const u_char *signature, size_t signaturelen, | 299 | const u_char *signature, size_t signaturelen, |
292 | const u_char *data, size_t datalen, u_int compat); | 300 | const u_char *data, size_t datalen, u_int compat, |
301 | struct sshkey_sig_details **detailsp); | ||
293 | int ssh_ed25519_sign(const struct sshkey *key, u_char **sigp, size_t *lenp, | 302 | int ssh_ed25519_sign(const struct sshkey *key, u_char **sigp, size_t *lenp, |
294 | const u_char *data, size_t datalen, u_int compat); | 303 | const u_char *data, size_t datalen, u_int compat); |
295 | int ssh_ed25519_verify(const struct sshkey *key, | 304 | int ssh_ed25519_verify(const struct sshkey *key, |
@@ -297,7 +306,8 @@ int ssh_ed25519_verify(const struct sshkey *key, | |||
297 | const u_char *data, size_t datalen, u_int compat); | 306 | const u_char *data, size_t datalen, u_int compat); |
298 | int ssh_ed25519_sk_verify(const struct sshkey *key, | 307 | int ssh_ed25519_sk_verify(const struct sshkey *key, |
299 | const u_char *signature, size_t signaturelen, | 308 | const u_char *signature, size_t signaturelen, |
300 | const u_char *data, size_t datalen, u_int compat); | 309 | const u_char *data, size_t datalen, u_int compat, |
310 | struct sshkey_sig_details **detailsp); | ||
301 | int ssh_xmss_sign(const struct sshkey *key, u_char **sigp, size_t *lenp, | 311 | int ssh_xmss_sign(const struct sshkey *key, u_char **sigp, size_t *lenp, |
302 | const u_char *data, size_t datalen, u_int compat); | 312 | const u_char *data, size_t datalen, u_int compat); |
303 | int ssh_xmss_verify(const struct sshkey *key, | 313 | int ssh_xmss_verify(const struct sshkey *key, |