libssh 0.12.1 The SSH library

Loading...
Searching...
No Matches
sk_api.h
1/*
2 * Copyright (c) 2019 Google LLC
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17/*
18 * This file is a copy of the OpenSSH project's sk-api.h file pulled from
19 * https://github.com/openssh/openssh-portable/commit/a9cbe10da2be5be76755af0cea029db0f9c1f263
20 * with only the flags, algorithms, error codes, and struct definitions. The
21 * function declarations and other OpenSSH-specific code have been removed.
22 */
23
24#ifndef SK_API_H
25#define SK_API_H 1
26
27#include <stddef.h>
28#include <stdint.h>
29
30/* FIDO2/U2F Operation Flags */
31
33#ifndef SSH_SK_USER_PRESENCE_REQD
34#define SSH_SK_USER_PRESENCE_REQD 0x01
35#endif
36
38#ifndef SSH_SK_USER_VERIFICATION_REQD
39#define SSH_SK_USER_VERIFICATION_REQD 0x04
40#endif
41
44#ifndef SSH_SK_FORCE_OPERATION
45#define SSH_SK_FORCE_OPERATION 0x10
46#endif
47
49#ifndef SSH_SK_RESIDENT_KEY
50#define SSH_SK_RESIDENT_KEY 0x20
51#endif
52
53/* Algorithms */
54
56#define SSH_SK_ECDSA 0x00
57
59#define SSH_SK_ED25519 0x01
60
61/* Error codes */
62
64#define SSH_SK_ERR_GENERAL -1
65
67#define SSH_SK_ERR_UNSUPPORTED -2
68
70#define SSH_SK_ERR_PIN_REQUIRED -3
71
73#define SSH_SK_ERR_DEVICE_NOT_FOUND -4
74
76#define SSH_SK_ERR_CREDENTIAL_EXISTS -5
77
84 struct sk_enroll_response {
91 uint8_t flags;
92
99 uint8_t *public_key;
100
105 size_t public_key_len;
106
113 uint8_t *key_handle;
114
119 size_t key_handle_len;
120
127 uint8_t *signature;
128
133 size_t signature_len;
134
141 uint8_t *attestation_cert;
142
144 size_t attestation_cert_len;
145
152 uint8_t *authdata;
153
158 size_t authdata_len;
159};
160
167 struct sk_sign_response {
174 uint8_t flags;
175
182 uint32_t counter;
183
185 uint8_t *sig_r;
186
188 size_t sig_r_len;
189
191 uint8_t *sig_s;
192
194 size_t sig_s_len;
195};
196
204 struct sk_resident_key {
210 uint32_t alg;
211
218 size_t slot;
219
226 char *application;
227
233 struct sk_enroll_response key;
234
241 uint8_t flags;
242
248 uint8_t *user_id;
249
254 size_t user_id_len;
255};
256
263 struct sk_option {
265 char *name;
266
268 char *value;
269
276 uint8_t required;
277};
278
280#define SSH_SK_VERSION_MAJOR 0x000a0000
281#define SSH_SK_VERSION_MAJOR_MASK 0xffff0000
282
283#endif /* SK_API_H */
sk_enroll_response
Response structure for FIDO2/U2F key enrollment operations.
Definition sk_api.h:84
sk_enroll_response::attestation_cert
uint8_t * attestation_cert
X.509 attestation certificate.
Definition sk_api.h:141
sk_enroll_response::public_key_len
size_t public_key_len
Length of public_key buffer in bytes.
Definition sk_api.h:105
sk_enroll_response::attestation_cert_len
size_t attestation_cert_len
Length of attestation_cert buffer in bytes.
Definition sk_api.h:144
sk_enroll_response::key_handle
uint8_t * key_handle
Opaque credential handle/ID used to identify this key.
Definition sk_api.h:113
sk_enroll_response::public_key
uint8_t * public_key
Public key data in standard format.
Definition sk_api.h:99
sk_enroll_response::flags
uint8_t flags
FIDO2/U2F authenticator flags from the enrollment operation.
Definition sk_api.h:91
sk_enroll_response::signature
uint8_t * signature
Enrollment signature over the enrollment data.
Definition sk_api.h:127
sk_enroll_response::authdata_len
size_t authdata_len
Length of authdata buffer in bytes.
Definition sk_api.h:158
sk_enroll_response::signature_len
size_t signature_len
Length of signature buffer in bytes.
Definition sk_api.h:133
sk_enroll_response::authdata
uint8_t * authdata
FIDO2/U2F authenticator data from enrollment.
Definition sk_api.h:152
sk_enroll_response::key_handle_len
size_t key_handle_len
Length of key_handle buffer in bytes.
Definition sk_api.h:119
sk_option
Configuration option structure for FIDO2/U2F operations.
Definition sk_api.h:263
sk_option::value
char * value
Option value as bytes.
Definition sk_api.h:268
sk_option::required
uint8_t required
Indicates if this option is required for the operation.
Definition sk_api.h:276
sk_option::name
char * name
Option name/key identifier.
Definition sk_api.h:265
sk_resident_key
Structure representing a resident/discoverable credential.
Definition sk_api.h:204
sk_resident_key::alg
uint32_t alg
Cryptographic algorithm identifier for this key.
Definition sk_api.h:210
sk_resident_key::flags
uint8_t flags
Flags associated with this resident key.
Definition sk_api.h:241
sk_resident_key::user_id_len
size_t user_id_len
Length of user_id buffer in bytes.
Definition sk_api.h:254
sk_resident_key::application
char * application
Relying Party (application) identifier string.
Definition sk_api.h:226
sk_resident_key::slot
size_t slot
Slot/index number of this key on the authenticator.
Definition sk_api.h:218
sk_resident_key::key
struct sk_enroll_response key
Embedded enrollment response containing key material.
Definition sk_api.h:233
sk_resident_key::user_id
uint8_t * user_id
User identifier associated with this resident key.
Definition sk_api.h:248
sk_sign_response
Response structure for FIDO2/U2F key signing operations.
Definition sk_api.h:167
sk_sign_response::sig_r_len
size_t sig_r_len
Length of sig_r buffer in bytes.
Definition sk_api.h:188
sk_sign_response::flags
uint8_t flags
FIDO2/U2F authenticator flags from the signing operation.
Definition sk_api.h:174
sk_sign_response::counter
uint32_t counter
Authenticator signature counter value.
Definition sk_api.h:182
sk_sign_response::sig_s_len
size_t sig_s_len
Length of sig_s buffer in bytes.
Definition sk_api.h:194
sk_sign_response::sig_r
uint8_t * sig_r
R component of ECDSA signature or Ed25519 signature.
Definition sk_api.h:185
sk_sign_response::sig_s
uint8_t * sig_s
S component of ECDSA signature.
Definition sk_api.h:191