Annotation of src/usr.bin/ssh/ssh-sk.h, Revision 1.8
1.8 ! djm 1: /* $OpenBSD: ssh-sk.h,v 1.7 2019/12/30 09:21:16 djm Exp $ */
1.1 djm 2: /*
3: * Copyright (c) 2019 Google LLC
4: *
5: * Permission to use, copy, modify, and distribute this software for any
6: * purpose with or without fee is hereby granted, provided that the above
7: * copyright notice and this permission notice appear in all copies.
8: *
9: * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10: * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11: * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12: * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13: * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14: * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15: * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16: */
17:
18: #ifndef _SSH_SK_H
19: #define _SSH_SK_H 1
20:
21: struct sshbuf;
22: struct sshkey;
1.2 djm 23:
1.8 ! djm 24: /* Version of protocol expected from ssh-sk-helper */
! 25: #define SSH_SK_HELPER_VERSION 3
! 26:
! 27: /* ssh-sk-helper messages */
! 28: #define SSH_SK_HELPER_ERROR 0 /* Only valid H->C */
! 29: #define SSH_SK_HELPER_SIGN 1
! 30: #define SSH_SK_HELPER_ENROLL 2
! 31: #define SSH_SK_HELPER_LOAD_RESIDENT 3
! 32:
1.1 djm 33: /*
1.5 markus 34: * Enroll (generate) a new security-key hosted private key of given type
35: * via the specified provider middleware.
1.1 djm 36: * If challenge_buf is NULL then a random 256 bit challenge will be used.
37: *
38: * Returns 0 on success or a ssherr.h error code on failure.
39: *
40: * If successful and the attest_data buffer is not NULL then attestation
41: * information is placed there.
42: */
1.5 markus 43: int sshsk_enroll(int type, const char *provider_path, const char *application,
1.8 ! djm 44: uint8_t flags, const char *pin, struct sshbuf *challenge_buf,
! 45: struct sshkey **keyp, struct sshbuf *attest);
1.1 djm 46:
47: /*
1.4 markus 48: * Calculate an ECDSA_SK or ED25519_SK signature using the specified key
1.3 markus 49: * and provider middleware.
1.1 djm 50: *
51: * Returns 0 on success or a ssherr.h error code on failure.
52: */
1.6 djm 53: int sshsk_sign(const char *provider_path, struct sshkey *key,
1.1 djm 54: u_char **sigp, size_t *lenp, const u_char *data, size_t datalen,
1.8 ! djm 55: u_int compat, const char *pin);
1.7 djm 56:
57: /*
58: * Enumerates and loads all SSH-compatible resident keys from a security
59: * key.
60: *
61: * Returns 0 on success or a ssherr.h error code on failure.
62: */
63: int sshsk_load_resident(const char *provider_path, const char *pin,
64: struct sshkey ***keysp, size_t *nkeysp);
1.1 djm 65:
66: #endif /* _SSH_SK_H */
67: