Coverage Report

Created: 2022-07-22 12:05

/libfido2/src/fido/param.h
Line
Count
Source
1
/*
2
 * Copyright (c) 2018-2022 Yubico AB. All rights reserved.
3
 * Use of this source code is governed by a BSD-style
4
 * license that can be found in the LICENSE file.
5
 */
6
7
#ifndef _FIDO_PARAM_H
8
#define _FIDO_PARAM_H
9
10
/* Authentication data flags. */
11
479
#define CTAP_AUTHDATA_USER_PRESENT      0x01
12
73
#define CTAP_AUTHDATA_USER_VERIFIED     0x04
13
880
#define CTAP_AUTHDATA_ATT_CRED          0x40
14
2.09k
#define CTAP_AUTHDATA_EXT_DATA          0x80
15
16
/* CTAPHID command opcodes. */
17
#define CTAP_CMD_PING                   0x01
18
7.29k
#define CTAP_CMD_MSG                    0x03
19
#define CTAP_CMD_LOCK                   0x04
20
80.2k
#define CTAP_CMD_INIT                   0x06
21
1.73k
#define CTAP_CMD_WINK                   0x08
22
46.7k
#define CTAP_CMD_CBOR                   0x10
23
1.38k
#define CTAP_CMD_CANCEL                 0x11
24
42.1k
#define CTAP_KEEPALIVE                  0x3b
25
185k
#define CTAP_FRAME_INIT                 0x80
26
27
/* CTAPHID CBOR command opcodes. */
28
764
#define CTAP_CBOR_MAKECRED              0x01
29
484
#define CTAP_CBOR_ASSERT                0x02
30
13.8k
#define CTAP_CBOR_GETINFO               0x04
31
3.89k
#define CTAP_CBOR_CLIENT_PIN            0x06
32
228
#define CTAP_CBOR_RESET                 0x07
33
242
#define CTAP_CBOR_NEXT_ASSERT           0x08
34
812
#define CTAP_CBOR_LARGEBLOB             0x0c
35
3.85k
#define CTAP_CBOR_CONFIG                0x0d
36
1.93k
#define CTAP_CBOR_BIO_ENROLL_PRE        0x40
37
2.41k
#define CTAP_CBOR_CRED_MGMT_PRE         0x41
38
39
/* Supported CTAP PIN/UV Auth Protocols. */
40
11.2k
#define CTAP_PIN_PROTOCOL1              1
41
5.19k
#define CTAP_PIN_PROTOCOL2              2
42
43
/* U2F command opcodes. */
44
1.64k
#define U2F_CMD_REGISTER                0x01
45
1.12k
#define U2F_CMD_AUTH                    0x02
46
47
/* U2F command flags. */
48
193
#define U2F_AUTH_SIGN                   0x03
49
935
#define U2F_AUTH_CHECK                  0x07
50
51
/* ISO7816-4 status words. */
52
478
#define SW1_MORE_DATA                   0x61
53
1.08k
#define SW_CONDITIONS_NOT_SATISFIED     0x6985
54
13
#define SW_WRONG_DATA                   0x6a80
55
1.26k
#define SW_NO_ERROR                     0x9000
56
57
/* HID Broadcast channel ID. */
58
1.00M
#define CTAP_CID_BROADCAST              0xffffffff
59
60
475k
#define CTAP_INIT_HEADER_LEN            7
61
172k
#define CTAP_CONT_HEADER_LEN            5
62
63
/* Maximum length of a CTAP HID report in bytes. */
64
231k
#define CTAP_MAX_REPORT_LEN             64
65
66
/* Minimum length of a CTAP HID report in bytes. */
67
308k
#define CTAP_MIN_REPORT_LEN             (CTAP_INIT_HEADER_LEN + 1)
68
69
/* Randomness device on UNIX-like platforms. */
70
#ifndef FIDO_RANDOM_DEV
71
#define FIDO_RANDOM_DEV                 "/dev/urandom"
72
#endif
73
74
/* Maximum message size in bytes. */
75
#ifndef FIDO_MAXMSG
76
83.9k
#define FIDO_MAXMSG     2048
77
#endif
78
79
/* CTAP capability bits. */
80
1.41k
#define FIDO_CAP_WINK   0x01 /* if set, device supports CTAP_CMD_WINK */
81
64.0k
#define FIDO_CAP_CBOR   0x04 /* if set, device supports CTAP_CMD_CBOR */
82
661
#define FIDO_CAP_NMSG   0x08 /* if set, device doesn't support CTAP_CMD_MSG */
83
84
/* Supported COSE algorithms. */
85
98
#define COSE_UNSPEC     0
86
10.7k
#define COSE_ES256      -7
87
1.87k
#define COSE_EDDSA      -8
88
1.16k
#define COSE_ECDH_ES256 -25
89
5.88k
#define COSE_ES384      -35
90
6.09k
#define COSE_RS256      -257
91
163
#define COSE_RS1        -65535
92
93
/* Supported COSE types. */
94
392
#define COSE_KTY_OKP    1
95
960
#define COSE_KTY_EC2    2
96
166
#define COSE_KTY_RSA    3
97
98
/* Supported curves. */
99
465
#define COSE_P256       1
100
12
#define COSE_P384       2
101
195
#define COSE_ED25519    6
102
103
/* Supported extensions. */
104
39.2k
#define FIDO_EXT_HMAC_SECRET    0x01
105
7.27k
#define FIDO_EXT_CRED_PROTECT   0x02
106
39.0k
#define FIDO_EXT_LARGEBLOB_KEY  0x04
107
38.9k
#define FIDO_EXT_CRED_BLOB      0x08
108
6.02k
#define FIDO_EXT_MINPINLEN      0x10
109
110
/* Supported credential protection policies. */
111
2.85k
#define FIDO_CRED_PROT_UV_OPTIONAL              0x01
112
2.33k
#define FIDO_CRED_PROT_UV_OPTIONAL_WITH_ID      0x02
113
592
#define FIDO_CRED_PROT_UV_REQUIRED              0x03
114
115
#ifdef _FIDO_INTERNAL
116
34.2k
#define FIDO_EXT_ASSERT_MASK    (FIDO_EXT_HMAC_SECRET|FIDO_EXT_LARGEBLOB_KEY| \
117
34.2k
                                 FIDO_EXT_CRED_BLOB)
118
2.70k
#define FIDO_EXT_CRED_MASK      (FIDO_EXT_HMAC_SECRET|FIDO_EXT_CRED_PROTECT| \
119
2.70k
                                 FIDO_EXT_LARGEBLOB_KEY|FIDO_EXT_CRED_BLOB| \
120
2.70k
                                 FIDO_EXT_MINPINLEN)
121
#endif /* _FIDO_INTERNAL */
122
123
/* Recognised UV modes. */
124
#define FIDO_UV_MODE_TUP        0x0001  /* internal test of user presence */
125
#define FIDO_UV_MODE_FP         0x0002  /* internal fingerprint check */
126
#define FIDO_UV_MODE_PIN        0x0004  /* internal pin check */
127
#define FIDO_UV_MODE_VOICE      0x0008  /* internal voice recognition */
128
#define FIDO_UV_MODE_FACE       0x0010  /* internal face recognition */
129
#define FIDO_UV_MODE_LOCATION   0x0020  /* internal location check */
130
#define FIDO_UV_MODE_EYE        0x0040  /* internal eyeprint check */
131
#define FIDO_UV_MODE_DRAWN      0x0080  /* internal drawn pattern check */
132
#define FIDO_UV_MODE_HAND       0x0100  /* internal handprint verification */
133
#define FIDO_UV_MODE_NONE       0x0200  /* TUP/UV not required */
134
#define FIDO_UV_MODE_ALL        0x0400  /* all supported UV modes required */
135
#define FIDO_UV_MODE_EXT_PIN    0x0800  /* external pin verification */
136
#define FIDO_UV_MODE_EXT_DRAWN  0x1000  /* external drawn pattern check */
137
138
#endif /* !_FIDO_PARAM_H */