libssh  0.11.0
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
91 uint8_t flags;
92
99 uint8_t *public_key;
100
106
113 uint8_t *key_handle;
114
120
127 uint8_t *signature;
128
134
142
145
152 uint8_t *authdata;
153
159};
160
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
210 uint32_t alg;
211
218 size_t slot;
219
227
234
241 uint8_t flags;
242
248 uint8_t *user_id;
249
255};
256
263struct 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 */
Response structure for FIDO2/U2F key enrollment operations.
Definition sk_api.h:84
uint8_t * attestation_cert
X.509 attestation certificate.
Definition sk_api.h:141
size_t public_key_len
Length of public_key buffer in bytes.
Definition sk_api.h:105
size_t attestation_cert_len
Length of attestation_cert buffer in bytes.
Definition sk_api.h:144
uint8_t * key_handle
Opaque credential handle/ID used to identify this key.
Definition sk_api.h:113
uint8_t * public_key
Public key data in standard format.
Definition sk_api.h:99
uint8_t flags
FIDO2/U2F authenticator flags from the enrollment operation.
Definition sk_api.h:91
uint8_t * signature
Enrollment signature over the enrollment data.
Definition sk_api.h:127
size_t authdata_len
Length of authdata buffer in bytes.
Definition sk_api.h:158
size_t signature_len
Length of signature buffer in bytes.
Definition sk_api.h:133
uint8_t * authdata
FIDO2/U2F authenticator data from enrollment.
Definition sk_api.h:152
size_t key_handle_len
Length of key_handle buffer in bytes.
Definition sk_api.h:119
Configuration option structure for FIDO2/U2F operations.
Definition sk_api.h:263
char * value
Option value as bytes.
Definition sk_api.h:268
uint8_t required
Indicates if this option is required for the operation.
Definition sk_api.h:276
char * name
Option name/key identifier.
Definition sk_api.h:265
Structure representing a resident/discoverable credential.
Definition sk_api.h:204
uint32_t alg
Cryptographic algorithm identifier for this key.
Definition sk_api.h:210
uint8_t flags
Flags associated with this resident key.
Definition sk_api.h:241
size_t user_id_len
Length of user_id buffer in bytes.
Definition sk_api.h:254
char * application
Relying Party (application) identifier string.
Definition sk_api.h:226
size_t slot
Slot/index number of this key on the authenticator.
Definition sk_api.h:218
struct sk_enroll_response key
Embedded enrollment response containing key material.
Definition sk_api.h:233
uint8_t * user_id
User identifier associated with this resident key.
Definition sk_api.h:248
Response structure for FIDO2/U2F key signing operations.
Definition sk_api.h:167
size_t sig_r_len
Length of sig_r buffer in bytes.
Definition sk_api.h:188
uint8_t flags
FIDO2/U2F authenticator flags from the signing operation.
Definition sk_api.h:174
uint32_t counter
Authenticator signature counter value.
Definition sk_api.h:182
size_t sig_s_len
Length of sig_s buffer in bytes.
Definition sk_api.h:194
uint8_t * sig_r
R component of ECDSA signature or Ed25519 signature.
Definition sk_api.h:185
uint8_t * sig_s
S component of ECDSA signature.
Definition sk_api.h:191