summaryrefslogtreecommitdiff
path: root/fuzz/fuzz_cred.c
diff options
context:
space:
mode:
Diffstat (limited to 'fuzz/fuzz_cred.c')
-rw-r--r--fuzz/fuzz_cred.c925
1 files changed, 925 insertions, 0 deletions
diff --git a/fuzz/fuzz_cred.c b/fuzz/fuzz_cred.c
new file mode 100644
index 0000000..7bd1d3c
--- /dev/null
+++ b/fuzz/fuzz_cred.c
@@ -0,0 +1,925 @@
1/*
2 * Copyright (c) 2019 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#include <assert.h>
8#include <stdint.h>
9#include <stdlib.h>
10#include <string.h>
11#include <stdio.h>
12
13#include "mutator_aux.h"
14#include "fido.h"
15
16#include "../openbsd-compat/openbsd-compat.h"
17
18#define TAG_U2F 0x01
19#define TAG_TYPE 0x02
20#define TAG_CDH 0x03
21#define TAG_RP_ID 0x04
22#define TAG_RP_NAME 0x05
23#define TAG_USER_ID 0x06
24#define TAG_USER_NAME 0x07
25#define TAG_USER_NICK 0x08
26#define TAG_USER_ICON 0x09
27#define TAG_EXT 0x0a
28#define TAG_SEED 0x0b
29#define TAG_RK 0x0c
30#define TAG_UV 0x0d
31#define TAG_PIN 0x0e
32#define TAG_WIRE_DATA 0x0f
33#define TAG_EXCL_COUNT 0x10
34#define TAG_EXCL_CRED 0x11
35
36/* Parameter set defining a FIDO2 make credential operation. */
37struct param {
38 char pin[MAXSTR];
39 char rp_id[MAXSTR];
40 char rp_name[MAXSTR];
41 char user_icon[MAXSTR];
42 char user_name[MAXSTR];
43 char user_nick[MAXSTR];
44 int ext;
45 int seed;
46 struct blob cdh;
47 struct blob excl_cred;
48 struct blob user_id;
49 struct blob wire_data;
50 uint8_t excl_count;
51 uint8_t rk;
52 uint8_t type;
53 uint8_t u2f;
54 uint8_t uv;
55};
56
57/* Example parameters. */
58static const char dummy_rp_id[] = "localhost";
59static const char dummy_rp_name[] = "sweet home localhost";
60static const char dummy_pin[] = "9}4gT:8d=A37Dh}U";
61static const char dummy_user_icon[] = "an icon";
62static const char dummy_user_name[] = "john smith";
63static const char dummy_user_nick[] = "jsmith";
64
65static const uint8_t dummy_cdh[] = {
66 0xf9, 0x64, 0x57, 0xe7, 0x2d, 0x97, 0xf6, 0xbb,
67 0xdd, 0xd7, 0xfb, 0x06, 0x37, 0x62, 0xea, 0x26,
68 0x20, 0x44, 0x8e, 0x69, 0x7c, 0x03, 0xf2, 0x31,
69 0x2f, 0x99, 0xdc, 0xaf, 0x3e, 0x8a, 0x91, 0x6b,
70};
71
72static const uint8_t dummy_user_id[] = {
73 0x78, 0x1c, 0x78, 0x60, 0xad, 0x88, 0xd2, 0x63,
74 0x32, 0x62, 0x2a, 0xf1, 0x74, 0x5d, 0xed, 0xb2,
75 0xe7, 0xa4, 0x2b, 0x44, 0x89, 0x29, 0x39, 0xc5,
76 0x56, 0x64, 0x01, 0x27, 0x0d, 0xbb, 0xc4, 0x49,
77};
78
79/*
80 * Collection of HID reports from an authenticator issued with a FIDO2
81 * make credential using the example parameters above.
82 */
83static const uint8_t dummy_wire_data_fido[] = {
84 0xff, 0xff, 0xff, 0xff, 0x86, 0x00, 0x11, 0xb0,
85 0x84, 0xeb, 0xec, 0x4d, 0x97, 0x72, 0x09, 0x00,
86 0x91, 0x00, 0x03, 0x02, 0x05, 0x00, 0x02, 0x05,
87 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
88 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
89 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
90 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
91 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
92 0x00, 0x91, 0x00, 0x03, 0x90, 0x00, 0x51, 0x00,
93 0xa1, 0x01, 0xa5, 0x01, 0x02, 0x03, 0x38, 0x18,
94 0x20, 0x01, 0x21, 0x58, 0x20, 0x69, 0xf2, 0x7d,
95 0x37, 0x57, 0xda, 0x11, 0xba, 0x42, 0xde, 0x79,
96 0xe4, 0xab, 0x8d, 0x73, 0x63, 0xee, 0x66, 0x9e,
97 0x8a, 0x70, 0xa9, 0xb5, 0xf6, 0x38, 0x4f, 0x5b,
98 0xdf, 0xe1, 0xa0, 0xa4, 0xff, 0x22, 0x58, 0x20,
99 0x8a, 0xcb, 0x23, 0x2e, 0x93, 0xdb, 0xe0, 0xa4,
100 0x00, 0x91, 0x00, 0x03, 0x00, 0xbb, 0xb5, 0x60,
101 0x19, 0x18, 0x8b, 0x4d, 0xb8, 0x88, 0x6e, 0x13,
102 0x75, 0xac, 0x00, 0x19, 0x27, 0x80, 0xcc, 0x63,
103 0xc4, 0xbf, 0xfe, 0x4b, 0x4a, 0x00, 0x00, 0x00,
104 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
105 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
106 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
107 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
108 0x00, 0x91, 0x00, 0x03, 0x90, 0x00, 0x14, 0x00,
109 0xa1, 0x02, 0x50, 0x10, 0x89, 0x77, 0x43, 0x3a,
110 0x58, 0xa2, 0xc9, 0x98, 0x18, 0x1a, 0xb1, 0xcc,
111 0x09, 0x6b, 0xd0, 0x00, 0x00, 0x00, 0x00, 0x00,
112 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
113 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
114 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
115 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
116 0x00, 0x91, 0x00, 0x03, 0xbb, 0x00, 0x01, 0x02,
117 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
118 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
119 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
120 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
121 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
122 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
123 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
124 0x00, 0x91, 0x00, 0x03, 0xbb, 0x00, 0x01, 0x02,
125 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
126 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
127 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
128 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
129 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
130 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
131 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
132 0x00, 0x91, 0x00, 0x03, 0xbb, 0x00, 0x01, 0x02,
133 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
134 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
135 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
136 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
137 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
138 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
139 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
140 0x00, 0x91, 0x00, 0x03, 0xbb, 0x00, 0x01, 0x02,
141 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
142 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
143 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
144 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
145 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
146 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
147 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
148 0x00, 0x91, 0x00, 0x03, 0xbb, 0x00, 0x01, 0x02,
149 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
150 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
151 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
152 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
153 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
154 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
155 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
156 0x00, 0x91, 0x00, 0x03, 0xbb, 0x00, 0x01, 0x02,
157 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
158 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
159 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
160 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
161 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
162 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
163 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
164 0x00, 0x91, 0x00, 0x03, 0xbb, 0x00, 0x01, 0x02,
165 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
166 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
167 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
168 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
169 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
170 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
171 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
172 0x00, 0x91, 0x00, 0x03, 0xbb, 0x00, 0x01, 0x02,
173 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
174 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
175 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
176 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
177 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
178 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
179 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
180 0x00, 0x91, 0x00, 0x03, 0xbb, 0x00, 0x01, 0x02,
181 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
182 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
183 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
185 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
186 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
187 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
188 0x00, 0x91, 0x00, 0x03, 0xbb, 0x00, 0x01, 0x02,
189 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
190 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
191 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
192 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
193 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
194 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
195 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
196 0x00, 0x91, 0x00, 0x03, 0x90, 0x03, 0xe1, 0x00,
197 0xa3, 0x01, 0x66, 0x70, 0x61, 0x63, 0x6b, 0x65,
198 0x64, 0x02, 0x58, 0xc4, 0x49, 0x96, 0x0d, 0xe5,
199 0x88, 0x0e, 0x8c, 0x68, 0x74, 0x34, 0x17, 0x0f,
200 0x64, 0x76, 0x60, 0x5b, 0x8f, 0xe4, 0xae, 0xb9,
201 0xa2, 0x86, 0x32, 0xc7, 0x99, 0x5c, 0xf3, 0xba,
202 0x83, 0x1d, 0x97, 0x63, 0x45, 0x00, 0x00, 0x00,
203 0x00, 0xf8, 0xa0, 0x11, 0xf3, 0x8c, 0x0a, 0x4d,
204 0x00, 0x91, 0x00, 0x03, 0x00, 0x15, 0x80, 0x06,
205 0x17, 0x11, 0x1f, 0x9e, 0xdc, 0x7d, 0x00, 0x40,
206 0xed, 0x88, 0x48, 0xa1, 0xdb, 0x56, 0x4d, 0x0f,
207 0x0d, 0xc8, 0x8f, 0x0f, 0xe9, 0x16, 0xb1, 0x78,
208 0xa9, 0x40, 0x98, 0x71, 0xa0, 0xb3, 0xf2, 0xcf,
209 0x05, 0x73, 0x6c, 0x12, 0xbf, 0x00, 0x96, 0xf3,
210 0x7b, 0x93, 0xba, 0x49, 0xee, 0x23, 0xb4, 0x78,
211 0x2e, 0xfb, 0xce, 0x27, 0xa8, 0xc2, 0x26, 0x78,
212 0x00, 0x91, 0x00, 0x03, 0x01, 0xcc, 0x95, 0x2d,
213 0x40, 0xdb, 0xd1, 0x40, 0x3d, 0x2b, 0xa3, 0x31,
214 0xa0, 0x75, 0x82, 0x63, 0xf0, 0xa5, 0x01, 0x02,
215 0x03, 0x26, 0x20, 0x01, 0x21, 0x58, 0x20, 0x9d,
216 0x95, 0xa1, 0xb5, 0xd6, 0x11, 0xbf, 0xe2, 0x28,
217 0xa0, 0x7f, 0xca, 0x1e, 0xd9, 0x09, 0x0f, 0x0d,
218 0xe7, 0x8e, 0x29, 0xe8, 0x2e, 0x11, 0xdb, 0x55,
219 0x62, 0x13, 0xd7, 0x26, 0xc2, 0x7e, 0x2b, 0x22,
220 0x00, 0x91, 0x00, 0x03, 0x02, 0x58, 0x20, 0xbe,
221 0x74, 0x2a, 0xac, 0xde, 0x11, 0x40, 0x76, 0x31,
222 0x0b, 0xed, 0x55, 0xde, 0xf3, 0x03, 0xe4, 0x1c,
223 0xac, 0x42, 0x63, 0x8f, 0xe8, 0x30, 0x63, 0xb7,
224 0x07, 0x4e, 0x5d, 0xfb, 0x17, 0x5e, 0x9b, 0x03,
225 0xa3, 0x63, 0x61, 0x6c, 0x67, 0x26, 0x63, 0x73,
226 0x69, 0x67, 0x58, 0x48, 0x30, 0x46, 0x02, 0x21,
227 0x00, 0xfb, 0xd1, 0x26, 0x76, 0x34, 0x74, 0xac,
228 0x00, 0x91, 0x00, 0x03, 0x03, 0xf6, 0xd8, 0x5c,
229 0x5d, 0xbc, 0xda, 0xe0, 0x43, 0xe0, 0xa5, 0x42,
230 0x9f, 0xc7, 0xe2, 0x18, 0x3e, 0xe2, 0x2c, 0x94,
231 0x78, 0xbf, 0x9c, 0xeb, 0x3e, 0x9d, 0x02, 0x21,
232 0x00, 0xab, 0x21, 0x1b, 0xc4, 0x30, 0x69, 0xee,
233 0x7f, 0x09, 0xe6, 0x6b, 0x99, 0x98, 0x34, 0x07,
234 0x7b, 0x9a, 0x58, 0xb2, 0xe8, 0x77, 0xe0, 0xba,
235 0x7d, 0xab, 0x65, 0xf8, 0xba, 0x2a, 0xcb, 0x9a,
236 0x00, 0x91, 0x00, 0x03, 0x04, 0x41, 0x63, 0x78,
237 0x35, 0x63, 0x81, 0x59, 0x02, 0xb3, 0x30, 0x82,
238 0x02, 0xaf, 0x30, 0x82, 0x01, 0x97, 0xa0, 0x03,
239 0x02, 0x01, 0x02, 0x02, 0x04, 0x48, 0x5b, 0x3d,
240 0xb6, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48,
241 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00,
242 0x30, 0x21, 0x31, 0x1f, 0x30, 0x1d, 0x06, 0x03,
243 0x55, 0x04, 0x03, 0x0c, 0x16, 0x59, 0x75, 0x62,
244 0x00, 0x91, 0x00, 0x03, 0x05, 0x69, 0x63, 0x6f,
245 0x20, 0x46, 0x49, 0x44, 0x4f, 0x20, 0x50, 0x72,
246 0x65, 0x76, 0x69, 0x65, 0x77, 0x20, 0x43, 0x41,
247 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x38, 0x30, 0x34,
248 0x31, 0x32, 0x31, 0x30, 0x35, 0x37, 0x31, 0x30,
249 0x5a, 0x17, 0x0d, 0x31, 0x38, 0x31, 0x32, 0x33,
250 0x31, 0x31, 0x30, 0x35, 0x37, 0x31, 0x30, 0x5a,
251 0x30, 0x6f, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03,
252 0x00, 0x91, 0x00, 0x03, 0x06, 0x55, 0x04, 0x06,
253 0x13, 0x02, 0x53, 0x45, 0x31, 0x12, 0x30, 0x10,
254 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x09, 0x59,
255 0x75, 0x62, 0x69, 0x63, 0x6f, 0x20, 0x41, 0x42,
256 0x31, 0x22, 0x30, 0x20, 0x06, 0x03, 0x55, 0x04,
257 0x0b, 0x0c, 0x19, 0x41, 0x75, 0x74, 0x68, 0x65,
258 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72,
259 0x20, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61,
260 0x00, 0x91, 0x00, 0x03, 0x07, 0x74, 0x69, 0x6f,
261 0x6e, 0x31, 0x28, 0x30, 0x26, 0x06, 0x03, 0x55,
262 0x04, 0x03, 0x0c, 0x1f, 0x59, 0x75, 0x62, 0x69,
263 0x63, 0x6f, 0x20, 0x55, 0x32, 0x46, 0x20, 0x45,
264 0x45, 0x20, 0x53, 0x65, 0x72, 0x69, 0x61, 0x6c,
265 0x20, 0x31, 0x32, 0x31, 0x33, 0x39, 0x33, 0x39,
266 0x31, 0x32, 0x36, 0x30, 0x59, 0x30, 0x13, 0x06,
267 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01,
268 0x00, 0x91, 0x00, 0x03, 0x08, 0x06, 0x08, 0x2a,
269 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03,
270 0x42, 0x00, 0x04, 0xfb, 0x2c, 0xdd, 0x30, 0x43,
271 0x28, 0xc5, 0x72, 0x4a, 0x50, 0xcc, 0xe6, 0xf6,
272 0x0b, 0xad, 0x7d, 0x27, 0xa9, 0x1b, 0x59, 0xe1,
273 0xe6, 0x6f, 0x29, 0x7b, 0x89, 0xc9, 0xd4, 0x3d,
274 0xc2, 0xb2, 0xc7, 0x78, 0x89, 0xb4, 0xf0, 0xff,
275 0x9d, 0x02, 0x28, 0xcb, 0x94, 0x6d, 0xfc, 0xe0,
276 0x00, 0x91, 0x00, 0x03, 0x09, 0x1b, 0x19, 0x58,
277 0x9b, 0x67, 0x80, 0x4a, 0xac, 0x97, 0x7f, 0x28,
278 0x18, 0x9c, 0xcd, 0xb3, 0x25, 0x74, 0xca, 0x28,
279 0xa3, 0x6c, 0x30, 0x6a, 0x30, 0x22, 0x06, 0x09,
280 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xc4, 0x0a,
281 0x02, 0x04, 0x15, 0x31, 0x2e, 0x33, 0x2e, 0x36,
282 0x2e, 0x31, 0x2e, 0x34, 0x2e, 0x31, 0x2e, 0x34,
283 0x31, 0x34, 0x38, 0x32, 0x2e, 0x31, 0x2e, 0x36,
284 0x00, 0x91, 0x00, 0x03, 0x0a, 0x30, 0x13, 0x06,
285 0x0b, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xe5,
286 0x1c, 0x02, 0x01, 0x01, 0x04, 0x04, 0x03, 0x02,
287 0x04, 0x30, 0x30, 0x21, 0x06, 0x0b, 0x2b, 0x06,
288 0x01, 0x04, 0x01, 0x82, 0xe5, 0x1c, 0x01, 0x01,
289 0x04, 0x04, 0x12, 0x04, 0x10, 0xf8, 0xa0, 0x11,
290 0xf3, 0x8c, 0x0a, 0x4d, 0x15, 0x80, 0x06, 0x17,
291 0x11, 0x1f, 0x9e, 0xdc, 0x7d, 0x30, 0x0c, 0x06,
292 0x00, 0x91, 0x00, 0x03, 0x0b, 0x03, 0x55, 0x1d,
293 0x13, 0x01, 0x01, 0xff, 0x04, 0x02, 0x30, 0x00,
294 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,
295 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x03,
296 0x82, 0x01, 0x01, 0x00, 0x32, 0xf3, 0xe4, 0xbd,
297 0x58, 0xd7, 0x42, 0x2b, 0xaf, 0x49, 0x99, 0x86,
298 0x08, 0x1f, 0x0d, 0xa9, 0x3b, 0xc6, 0xaa, 0x1c,
299 0x72, 0x11, 0xf9, 0x28, 0x53, 0xeb, 0xf3, 0xeb,
300 0x00, 0x91, 0x00, 0x03, 0x0c, 0x73, 0xda, 0x69,
301 0x3b, 0x06, 0xde, 0x31, 0x33, 0x8e, 0x5d, 0x02,
302 0xec, 0xf6, 0x76, 0xe9, 0x5c, 0x42, 0xbe, 0xa5,
303 0x8f, 0x25, 0xd3, 0x37, 0x3f, 0x77, 0xbb, 0x2a,
304 0x9d, 0x7c, 0xb2, 0x3e, 0x11, 0x8c, 0x41, 0xd4,
305 0x9a, 0x4c, 0x9a, 0xd8, 0xf3, 0xe2, 0xa4, 0xec,
306 0x01, 0x77, 0x7a, 0x74, 0xa8, 0xc4, 0x12, 0x43,
307 0xc3, 0x1e, 0xce, 0x20, 0x8f, 0x2d, 0x0f, 0x6e,
308 0x00, 0x91, 0x00, 0x03, 0x0d, 0xbc, 0x61, 0x9b,
309 0xe1, 0x84, 0xa1, 0x72, 0xf6, 0xa9, 0xac, 0xcb,
310 0xf8, 0x73, 0x6d, 0x5b, 0xe2, 0x98, 0xb3, 0x6b,
311 0xec, 0xe7, 0x1e, 0x77, 0x8d, 0x0a, 0x69, 0xaa,
312 0xf9, 0x94, 0xb8, 0x63, 0x6d, 0xe8, 0xfa, 0xf6,
313 0x2f, 0xd3, 0xce, 0x7f, 0x04, 0x4c, 0x32, 0x2c,
314 0xf7, 0x26, 0x3e, 0x34, 0x99, 0xe6, 0xa5, 0xb2,
315 0xb0, 0x2a, 0xbb, 0xad, 0x5b, 0xd9, 0xec, 0xe5,
316 0x00, 0x91, 0x00, 0x03, 0x0e, 0xb0, 0x71, 0x4d,
317 0x73, 0xbb, 0x94, 0x61, 0x49, 0x9c, 0x94, 0x2a,
318 0x5f, 0x1d, 0xcc, 0xaf, 0x65, 0x03, 0x3b, 0x39,
319 0x39, 0xd4, 0x47, 0xd9, 0xfc, 0xc4, 0x7b, 0x0b,
320 0x16, 0xd8, 0xe9, 0x01, 0xfc, 0xec, 0x3f, 0x8c,
321 0x1b, 0xc0, 0xc6, 0xac, 0x0b, 0x5d, 0x74, 0xc7,
322 0xbb, 0x03, 0x05, 0x69, 0x17, 0xe9, 0x98, 0x1a,
323 0x19, 0xb9, 0x09, 0x5c, 0xa1, 0xf4, 0xab, 0x9f,
324 0x00, 0x91, 0x00, 0x03, 0x0f, 0x02, 0x7c, 0x28,
325 0x0f, 0x8a, 0xf9, 0xed, 0x1d, 0x29, 0x3c, 0xf6,
326 0xcc, 0x2f, 0x04, 0x6d, 0x9a, 0xd6, 0x62, 0xb4,
327 0xa9, 0x6e, 0xb1, 0xca, 0xca, 0xac, 0x5e, 0x05,
328 0x3e, 0x83, 0x91, 0x47, 0x7c, 0x1f, 0x8b, 0x60,
329 0x01, 0xde, 0x65, 0x3a, 0xbf, 0xf2, 0xaa, 0xbb,
330 0x55, 0x98, 0x86, 0x91, 0x7e, 0xad, 0x3b, 0x36,
331 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
332};
333
334/*
335 * Collection of HID reports from an authenticator issued with a U2F
336 * registration using the example parameters above.
337 */
338static const uint8_t dummy_wire_data_u2f[] = {
339 0xff, 0xff, 0xff, 0xff, 0x86, 0x00, 0x11, 0x8e,
340 0x80, 0xd0, 0xe2, 0x3b, 0x24, 0x93, 0xea, 0x00,
341 0x00, 0x99, 0x01, 0x02, 0x01, 0x01, 0x00, 0x01,
342 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
343 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
344 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
345 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
346 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
347 0x00, 0x00, 0x99, 0x01, 0x83, 0x00, 0x02, 0x69,
348 0x85, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
349 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
350 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
351 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
352 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
353 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
354 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
355 0x00, 0x00, 0x99, 0x01, 0x83, 0x00, 0x02, 0x69,
356 0x85, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
357 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
358 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
359 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
360 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
361 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
362 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
363 0x00, 0x00, 0x99, 0x01, 0x83, 0x00, 0x02, 0x69,
364 0x85, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
365 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
366 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
367 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
368 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
369 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
370 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
371 0x00, 0x00, 0x99, 0x01, 0x83, 0x00, 0x02, 0x69,
372 0x85, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
373 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
374 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
375 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
376 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
377 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
378 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
379 0x00, 0x00, 0x99, 0x01, 0x83, 0x00, 0x02, 0x69,
380 0x85, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
381 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
382 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
383 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
384 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
385 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
386 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
387 0x00, 0x00, 0x99, 0x01, 0x83, 0x00, 0x02, 0x69,
388 0x85, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
389 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
390 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
391 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
392 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
393 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
394 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
395 0x00, 0x00, 0x99, 0x01, 0x83, 0x00, 0x02, 0x69,
396 0x85, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
397 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
398 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
399 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
400 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
401 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
402 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
403 0x00, 0x00, 0x99, 0x01, 0x83, 0x00, 0x02, 0x69,
404 0x85, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
405 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
406 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
407 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
408 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
409 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
410 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
411 0x00, 0x00, 0x99, 0x01, 0x83, 0x00, 0x02, 0x69,
412 0x85, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
413 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
414 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
415 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
416 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
417 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
418 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
419 0x00, 0x00, 0x99, 0x01, 0x83, 0x00, 0x02, 0x69,
420 0x85, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
421 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
422 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
423 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
424 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
425 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
426 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
427 0x00, 0x00, 0x99, 0x01, 0x83, 0x00, 0x02, 0x69,
428 0x85, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
429 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
430 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
431 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
432 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
433 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
434 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
435 0x00, 0x00, 0x99, 0x01, 0x83, 0x00, 0x02, 0x69,
436 0x85, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
437 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
438 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
439 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
440 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
441 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
442 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
443 0x00, 0x00, 0x99, 0x01, 0x83, 0x00, 0x02, 0x69,
444 0x85, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
445 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
446 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
447 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
448 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
449 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
450 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
451 0x00, 0x00, 0x99, 0x01, 0x83, 0x00, 0x02, 0x69,
452 0x85, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
453 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
454 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
455 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
456 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
457 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
458 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
459 0x00, 0x00, 0x99, 0x01, 0x83, 0x00, 0x02, 0x69,
460 0x85, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
461 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
462 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
463 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
464 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
465 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
466 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
467 0x00, 0x00, 0x99, 0x01, 0x83, 0x00, 0x02, 0x69,
468 0x85, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
469 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
470 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
471 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
472 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
473 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
474 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
475 0x00, 0x00, 0x99, 0x01, 0x83, 0x00, 0x02, 0x69,
476 0x85, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
477 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
478 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
479 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
480 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
481 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
482 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
483 0x00, 0x00, 0x99, 0x01, 0x83, 0x00, 0x02, 0x69,
484 0x85, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
485 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
486 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
487 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
488 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
489 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
490 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
491 0x00, 0x00, 0x99, 0x01, 0x83, 0x00, 0x02, 0x69,
492 0x85, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
493 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
494 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
495 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
496 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
497 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
498 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
499 0x00, 0x00, 0x99, 0x01, 0x83, 0x00, 0x02, 0x69,
500 0x85, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
501 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
502 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
503 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
504 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
505 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
506 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
507 0x00, 0x00, 0x99, 0x01, 0x83, 0x00, 0x02, 0x69,
508 0x85, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
509 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
510 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
511 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
512 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
513 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
514 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
515 0x00, 0x00, 0x99, 0x01, 0x83, 0x03, 0x1e, 0x05,
516 0x04, 0x9f, 0xa0, 0xf9, 0x0d, 0x4c, 0xf4, 0xae,
517 0x96, 0x3c, 0xb7, 0x46, 0xb7, 0x5c, 0x9d, 0x8b,
518 0x48, 0x19, 0xdf, 0xc4, 0xad, 0xea, 0xb2, 0x70,
519 0x58, 0x72, 0xd9, 0xce, 0x75, 0xf5, 0xe6, 0x8e,
520 0x0f, 0x9c, 0x0e, 0x2e, 0x62, 0x3e, 0x91, 0xd3,
521 0x7b, 0x97, 0x46, 0x60, 0xb9, 0x57, 0x13, 0x97,
522 0x26, 0xae, 0x0f, 0xb3, 0x8f, 0x2e, 0x9b, 0x3f,
523 0x00, 0x00, 0x99, 0x01, 0x00, 0xa5, 0x55, 0xec,
524 0x8c, 0x25, 0x7c, 0x65, 0xb7, 0x09, 0x40, 0x48,
525 0xae, 0xa8, 0xcb, 0xa1, 0x91, 0xac, 0x40, 0x24,
526 0xf2, 0x34, 0x6e, 0x3a, 0x8f, 0xa5, 0xb7, 0x48,
527 0x54, 0x6e, 0xfb, 0xf4, 0x37, 0x88, 0x69, 0x79,
528 0x6f, 0x12, 0xc1, 0x32, 0xdf, 0x15, 0x5d, 0x6e,
529 0x82, 0x54, 0xc0, 0x6e, 0x56, 0x4f, 0x3a, 0x9c,
530 0xc3, 0x96, 0x7a, 0xde, 0xa5, 0xfe, 0xec, 0xd1,
531 0x00, 0x00, 0x99, 0x01, 0x01, 0x5a, 0x21, 0x85,
532 0x0e, 0x25, 0x7b, 0x8d, 0x6e, 0x1d, 0x32, 0x29,
533 0xdb, 0x21, 0xb0, 0xa3, 0x30, 0x82, 0x02, 0x4f,
534 0x30, 0x82, 0x01, 0x37, 0xa0, 0x03, 0x02, 0x01,
535 0x02, 0x02, 0x04, 0x2a, 0xd9, 0x6a, 0xf3, 0x30,
536 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,
537 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x30, 0x2e,
538 0x31, 0x2c, 0x30, 0x2a, 0x06, 0x03, 0x55, 0x04,
539 0x00, 0x00, 0x99, 0x01, 0x02, 0x03, 0x13, 0x23,
540 0x59, 0x75, 0x62, 0x69, 0x63, 0x6f, 0x20, 0x55,
541 0x32, 0x46, 0x20, 0x52, 0x6f, 0x6f, 0x74, 0x20,
542 0x43, 0x41, 0x20, 0x53, 0x65, 0x72, 0x69, 0x61,
543 0x6c, 0x20, 0x34, 0x35, 0x37, 0x32, 0x30, 0x30,
544 0x36, 0x33, 0x31, 0x30, 0x20, 0x17, 0x0d, 0x31,
545 0x34, 0x30, 0x38, 0x30, 0x31, 0x30, 0x30, 0x30,
546 0x30, 0x30, 0x30, 0x5a, 0x18, 0x0f, 0x32, 0x30,
547 0x00, 0x00, 0x99, 0x01, 0x03, 0x35, 0x30, 0x30,
548 0x39, 0x30, 0x34, 0x30, 0x30, 0x30, 0x30, 0x30,
549 0x30, 0x5a, 0x30, 0x31, 0x31, 0x2f, 0x30, 0x2d,
550 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x26, 0x59,
551 0x75, 0x62, 0x69, 0x63, 0x6f, 0x20, 0x55, 0x32,
552 0x46, 0x20, 0x45, 0x45, 0x20, 0x53, 0x65, 0x72,
553 0x69, 0x61, 0x6c, 0x20, 0x32, 0x33, 0x39, 0x32,
554 0x35, 0x37, 0x33, 0x34, 0x35, 0x31, 0x36, 0x35,
555 0x00, 0x00, 0x99, 0x01, 0x04, 0x35, 0x30, 0x33,
556 0x38, 0x37, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07,
557 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06,
558 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01,
559 0x07, 0x03, 0x42, 0x00, 0x04, 0x2f, 0xe1, 0xa2,
560 0x3e, 0xbf, 0xa5, 0x5b, 0x3e, 0x46, 0x1d, 0x59,
561 0xa4, 0x35, 0x22, 0xd7, 0x97, 0x48, 0x98, 0x1c,
562 0xba, 0x6d, 0x28, 0x9a, 0x98, 0xf1, 0xbd, 0x7d,
563 0x00, 0x00, 0x99, 0x01, 0x05, 0xff, 0x65, 0x66,
564 0x80, 0xdb, 0xbb, 0xed, 0xbc, 0x2b, 0xae, 0x60,
565 0x7e, 0x6e, 0xf7, 0x72, 0xf5, 0x76, 0xb0, 0x4d,
566 0x54, 0xc4, 0xe5, 0xf3, 0x2f, 0x59, 0x6f, 0x26,
567 0xe6, 0x11, 0x15, 0xc7, 0x27, 0x2c, 0xf6, 0xca,
568 0x75, 0x94, 0xa3, 0x3b, 0x30, 0x39, 0x30, 0x22,
569 0x06, 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82,
570 0xc4, 0x0a, 0x02, 0x04, 0x15, 0x31, 0x2e, 0x33,
571 0x00, 0x00, 0x99, 0x01, 0x06, 0x2e, 0x36, 0x2e,
572 0x31, 0x2e, 0x34, 0x2e, 0x31, 0x2e, 0x34, 0x31,
573 0x34, 0x38, 0x32, 0x2e, 0x31, 0x2e, 0x32, 0x30,
574 0x13, 0x06, 0x0b, 0x2b, 0x06, 0x01, 0x04, 0x01,
575 0x82, 0xe5, 0x1c, 0x02, 0x01, 0x01, 0x04, 0x04,
576 0x03, 0x02, 0x04, 0x30, 0x30, 0x0d, 0x06, 0x09,
577 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01,
578 0x0b, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00,
579 0x00, 0x00, 0x99, 0x01, 0x07, 0x85, 0x6a, 0xfa,
580 0x8b, 0xcf, 0x4f, 0x3f, 0x62, 0x5f, 0x29, 0x1b,
581 0xc1, 0x15, 0x8e, 0x3c, 0x7e, 0xbd, 0x25, 0x52,
582 0xbc, 0xf7, 0x57, 0x07, 0x53, 0xf5, 0x12, 0x1d,
583 0xa6, 0xa5, 0x4d, 0x24, 0xcc, 0xcf, 0xae, 0x27,
584 0xce, 0xd6, 0xab, 0x31, 0x12, 0x8c, 0x29, 0x7e,
585 0x5b, 0x5b, 0x89, 0x05, 0xdd, 0xa0, 0x20, 0x17,
586 0x93, 0x1f, 0x1f, 0x5f, 0x59, 0x25, 0x93, 0x59,
587 0x00, 0x00, 0x99, 0x01, 0x08, 0x51, 0xfc, 0x00,
588 0x4b, 0xcb, 0xe2, 0x0a, 0xdd, 0x7d, 0x8d, 0x05,
589 0x2f, 0x95, 0x43, 0xb3, 0x49, 0x6c, 0x15, 0xb8,
590 0x31, 0x0e, 0x10, 0xcb, 0xd9, 0xbb, 0x05, 0x38,
591 0x27, 0x4f, 0x58, 0x3e, 0xad, 0x1f, 0x45, 0x12,
592 0x88, 0xc3, 0xea, 0x76, 0xd0, 0x70, 0xad, 0x44,
593 0xe5, 0x3a, 0xfe, 0xa8, 0xf2, 0x2d, 0x1f, 0x73,
594 0x62, 0x5f, 0xf2, 0xd5, 0x89, 0xfe, 0x30, 0xdf,
595 0x00, 0x00, 0x99, 0x01, 0x09, 0x26, 0x62, 0xcb,
596 0x7c, 0xbb, 0x7c, 0x99, 0x61, 0x80, 0xad, 0xcf,
597 0xa9, 0x8a, 0x4d, 0x01, 0x2c, 0xf3, 0x13, 0x46,
598 0xcd, 0x11, 0x74, 0x6a, 0x58, 0x48, 0xe8, 0xbe,
599 0xed, 0xf3, 0xe3, 0x0c, 0xcb, 0xd9, 0xc1, 0xdd,
600 0x22, 0x16, 0x71, 0xb2, 0x83, 0x88, 0x61, 0xf6,
601 0x5a, 0x45, 0x36, 0x23, 0xb5, 0x18, 0xd5, 0x56,
602 0x7f, 0xa8, 0xf0, 0xa3, 0xce, 0x10, 0x5d, 0xf4,
603 0x00, 0x00, 0x99, 0x01, 0x0a, 0xf1, 0x39, 0x53,
604 0xe1, 0x14, 0xea, 0x59, 0xe0, 0xa7, 0xf2, 0xfe,
605 0x66, 0x88, 0x67, 0x43, 0x2e, 0x52, 0xfd, 0x6a,
606 0x2f, 0x64, 0xf7, 0x3c, 0x48, 0xcd, 0x9b, 0x38,
607 0xf2, 0xdf, 0xba, 0x2c, 0x7a, 0x4b, 0x3b, 0x11,
608 0x28, 0xdf, 0x26, 0xd6, 0x6a, 0x24, 0xf8, 0x95,
609 0xdd, 0xa0, 0xb6, 0x11, 0x80, 0xf4, 0x14, 0x4f,
610 0x6b, 0x70, 0x75, 0xc3, 0x18, 0xa4, 0x9a, 0xe0,
611 0x00, 0x00, 0x99, 0x01, 0x0b, 0x8b, 0x58, 0xd3,
612 0x6a, 0xdb, 0x1e, 0x30, 0x53, 0x67, 0x2b, 0x17,
613 0xc5, 0xa1, 0x9f, 0x7f, 0x0a, 0x22, 0xf1, 0x0e,
614 0x94, 0x30, 0x44, 0x02, 0x20, 0x07, 0x5c, 0x4f,
615 0xd2, 0x83, 0xb6, 0x9f, 0x0a, 0x4a, 0x4d, 0x4b,
616 0x08, 0x35, 0xeb, 0xc0, 0x7e, 0x4a, 0x14, 0x2e,
617 0xc7, 0x8c, 0xd6, 0x64, 0x2f, 0xd3, 0x1e, 0xcc,
618 0xb5, 0xe8, 0x42, 0xea, 0xf6, 0x02, 0x20, 0x6b,
619 0x00, 0x00, 0x99, 0x01, 0x0c, 0x5a, 0xba, 0x4a,
620 0xc8, 0xd7, 0x89, 0xcc, 0x77, 0xe6, 0xb9, 0xa3,
621 0x34, 0xea, 0x06, 0x85, 0x72, 0xc6, 0x28, 0xa8,
622 0x7a, 0xaa, 0x19, 0x88, 0x34, 0xbb, 0xdc, 0x64,
623 0x90, 0x0a, 0xdb, 0x39, 0x90, 0x00, 0x00, 0x00,
624 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
625 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
626 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
627};
628
629int LLVMFuzzerTestOneInput(const uint8_t *, size_t);
630size_t LLVMFuzzerCustomMutator(uint8_t *, size_t, size_t, unsigned int);
631
632static int
633unpack(const uint8_t *ptr, size_t len, struct param *p) NO_MSAN
634{
635 uint8_t **pp = (void *)&ptr;
636
637 if (unpack_byte(TAG_RK, pp, &len, &p->rk) < 0 ||
638 unpack_byte(TAG_TYPE, pp, &len, &p->type) < 0 ||
639 unpack_byte(TAG_U2F, pp, &len, &p->u2f) < 0 ||
640 unpack_byte(TAG_UV, pp, &len, &p->uv) < 0 ||
641 unpack_byte(TAG_EXCL_COUNT, pp, &len, &p->excl_count) < 0 ||
642 unpack_string(TAG_PIN, pp, &len, p->pin) < 0 ||
643 unpack_string(TAG_RP_ID, pp, &len, p->rp_id) < 0 ||
644 unpack_string(TAG_RP_NAME, pp, &len, p->rp_name) < 0 ||
645 unpack_string(TAG_USER_ICON, pp, &len, p->user_icon) < 0 ||
646 unpack_string(TAG_USER_NAME, pp, &len, p->user_name) < 0 ||
647 unpack_string(TAG_USER_NICK, pp, &len, p->user_nick) < 0 ||
648 unpack_int(TAG_EXT, pp, &len, &p->ext) < 0 ||
649 unpack_int(TAG_SEED, pp, &len, &p->seed) < 0 ||
650 unpack_blob(TAG_CDH, pp, &len, &p->cdh) < 0 ||
651 unpack_blob(TAG_USER_ID, pp, &len, &p->user_id) < 0 ||
652 unpack_blob(TAG_WIRE_DATA, pp, &len, &p->wire_data) < 0 ||
653 unpack_blob(TAG_EXCL_CRED, pp, &len, &p->excl_cred) < 0)
654 return (-1);
655
656 return (0);
657}
658
659static size_t
660pack(uint8_t *ptr, size_t len, const struct param *p)
661{
662 const size_t max = len;
663
664 if (pack_byte(TAG_RK, &ptr, &len, p->rk) < 0 ||
665 pack_byte(TAG_TYPE, &ptr, &len, p->type) < 0 ||
666 pack_byte(TAG_U2F, &ptr, &len, p->u2f) < 0 ||
667 pack_byte(TAG_UV, &ptr, &len, p->uv) < 0 ||
668 pack_byte(TAG_EXCL_COUNT, &ptr, &len, p->excl_count) < 0 ||
669 pack_string(TAG_PIN, &ptr, &len, p->pin) < 0 ||
670 pack_string(TAG_RP_ID, &ptr, &len, p->rp_id) < 0 ||
671 pack_string(TAG_RP_NAME, &ptr, &len, p->rp_name) < 0 ||
672 pack_string(TAG_USER_ICON, &ptr, &len, p->user_icon) < 0 ||
673 pack_string(TAG_USER_NAME, &ptr, &len, p->user_name) < 0 ||
674 pack_string(TAG_USER_NICK, &ptr, &len, p->user_nick) < 0 ||
675 pack_int(TAG_EXT, &ptr, &len, p->ext) < 0 ||
676 pack_int(TAG_SEED, &ptr, &len, p->seed) < 0 ||
677 pack_blob(TAG_CDH, &ptr, &len, &p->cdh) < 0 ||
678 pack_blob(TAG_USER_ID, &ptr, &len, &p->user_id) < 0 ||
679 pack_blob(TAG_WIRE_DATA, &ptr, &len, &p->wire_data) < 0 ||
680 pack_blob(TAG_EXCL_CRED, &ptr, &len, &p->excl_cred) < 0)
681 return (0);
682
683 return (max - len);
684}
685
686static void
687make_cred(fido_cred_t *cred, uint8_t u2f, int type, const struct blob *cdh,
688 const char *rp_id, const char *rp_name, struct blob *user_id,
689 const char *user_name, const char *user_nick, const char *user_icon,
690 int ext, uint8_t rk, uint8_t uv, const char *pin, uint8_t excl_count,
691 struct blob *excl_cred)
692{
693 fido_dev_t *dev;
694 fido_dev_io_t io;
695
696 io.open = dev_open;
697 io.close = dev_close;
698 io.read = dev_read;
699 io.write = dev_write;
700
701 if ((dev = fido_dev_new()) == NULL || fido_dev_set_io_functions(dev,
702 &io) != FIDO_OK || fido_dev_open(dev, "nodev") != FIDO_OK) {
703 fido_dev_free(&dev);
704 return;
705 }
706
707 if (u2f & 1)
708 fido_dev_force_u2f(dev);
709
710 for (uint8_t i = 0; i < excl_count; i++)
711 fido_cred_exclude(cred, excl_cred->body, excl_cred->len);
712
713 fido_cred_set_type(cred, type);
714 fido_cred_set_clientdata_hash(cred, cdh->body, cdh->len);
715 fido_cred_set_rp(cred, rp_id, rp_name);
716 fido_cred_set_user(cred, user_id->body, user_id->len, user_name,
717 user_nick, user_icon);
718 fido_cred_set_extensions(cred, ext);
719 if (rk & 1)
720 fido_cred_set_rk(cred, FIDO_OPT_TRUE);
721 if (uv & 1)
722 fido_cred_set_uv(cred, FIDO_OPT_TRUE);
723
724 fido_dev_make_cred(dev, cred, u2f & 1 ? NULL : pin);
725
726 fido_dev_cancel(dev);
727 fido_dev_close(dev);
728 fido_dev_free(&dev);
729}
730
731static void
732verify_cred(int type, const unsigned char *cdh_ptr, size_t cdh_len,
733 const char *rp_id, const char *rp_name, const unsigned char *authdata_ptr,
734 size_t authdata_len, int ext, uint8_t rk, uint8_t uv,
735 const unsigned char *x5c_ptr, size_t x5c_len, const unsigned char *sig_ptr,
736 size_t sig_len, const char *fmt)
737{
738 fido_cred_t *cred;
739 uint8_t flags;
740
741 if ((cred = fido_cred_new()) == NULL) {
742 warnx("%s: fido_cred_new", __func__);
743 return;
744 }
745
746 fido_cred_set_type(cred, type);
747 fido_cred_set_clientdata_hash(cred, cdh_ptr, cdh_len);
748 fido_cred_set_rp(cred, rp_id, rp_name);
749 if (fido_cred_set_authdata(cred, authdata_ptr, authdata_len) != FIDO_OK)
750 fido_cred_set_authdata_raw(cred, authdata_ptr, authdata_len);
751 fido_cred_set_extensions(cred, ext);
752 fido_cred_set_x509(cred, x5c_ptr, x5c_len);
753 fido_cred_set_sig(cred, sig_ptr, sig_len);
754
755 if (rk & 1)
756 fido_cred_set_rk(cred, FIDO_OPT_TRUE);
757 if (uv & 1)
758 fido_cred_set_uv(cred, FIDO_OPT_TRUE);
759 if (fmt)
760 fido_cred_set_fmt(cred, fmt);
761
762 fido_cred_verify(cred);
763 fido_cred_verify_self(cred);
764
765 consume(fido_cred_pubkey_ptr(cred), fido_cred_pubkey_len(cred));
766 consume(fido_cred_id_ptr(cred), fido_cred_id_len(cred));
767 consume(fido_cred_user_id_ptr(cred), fido_cred_user_id_len(cred));
768 consume(fido_cred_user_name(cred), xstrlen(fido_cred_user_name(cred)));
769 consume(fido_cred_display_name(cred),
770 xstrlen(fido_cred_display_name(cred)));
771
772 flags = fido_cred_flags(cred);
773 consume(&flags, sizeof(flags));
774 type = fido_cred_type(cred);
775 consume(&type, sizeof(type));
776
777 fido_cred_free(&cred);
778}
779
780int
781LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
782{
783 struct param p;
784 fido_cred_t *cred = NULL;
785 int cose_alg = 0;
786
787 memset(&p, 0, sizeof(p));
788
789 if (unpack(data, size, &p) < 0)
790 return (0);
791
792 srandom((unsigned int)p.seed);
793
794 fido_init(0);
795
796 if ((cred = fido_cred_new()) == NULL)
797 return (0);
798
799 set_wire_data(p.wire_data.body, p.wire_data.len);
800
801 switch (p.type & 3) {
802 case 0:
803 cose_alg = COSE_ES256;
804 break;
805 case 1:
806 cose_alg = COSE_RS256;
807 break;
808 default:
809 cose_alg = COSE_EDDSA;
810 break;
811 }
812
813 make_cred(cred, p.u2f, cose_alg, &p.cdh, p.rp_id, p.rp_name,
814 &p.user_id, p.user_name, p.user_nick, p.user_icon, p.ext, p.rk,
815 p.uv, p.pin, p.excl_count, &p.excl_cred);
816
817 verify_cred(cose_alg,
818 fido_cred_clientdata_hash_ptr(cred),
819 fido_cred_clientdata_hash_len(cred), fido_cred_rp_id(cred),
820 fido_cred_rp_name(cred), fido_cred_authdata_ptr(cred),
821 fido_cred_authdata_len(cred), p.ext, p.rk, p.uv,
822 fido_cred_x5c_ptr(cred), fido_cred_x5c_len(cred),
823 fido_cred_sig_ptr(cred), fido_cred_sig_len(cred),
824 fido_cred_fmt(cred));
825
826 fido_cred_free(&cred);
827
828 return (0);
829}
830
831static size_t
832pack_dummy(uint8_t *ptr, size_t len)
833{
834 struct param dummy;
835 uint8_t blob[16384];
836 size_t blob_len;
837
838 memset(&dummy, 0, sizeof(dummy));
839
840 dummy.type = 1;
841 dummy.ext = FIDO_EXT_HMAC_SECRET;
842
843 strlcpy(dummy.pin, dummy_pin, sizeof(dummy.pin));
844 strlcpy(dummy.rp_id, dummy_rp_id, sizeof(dummy.rp_id));
845 strlcpy(dummy.rp_name, dummy_rp_name, sizeof(dummy.rp_name));
846 strlcpy(dummy.user_icon, dummy_user_icon, sizeof(dummy.user_icon));
847 strlcpy(dummy.user_name, dummy_user_name, sizeof(dummy.user_name));
848 strlcpy(dummy.user_nick, dummy_user_nick, sizeof(dummy.user_nick));
849
850 dummy.cdh.len = sizeof(dummy_cdh);
851 dummy.user_id.len = sizeof(dummy_user_id);
852 dummy.wire_data.len = sizeof(dummy_wire_data_fido);
853
854 memcpy(&dummy.cdh.body, &dummy_cdh, dummy.cdh.len);
855 memcpy(&dummy.user_id.body, &dummy_user_id, dummy.user_id.len);
856 memcpy(&dummy.wire_data.body, &dummy_wire_data_fido,
857 dummy.wire_data.len);
858
859 blob_len = pack(blob, sizeof(blob), &dummy);
860 assert(blob_len != 0);
861
862 if (blob_len > len) {
863 memcpy(ptr, blob, len);
864 return (len);
865 }
866
867 memcpy(ptr, blob, blob_len);
868
869 return (blob_len);
870}
871
872size_t
873LLVMFuzzerCustomMutator(uint8_t *data, size_t size, size_t maxsize,
874 unsigned int seed) NO_MSAN
875{
876 struct param p;
877 uint8_t blob[16384];
878 size_t blob_len;
879
880 memset(&p, 0, sizeof(p));
881
882 if (unpack(data, size, &p) < 0)
883 return (pack_dummy(data, maxsize));
884
885 mutate_byte(&p.rk);
886 mutate_byte(&p.type);
887 mutate_byte(&p.u2f);
888 mutate_byte(&p.uv);
889 mutate_byte(&p.excl_count);
890
891 mutate_int(&p.ext);
892 p.seed = (int)seed;
893
894 mutate_blob(&p.cdh);
895 mutate_blob(&p.user_id);
896
897 if (p.u2f & 1) {
898 p.wire_data.len = sizeof(dummy_wire_data_u2f);
899 memcpy(&p.wire_data.body, &dummy_wire_data_u2f,
900 p.wire_data.len);
901 } else {
902 p.wire_data.len = sizeof(dummy_wire_data_fido);
903 memcpy(&p.wire_data.body, &dummy_wire_data_fido,
904 p.wire_data.len);
905 }
906
907 mutate_blob(&p.wire_data);
908 mutate_blob(&p.excl_cred);
909
910 mutate_string(p.pin);
911 mutate_string(p.user_icon);
912 mutate_string(p.user_name);
913 mutate_string(p.user_nick);
914 mutate_string(p.rp_id);
915 mutate_string(p.rp_name);
916
917 blob_len = pack(blob, sizeof(blob), &p);
918
919 if (blob_len == 0 || blob_len > maxsize)
920 return (0);
921
922 memcpy(data, blob, blob_len);
923
924 return (blob_len);
925}