summaryrefslogtreecommitdiff
path: root/sshkey.h
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2019-11-25 00:51:37 +0000
committerDamien Miller <djm@mindrot.org>2019-11-25 12:23:33 +1100
commitb7e74ea072919b31391bc0f5ff653f80b9f5e84f (patch)
treeadb2a736c1b9f6346d342600877818631f9dbb3d /sshkey.h
parentd2b0f88178ec9e3f11b606bf1004ac2fe541a2c3 (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.h18
1 files changed, 14 insertions, 4 deletions
diff --git a/sshkey.h b/sshkey.h
index a34a4cb48..56c0a9cdf 100644
--- a/sshkey.h
+++ b/sshkey.h
@@ -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 */
160struct 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
159struct sshkey *sshkey_new(int); 165struct sshkey *sshkey_new(int);
160void sshkey_free(struct sshkey *); 166void sshkey_free(struct sshkey *);
161int sshkey_equal_public(const struct sshkey *, 167int sshkey_equal_public(const struct sshkey *,
@@ -230,7 +236,7 @@ int sshkey_putb_plain(const struct sshkey *, struct sshbuf *);
230int sshkey_sign(struct sshkey *, u_char **, size_t *, 236int 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);
232int sshkey_verify(const struct sshkey *, const u_char *, size_t, 238int 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 **);
234int sshkey_check_sigtype(const u_char *, size_t, const char *); 240int sshkey_check_sigtype(const u_char *, size_t, const char *);
235const char *sshkey_sigalg_by_name(const char *); 241const char *sshkey_sigalg_by_name(const char *);
236int sshkey_get_sigtype(const u_char *, size_t, char **); 242int 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 *);
270int sshkey_private_serialize_maxsign(struct sshkey *key, struct sshbuf *buf, 276int 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
279void sshkey_sig_details_free(struct sshkey_sig_details *);
280
273#ifdef SSHKEY_INTERNAL 281#ifdef SSHKEY_INTERNAL
274int ssh_rsa_sign(const struct sshkey *key, 282int 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);
290int ssh_ecdsa_sk_verify(const struct sshkey *key, 298int 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);
293int ssh_ed25519_sign(const struct sshkey *key, u_char **sigp, size_t *lenp, 302int 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);
295int ssh_ed25519_verify(const struct sshkey *key, 304int 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);
298int ssh_ed25519_sk_verify(const struct sshkey *key, 307int 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);
301int ssh_xmss_sign(const struct sshkey *key, u_char **sigp, size_t *lenp, 311int 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);
303int ssh_xmss_verify(const struct sshkey *key, 313int ssh_xmss_verify(const struct sshkey *key,