summaryrefslogtreecommitdiff
path: root/fuzz
diff options
context:
space:
mode:
Diffstat (limited to 'fuzz')
-rw-r--r--fuzz/CMakeLists.txt2
-rw-r--r--fuzz/Dockerfile10
-rw-r--r--fuzz/Makefile78
-rw-r--r--fuzz/README2
-rwxr-xr-xfuzz/build-coverage27
-rw-r--r--fuzz/corpus.tgzbin1131788 -> 0 bytes
-rw-r--r--fuzz/dummy.h96
-rw-r--r--fuzz/export.gnu189
-rw-r--r--fuzz/functions.txt276
-rw-r--r--fuzz/fuzz_assert.c261
-rw-r--r--fuzz/fuzz_bio.c398
-rw-r--r--fuzz/fuzz_cred.c604
-rw-r--r--fuzz/fuzz_credman.c374
-rw-r--r--fuzz/fuzz_mgmt.c257
-rwxr-xr-xfuzz/harnesses/assert32
-rwxr-xr-xfuzz/harnesses/assert-rsa-h-p33
-rwxr-xr-xfuzz/harnesses/assert-u2f32
-rwxr-xr-xfuzz/harnesses/cred31
-rwxr-xr-xfuzz/harnesses/cred-rsa-h-p32
-rwxr-xr-xfuzz/harnesses/cred-u2f31
-rwxr-xr-xfuzz/harnesses/cred-u2f-exclude33
-rwxr-xr-xfuzz/harnesses/fido2-assert-G31
-rwxr-xr-xfuzz/harnesses/fido2-assert-V32
-rwxr-xr-xfuzz/harnesses/fido2-cred-M31
-rwxr-xr-xfuzz/harnesses/fido2-cred-V31
-rwxr-xr-xfuzz/harnesses/fuzz_assert29
-rwxr-xr-xfuzz/harnesses/fuzz_bio29
-rwxr-xr-xfuzz/harnesses/fuzz_cred28
-rwxr-xr-xfuzz/harnesses/fuzz_credman28
-rwxr-xr-xfuzz/harnesses/fuzz_mgmt29
-rw-r--r--fuzz/mutator_aux.c30
-rw-r--r--fuzz/mutator_aux.h15
-rwxr-xr-xfuzz/prng.c112
-rwxr-xr-xfuzz/report80
-rw-r--r--fuzz/report.html.gzbin206440 -> 0 bytes
-rw-r--r--fuzz/report.tgzbin0 -> 211709 bytes
-rw-r--r--fuzz/summary.txt40
-rw-r--r--fuzz/uniform_random.c3
-rw-r--r--fuzz/wiredata_fido2.h569
-rw-r--r--fuzz/wiredata_u2f.h152
-rw-r--r--fuzz/wrap.c132
-rw-r--r--fuzz/wrapped.sym16
42 files changed, 1795 insertions, 2420 deletions
diff --git a/fuzz/CMakeLists.txt b/fuzz/CMakeLists.txt
index ad30aa3..241cdc7 100644
--- a/fuzz/CMakeLists.txt
+++ b/fuzz/CMakeLists.txt
@@ -9,10 +9,8 @@ list(APPEND COMPAT_SOURCES
9 9
10list(APPEND COMMON_SOURCES 10list(APPEND COMMON_SOURCES
11 mutator_aux.c 11 mutator_aux.c
12 uniform_random.c
13) 12)
14 13
15
16# fuzz_cred 14# fuzz_cred
17add_executable(fuzz_cred fuzz_cred.c ${COMMON_SOURCES} ${COMPAT_SOURCES}) 15add_executable(fuzz_cred fuzz_cred.c ${COMMON_SOURCES} ${COMPAT_SOURCES})
18target_compile_options(fuzz_cred PRIVATE ${FUZZ_LDFLAGS}) 16target_compile_options(fuzz_cred PRIVATE ${FUZZ_LDFLAGS})
diff --git a/fuzz/Dockerfile b/fuzz/Dockerfile
new file mode 100644
index 0000000..68afd99
--- /dev/null
+++ b/fuzz/Dockerfile
@@ -0,0 +1,10 @@
1# Copyright (c) 2019 Yubico AB. All rights reserved.
2# Use of this source code is governed by a BSD-style
3# license that can be found in the LICENSE file.
4
5FROM ubuntu:bionic
6RUN apt-get update
7RUN apt-get install -y clang-9 cmake git libssl-dev libudev-dev make pkg-config
8RUN git clone --branch v0.5.0 https://github.com/PJK/libcbor
9RUN git clone https://github.com/yubico/libfido2
10RUN CC=clang-9 /libfido2/fuzz/build-coverage /libcbor /libfido2
diff --git a/fuzz/Makefile b/fuzz/Makefile
new file mode 100644
index 0000000..c8fe0b8
--- /dev/null
+++ b/fuzz/Makefile
@@ -0,0 +1,78 @@
1# Copyright (c) 2019 Yubico AB. All rights reserved.
2# Use of this source code is governed by a BSD-style
3# license that can be found in the LICENSE file.
4
5IMAGE := libfido2-coverage:1.3.0
6RUNNER := libfido2-runner
7PROFDATA := llvm-profdata-9
8COV := llvm-cov-9
9TARGETS := fuzz_assert fuzz_bio fuzz_cred fuzz_credman fuzz_mgmt
10CORPORA := $(foreach f,${TARGETS},${f}/corpus)
11MINIFY := $(foreach f,${TARGETS},/minify/${f}/corpus)
12REMOTE := gs://libfido2-corpus.clusterfuzz-external.appspot.com
13.DEFAULT_GOAL := all
14
15all: ${TARGETS}
16
17build:
18 docker build -t ${IMAGE} - < Dockerfile
19
20run: build
21 -docker run -it -d --name ${RUNNER} ${IMAGE}
22 docker start ${RUNNER}
23
24sync: run
25 tar Ccf .. - src fuzz | docker exec -i ${RUNNER} tar Cxf /libfido2 -
26 docker exec ${RUNNER} make -C libfido2/build
27
28corpus: sync
29 docker exec ${RUNNER} /bin/bash -c 'cd /libfido2/fuzz && rm -rf ${TARGETS}'
30 docker exec ${RUNNER} tar Czxf /libfido2/fuzz /libfido2/fuzz/corpus.tgz
31
32${TARGETS}: corpus sync
33 docker exec -e LLVM_PROFILE_FILE=/profraw/$@ ${RUNNER} \
34 /bin/bash -c 'rm -f /profraw/$@ && /libfido2/build/fuzz/$@ \
35 -runs=1 /libfido2/fuzz/$@'
36
37${MINIFY}: /minify/%/corpus: %
38 docker exec ${RUNNER} /bin/bash -c 'rm -rf $@ && mkdir -p $@ && \
39 /libfido2/build/fuzz/$< -use_value_profile=1 -merge=1 $@ \
40 /libfido2/fuzz/$</corpus'
41
42corpus.tgz-: ${MINIFY}
43 docker exec -i ${RUNNER} tar Czcf /minify - ${TARGETS} > $@
44
45profdata: run
46 docker exec ${RUNNER} /bin/bash -c 'rm -f /$@ && ${PROFDATA} \
47 merge -sparse profraw/* -o $@'
48
49report.tgz: profdata
50 docker exec ${RUNNER} /bin/bash -c 'rm -rf /report && mkdir /report && \
51 ${COV} show -format=html -tab-size=8 -instr-profile=/$< \
52 -output-dir=/report /libfido2/build/src/libfido2.so'
53 docker exec -i ${RUNNER} tar Czcf / - report > $@
54
55summary.txt: profdata
56 docker exec ${RUNNER} ${COV} report -use-color=false \
57 /libfido2/build/src/libfido2.so -instr-profile=/$< > $@
58
59functions.txt: profdata
60 docker exec ${RUNNER} /bin/bash -c '${COV} report -use-color=false \
61 -show-functions -instr-profile=/$< \
62 /libfido2/build/src/libfido2.so /libfido2/src/*.[ch]' > $@
63
64clean: run
65 docker exec ${RUNNER} /bin/bash -c 'rm -rf /profraw /profdata && \
66 make -C /libfido2/build clean'
67 -docker stop ${RUNNER}
68 rm -rf ${TARGETS}
69
70${CORPORA}:
71 -mkdir -p $@
72 gsutil -q -m rsync -d -r ${REMOTE}/libFuzzer/libfido2_$(@:/corpus=) $@
73
74corpus.tgz: ${CORPORA}
75 tar zcf $@ ${TARGETS}
76
77.PHONY: build run sync corpus ${TARGETS} ${CORPORA}
78.PHONY: report.tgz summary.txt functions.txt
diff --git a/fuzz/README b/fuzz/README
index ecb02bb..42646e4 100644
--- a/fuzz/README
+++ b/fuzz/README
@@ -129,7 +129,7 @@ When running under ASAN, you may want to set ASAN_OPTIONS to
129The recommended way to run the harnesses is: 129The recommended way to run the harnesses is:
130 130
131$ fuzz_{assert,cred,credman,mgmt} -use_value_profile=1 -reload=30 \ 131$ fuzz_{assert,cred,credman,mgmt} -use_value_profile=1 -reload=30 \
132 -print_pcs=1 -print_funcs=30 -timeout=10 -max_len=17408 CORPUS_DIR 132 -print_pcs=1 -print_funcs=30 -timeout=10 CORPUS_DIR
133 133
134You may want to use -jobs or -workers depending on the number of logical 134You may want to use -jobs or -workers depending on the number of logical
135cores available for fuzzing. 135cores available for fuzzing.
diff --git a/fuzz/build-coverage b/fuzz/build-coverage
new file mode 100755
index 0000000..af9f8df
--- /dev/null
+++ b/fuzz/build-coverage
@@ -0,0 +1,27 @@
1#!/bin/bash -eux
2#
3# Copyright (c) 2019 Yubico AB. All rights reserved.
4# Use of this source code is governed by a BSD-style
5# license that can be found in the LICENSE file.
6
7LIBCBOR=$1
8LIBFIDO2=$2
9
10CC=${CC:-clang}
11PKG_CONFIG_PATH=${PKG_CONFIG_PATH:-${LIBCBOR}/install/lib/pkgconfig}
12export CC PKG_CONFIG_PATH
13
14# Clean up.
15rm -rf ${LIBCBOR}/build ${LIBCBOR}/install ${LIBFIDO2}/build
16
17# Patch, build, and install libcbor.
18(cd ${LIBCBOR} && patch -N -l -s -p0 < ${LIBFIDO2}/fuzz/README) || true
19mkdir ${LIBCBOR}/build ${LIBCBOR}/install
20(cd ${LIBCBOR}/build && cmake -DCMAKE_INSTALL_PREFIX=${LIBCBOR}/install ..)
21make -C ${LIBCBOR}/build all install
22
23# Build libfido2.
24mkdir -p ${LIBFIDO2}/build
25(cd ${LIBFIDO2}/build && cmake -DFUZZ=1 -DLIBFUZZER=1 -DCOVERAGE=1 \
26 -DCMAKE_BUILD_TYPE=Debug ..)
27make -C ${LIBFIDO2}/build
diff --git a/fuzz/corpus.tgz b/fuzz/corpus.tgz
deleted file mode 100644
index 9da3099..0000000
--- a/fuzz/corpus.tgz
+++ /dev/null
Binary files differ
diff --git a/fuzz/dummy.h b/fuzz/dummy.h
new file mode 100644
index 0000000..a899e4a
--- /dev/null
+++ b/fuzz/dummy.h
@@ -0,0 +1,96 @@
1/*
2 * Copyright (c) 2020 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 _DUMMY_H
8#define _DUMMY_H
9
10#include <stdint.h>
11
12const char dummy_name[] = "finger1";
13const char dummy_pin[] = "9}4gT:8d=A37Dh}U";
14const char dummy_rp_id[] = "localhost";
15const char dummy_rp_name[] = "sweet home localhost";
16const char dummy_user_icon[] = "an icon";
17const char dummy_user_name[] = "john smith";
18const char dummy_user_nick[] = "jsmith";
19const uint8_t dummy_id[] = { 0x5e, 0xd2 };
20const char dummy_pin1[] = "skepp cg0u3;Y..";
21const char dummy_pin2[] = "bastilha 6rJrfQZI.";
22
23const uint8_t dummy_user_id[] = {
24 0x78, 0x1c, 0x78, 0x60, 0xad, 0x88, 0xd2, 0x63,
25 0x32, 0x62, 0x2a, 0xf1, 0x74, 0x5d, 0xed, 0xb2,
26 0xe7, 0xa4, 0x2b, 0x44, 0x89, 0x29, 0x39, 0xc5,
27 0x56, 0x64, 0x01, 0x27, 0x0d, 0xbb, 0xc4, 0x49,
28};
29
30const uint8_t dummy_cred_id[] = {
31 0x4f, 0x72, 0x98, 0x42, 0x4a, 0xe1, 0x17, 0xa5,
32 0x85, 0xa0, 0xef, 0x3b, 0x11, 0x24, 0x4a, 0x3d,
33};
34
35const uint8_t dummy_cdh[] = {
36 0xec, 0x8d, 0x8f, 0x78, 0x42, 0x4a, 0x2b, 0xb7,
37 0x82, 0x34, 0xaa, 0xca, 0x07, 0xa1, 0xf6, 0x56,
38 0x42, 0x1c, 0xb6, 0xf6, 0xb3, 0x00, 0x86, 0x52,
39 0x35, 0x2d, 0xa2, 0x62, 0x4a, 0xbe, 0x89, 0x76,
40};
41
42const uint8_t dummy_es256[] = {
43 0xcc, 0x1b, 0x50, 0xac, 0xc4, 0x19, 0xf8, 0x3a,
44 0xee, 0x0a, 0x77, 0xd6, 0xf3, 0x53, 0xdb, 0xef,
45 0xf2, 0xb9, 0x5c, 0x2d, 0x8b, 0x1e, 0x52, 0x58,
46 0x88, 0xf4, 0x0b, 0x85, 0x1f, 0x40, 0x6d, 0x18,
47 0x15, 0xb3, 0xcc, 0x25, 0x7c, 0x38, 0x3d, 0xec,
48 0xdf, 0xad, 0xbd, 0x46, 0x91, 0xc3, 0xac, 0x30,
49 0x94, 0x2a, 0xf7, 0x78, 0x35, 0x70, 0x59, 0x6f,
50 0x28, 0xcb, 0x8e, 0x07, 0x85, 0xb5, 0x91, 0x96,
51};
52
53const uint8_t dummy_rs256[] = {
54 0xd2, 0xa8, 0xc0, 0x11, 0x82, 0x9e, 0x57, 0x2e,
55 0x60, 0xae, 0x8c, 0xb0, 0x09, 0xe1, 0x58, 0x2b,
56 0x99, 0xec, 0xc3, 0x11, 0x1b, 0xef, 0x81, 0x49,
57 0x34, 0x53, 0x6a, 0x01, 0x65, 0x2c, 0x24, 0x09,
58 0x30, 0x87, 0x98, 0x51, 0x6e, 0x30, 0x4f, 0x60,
59 0xbd, 0x54, 0xd2, 0x54, 0xbd, 0x94, 0x42, 0xdd,
60 0x63, 0xe5, 0x2c, 0xc6, 0x04, 0x32, 0xc0, 0x8f,
61 0x72, 0xd5, 0xb4, 0xf0, 0x4f, 0x42, 0xe5, 0xb0,
62 0xa2, 0x95, 0x11, 0xfe, 0xd8, 0xb0, 0x65, 0x34,
63 0xff, 0xfb, 0x44, 0x97, 0x52, 0xfc, 0x67, 0x23,
64 0x0b, 0xad, 0xf3, 0x3a, 0x82, 0xd4, 0x96, 0x10,
65 0x87, 0x6b, 0xfa, 0xd6, 0x51, 0x60, 0x3e, 0x1c,
66 0xae, 0x19, 0xb8, 0xce, 0x08, 0xae, 0x9a, 0xee,
67 0x78, 0x16, 0x22, 0xcc, 0x92, 0xcb, 0xa8, 0x95,
68 0x34, 0xe5, 0xb9, 0x42, 0x6a, 0xf0, 0x2e, 0x82,
69 0x1f, 0x4c, 0x7d, 0x84, 0x94, 0x68, 0x7b, 0x97,
70 0x2b, 0xf7, 0x7d, 0x67, 0x83, 0xbb, 0xc7, 0x8a,
71 0x31, 0x5a, 0xf3, 0x2a, 0x95, 0xdf, 0x63, 0xe7,
72 0x4e, 0xee, 0x26, 0xda, 0x87, 0x00, 0xe2, 0x23,
73 0x4a, 0x33, 0x9a, 0xa0, 0x1b, 0xce, 0x60, 0x1f,
74 0x98, 0xa1, 0xb0, 0xdb, 0xbf, 0x20, 0x59, 0x27,
75 0xf2, 0x06, 0xd9, 0xbe, 0x37, 0xa4, 0x03, 0x6b,
76 0x6a, 0x4e, 0xaf, 0x22, 0x68, 0xf3, 0xff, 0x28,
77 0x59, 0x05, 0xc9, 0xf1, 0x28, 0xf4, 0xbb, 0x35,
78 0xe0, 0xc2, 0x68, 0xc2, 0xaa, 0x54, 0xac, 0x8c,
79 0xc1, 0x69, 0x9e, 0x4b, 0x32, 0xfc, 0x53, 0x58,
80 0x85, 0x7d, 0x3f, 0x51, 0xd1, 0xc9, 0x03, 0x02,
81 0x13, 0x61, 0x62, 0xda, 0xf8, 0xfe, 0x3e, 0xc8,
82 0x95, 0x12, 0xfb, 0x0c, 0xdf, 0x06, 0x65, 0x6f,
83 0x23, 0xc7, 0x83, 0x7c, 0x50, 0x2d, 0x27, 0x25,
84 0x4d, 0xbf, 0x94, 0xf0, 0x89, 0x04, 0xb9, 0x2d,
85 0xc4, 0xa5, 0x32, 0xa9, 0x25, 0x0a, 0x99, 0x59,
86 0x01, 0x00, 0x01,
87};
88
89const uint8_t dummy_eddsa[] = {
90 0xfe, 0x8b, 0x61, 0x50, 0x31, 0x7a, 0xe6, 0xdf,
91 0xb1, 0x04, 0x9d, 0x4d, 0xb5, 0x7a, 0x5e, 0x96,
92 0x4c, 0xb2, 0xf9, 0x5f, 0x72, 0x47, 0xb5, 0x18,
93 0xe2, 0x39, 0xdf, 0x2f, 0x87, 0x19, 0xb3, 0x02,
94};
95
96#endif /* !_DUMMY_H */
diff --git a/fuzz/export.gnu b/fuzz/export.gnu
new file mode 100644
index 0000000..68463ff
--- /dev/null
+++ b/fuzz/export.gnu
@@ -0,0 +1,189 @@
1{
2 global:
3 eddsa_pk_free;
4 eddsa_pk_from_EVP_PKEY;
5 eddsa_pk_from_ptr;
6 eddsa_pk_new;
7 eddsa_pk_to_EVP_PKEY;
8 es256_pk_free;
9 es256_pk_from_EC_KEY;
10 es256_pk_from_ptr;
11 es256_pk_new;
12 es256_pk_to_EVP_PKEY;
13 fido_assert_allow_cred;
14 fido_assert_authdata_len;
15 fido_assert_authdata_ptr;
16 fido_assert_clientdata_hash_len;
17 fido_assert_clientdata_hash_ptr;
18 fido_assert_count;
19 fido_assert_flags;
20 fido_assert_free;
21 fido_assert_hmac_secret_len;
22 fido_assert_hmac_secret_ptr;
23 fido_assert_id_len;
24 fido_assert_id_ptr;
25 fido_assert_new;
26 fido_assert_rp_id;
27 fido_assert_set_authdata;
28 fido_assert_set_authdata_raw;
29 fido_assert_set_clientdata_hash;
30 fido_assert_set_count;
31 fido_assert_set_extensions;
32 fido_assert_set_hmac_salt;
33 fido_assert_set_options;
34 fido_assert_set_rp;
35 fido_assert_set_sig;
36 fido_assert_set_up;
37 fido_assert_set_uv;
38 fido_assert_sigcount;
39 fido_assert_sig_len;
40 fido_assert_sig_ptr;
41 fido_assert_user_display_name;
42 fido_assert_user_icon;
43 fido_assert_user_id_len;
44 fido_assert_user_id_ptr;
45 fido_assert_user_name;
46 fido_assert_verify;
47 fido_bio_dev_enroll_begin;
48 fido_bio_dev_enroll_cancel;
49 fido_bio_dev_enroll_continue;
50 fido_bio_dev_enroll_remove;
51 fido_bio_dev_get_info;
52 fido_bio_dev_get_template_array;
53 fido_bio_dev_set_template_name;
54 fido_bio_enroll_free;
55 fido_bio_enroll_last_status;
56 fido_bio_enroll_new;
57 fido_bio_enroll_remaining_samples;
58 fido_bio_info_free;
59 fido_bio_info_max_samples;
60 fido_bio_info_new;
61 fido_bio_info_type;
62 fido_bio_template;
63 fido_bio_template_array_count;
64 fido_bio_template_array_free;
65 fido_bio_template_array_new;
66 fido_bio_template_free;
67 fido_bio_template_id_len;
68 fido_bio_template_id_ptr;
69 fido_bio_template_name;
70 fido_bio_template_new;
71 fido_bio_template_set_id;
72 fido_bio_template_set_name;
73 fido_cbor_info_aaguid_len;
74 fido_cbor_info_aaguid_ptr;
75 fido_cbor_info_extensions_len;
76 fido_cbor_info_extensions_ptr;
77 fido_cbor_info_free;
78 fido_cbor_info_maxmsgsiz;
79 fido_cbor_info_fwversion;
80 fido_cbor_info_new;
81 fido_cbor_info_options_len;
82 fido_cbor_info_options_name_ptr;
83 fido_cbor_info_options_value_ptr;
84 fido_cbor_info_protocols_len;
85 fido_cbor_info_protocols_ptr;
86 fido_cbor_info_versions_len;
87 fido_cbor_info_versions_ptr;
88 fido_cred_authdata_len;
89 fido_cred_authdata_ptr;
90 fido_cred_clientdata_hash_len;
91 fido_cred_clientdata_hash_ptr;
92 fido_cred_display_name;
93 fido_cred_exclude;
94 fido_cred_flags;
95 fido_cred_fmt;
96 fido_cred_free;
97 fido_cred_id_len;
98 fido_cred_id_ptr;
99 fido_credman_del_dev_rk;
100 fido_credman_get_dev_metadata;
101 fido_credman_get_dev_rk;
102 fido_credman_get_dev_rp;
103 fido_credman_metadata_free;
104 fido_credman_metadata_new;
105 fido_credman_rk;
106 fido_credman_rk_count;
107 fido_credman_rk_existing;
108 fido_credman_rk_free;
109 fido_credman_rk_new;
110 fido_credman_rk_remaining;
111 fido_credman_rp_count;
112 fido_credman_rp_free;
113 fido_credman_rp_id;
114 fido_credman_rp_id_hash_len;
115 fido_credman_rp_id_hash_ptr;
116 fido_credman_rp_name;
117 fido_credman_rp_new;
118 fido_cred_new;
119 fido_cred_prot;
120 fido_cred_pubkey_len;
121 fido_cred_pubkey_ptr;
122 fido_cred_rp_id;
123 fido_cred_rp_name;
124 fido_cred_set_authdata;
125 fido_cred_set_authdata_raw;
126 fido_cred_set_clientdata_hash;
127 fido_cred_set_extensions;
128 fido_cred_set_fmt;
129 fido_cred_set_options;
130 fido_cred_set_prot;
131 fido_cred_set_rk;
132 fido_cred_set_rp;
133 fido_cred_set_sig;
134 fido_cred_set_type;
135 fido_cred_set_user;
136 fido_cred_set_uv;
137 fido_cred_set_x509;
138 fido_cred_sig_len;
139 fido_cred_sig_ptr;
140 fido_cred_type;
141 fido_cred_user_id_len;
142 fido_cred_user_id_ptr;
143 fido_cred_user_name;
144 fido_cred_verify;
145 fido_cred_verify_self;
146 fido_cred_x5c_len;
147 fido_cred_x5c_ptr;
148 fido_dev_build;
149 fido_dev_cancel;
150 fido_dev_close;
151 fido_dev_flags;
152 fido_dev_force_fido2;
153 fido_dev_force_u2f;
154 fido_dev_free;
155 fido_dev_get_assert;
156 fido_dev_get_cbor_info;
157 fido_dev_get_retry_count;
158 fido_dev_info_free;
159 fido_dev_info_manifest;
160 fido_dev_info_manufacturer_string;
161 fido_dev_info_new;
162 fido_dev_info_path;
163 fido_dev_info_product;
164 fido_dev_info_product_string;
165 fido_dev_info_ptr;
166 fido_dev_info_vendor;
167 fido_dev_is_fido2;
168 fido_dev_major;
169 fido_dev_make_cred;
170 fido_dev_minor;
171 fido_dev_new;
172 fido_dev_open;
173 fido_dev_protocol;
174 fido_dev_reset;
175 fido_dev_set_io_functions;
176 fido_dev_set_pin;
177 fido_init;
178 fido_set_log_handler;
179 fido_strerr;
180 rs256_pk_free;
181 rs256_pk_from_ptr;
182 rs256_pk_from_RSA;
183 rs256_pk_new;
184 rs256_pk_to_EVP_PKEY;
185 prng_init;
186 uniform_random;
187 local:
188 *;
189};
diff --git a/fuzz/functions.txt b/fuzz/functions.txt
index cd652f2..27a9608 100644
--- a/fuzz/functions.txt
+++ b/fuzz/functions.txt
@@ -1,4 +1,4 @@
1File '/home/pedro/projects/libfido2/src/aes256.c': 1File '/libfido2/src/aes256.c':
2Name Regions Miss Cover Lines Miss Cover 2Name Regions Miss Cover Lines Miss Cover
3----------------------------------------------------------------------------- 3-----------------------------------------------------------------------------
4aes256_cbc_enc 28 0 100.00% 41 0 100.00% 4aes256_cbc_enc 28 0 100.00% 41 0 100.00%
@@ -6,14 +6,15 @@ aes256_cbc_dec 28 0 100.00% 41 0 100.00%
6----------------------------------------------------------------------------- 6-----------------------------------------------------------------------------
7TOTAL 56 0 100.00% 82 0 100.00% 7TOTAL 56 0 100.00% 82 0 100.00%
8 8
9File '/home/pedro/projects/libfido2/src/assert.c': 9File '/libfido2/src/assert.c':
10Name Regions Miss Cover Lines Miss Cover 10Name Regions Miss Cover Lines Miss Cover
11--------------------------------------------------------------------------------------- 11---------------------------------------------------------------------------------------
12fido_dev_get_assert 35 3 91.43% 38 4 89.47% 12fido_dev_get_assert 35 3 91.43% 38 4 89.47%
13fido_check_flags 13 0 100.00% 18 0 100.00% 13fido_check_flags 13 0 100.00% 18 0 100.00%
14fido_get_signed_hash 32 0 100.00% 46 0 100.00%
14fido_verify_sig_es256 17 2 88.24% 31 7 77.42% 15fido_verify_sig_es256 17 2 88.24% 31 7 77.42%
15fido_verify_sig_rs256 17 2 88.24% 31 7 77.42% 16fido_verify_sig_rs256 17 2 88.24% 31 7 77.42%
16fido_verify_sig_eddsa 23 2 91.30% 43 7 83.72% 17fido_verify_sig_eddsa 23 4 82.61% 43 13 69.77%
17fido_assert_verify 48 4 91.67% 79 4 94.94% 18fido_assert_verify 48 4 91.67% 79 4 94.94%
18fido_assert_set_clientdata_hash 6 0 100.00% 6 0 100.00% 19fido_assert_set_clientdata_hash 6 0 100.00% 6 0 100.00%
19fido_assert_set_hmac_salt 10 0 100.00% 7 0 100.00% 20fido_assert_set_hmac_salt 10 0 100.00% 7 0 100.00%
@@ -27,7 +28,7 @@ fido_assert_clientdata_hash_ptr 1 0 100.00% 3 0
27fido_assert_clientdata_hash_len 1 0 100.00% 3 0 100.00% 28fido_assert_clientdata_hash_len 1 0 100.00% 3 0 100.00%
28fido_assert_new 1 0 100.00% 3 0 100.00% 29fido_assert_new 1 0 100.00% 3 0 100.00%
29fido_assert_reset_tx 1 0 100.00% 15 0 100.00% 30fido_assert_reset_tx 1 0 100.00% 15 0 100.00%
30fido_assert_reset_rx 6 0 100.00% 24 0 100.00% 31fido_assert_reset_rx 6 1 83.33% 24 3 87.50%
31fido_assert_free 6 0 100.00% 13 0 100.00% 32fido_assert_free 6 0 100.00% 13 0 100.00%
32fido_assert_count 1 0 100.00% 3 0 100.00% 33fido_assert_count 1 0 100.00% 3 0 100.00%
33fido_assert_rp_id 1 0 100.00% 3 0 100.00% 34fido_assert_rp_id 1 0 100.00% 3 0 100.00%
@@ -47,36 +48,35 @@ fido_assert_user_display_name 4 0 100.00% 6 0
47fido_assert_hmac_secret_ptr 4 0 100.00% 6 0 100.00% 48fido_assert_hmac_secret_ptr 4 0 100.00% 6 0 100.00%
48fido_assert_hmac_secret_len 4 0 100.00% 6 0 100.00% 49fido_assert_hmac_secret_len 4 0 100.00% 6 0 100.00%
49fido_assert_set_authdata 24 0 100.00% 35 0 100.00% 50fido_assert_set_authdata 24 0 100.00% 35 0 100.00%
50fido_assert_set_authdata_raw 24 0 100.00% 34 0 100.00% 51fido_assert_set_authdata_raw 24 4 83.33% 34 7 79.41%
51fido_assert_set_sig 14 0 100.00% 17 0 100.00% 52fido_assert_set_sig 14 0 100.00% 17 0 100.00%
52fido_assert_set_count 10 0 100.00% 21 0 100.00% 53fido_assert_set_count 10 0 100.00% 21 0 100.00%
53assert.c:fido_dev_get_assert_wait 21 0 100.00% 16 0 100.00% 54assert.c:fido_dev_get_assert_wait 21 1 95.24% 16 2 87.50%
54assert.c:fido_dev_get_assert_tx 58 4 93.10% 84 11 86.90% 55assert.c:fido_dev_get_assert_tx 58 4 93.10% 84 11 86.90%
55assert.c:fido_dev_get_assert_rx 20 0 100.00% 38 0 100.00% 56assert.c:fido_dev_get_assert_rx 19 0 100.00% 38 0 100.00%
56assert.c:adjust_assert_count 24 0 100.00% 33 0 100.00% 57assert.c:adjust_assert_count 24 0 100.00% 33 0 100.00%
57assert.c:parse_assert_reply 11 0 100.00% 25 0 100.00% 58assert.c:parse_assert_reply 11 0 100.00% 25 0 100.00%
58assert.c:fido_get_next_assert_tx 9 0 100.00% 11 0 100.00% 59assert.c:fido_get_next_assert_tx 8 2 75.00% 10 3 70.00%
59assert.c:fido_get_next_assert_rx 16 2 87.50% 26 4 84.62% 60assert.c:fido_get_next_assert_rx 15 4 73.33% 26 7 73.08%
60assert.c:decrypt_hmac_secrets 9 1 88.89% 15 4 73.33% 61assert.c:decrypt_hmac_secrets 9 3 66.67% 15 7 53.33%
61assert.c:check_extensions 4 0 100.00% 9 0 100.00% 62assert.c:check_extensions 4 0 100.00% 9 0 100.00%
62assert.c:get_signed_hash 32 0 100.00% 46 0 100.00%
63assert.c:fido_assert_clean_authdata 1 0 100.00% 9 0 100.00% 63assert.c:fido_assert_clean_authdata 1 0 100.00% 9 0 100.00%
64assert.c:fido_assert_clean_sig 1 0 100.00% 5 0 100.00% 64assert.c:fido_assert_clean_sig 1 0 100.00% 5 0 100.00%
65--------------------------------------------------------------------------------------- 65---------------------------------------------------------------------------------------
66TOTAL 569 29 94.90% 901 60 93.34% 66TOTAL 566 43 92.40% 900 87 90.33%
67 67
68File '/home/pedro/projects/libfido2/src/authkey.c': 68File '/libfido2/src/authkey.c':
69Name Regions Miss Cover Lines Miss Cover 69Name Regions Miss Cover Lines Miss Cover
70--------------------------------------------------------------------------------------- 70---------------------------------------------------------------------------------------
71fido_dev_authkey 1 0 100.00% 3 0 100.00% 71fido_dev_authkey 1 0 100.00% 3 0 100.00%
72authkey.c:fido_dev_authkey_wait 10 0 100.00% 9 0 100.00% 72authkey.c:fido_dev_authkey_wait 10 0 100.00% 9 0 100.00%
73authkey.c:fido_dev_authkey_tx 19 0 100.00% 33 0 100.00% 73authkey.c:fido_dev_authkey_tx 19 0 100.00% 33 0 100.00%
74authkey.c:fido_dev_authkey_rx 7 0 100.00% 18 0 100.00% 74authkey.c:fido_dev_authkey_rx 6 0 100.00% 18 0 100.00%
75authkey.c:parse_authkey 8 0 100.00% 12 0 100.00% 75authkey.c:parse_authkey 8 0 100.00% 12 0 100.00%
76--------------------------------------------------------------------------------------- 76---------------------------------------------------------------------------------------
77TOTAL 45 0 100.00% 75 0 100.00% 77TOTAL 44 0 100.00% 75 0 100.00%
78 78
79File '/home/pedro/projects/libfido2/src/bio.c': 79File '/libfido2/src/bio.c':
80Name Regions Miss Cover Lines Miss Cover 80Name Regions Miss Cover Lines Miss Cover
81--------------------------------------------------------------------------------------- 81---------------------------------------------------------------------------------------
82fido_bio_dev_get_template_array 5 2 60.00% 6 0 100.00% 82fido_bio_dev_get_template_array 5 2 60.00% 6 0 100.00%
@@ -108,30 +108,30 @@ fido_bio_enroll_last_status 1 0 100.00% 3 0
108bio.c:bio_get_template_array_wait 11 0 100.00% 9 0 100.00% 108bio.c:bio_get_template_array_wait 11 0 100.00% 9 0 100.00%
109bio.c:bio_tx 43 0 100.00% 65 0 100.00% 109bio.c:bio_tx 43 0 100.00% 65 0 100.00%
110bio.c:bio_prepare_hmac 18 0 100.00% 36 0 100.00% 110bio.c:bio_prepare_hmac 18 0 100.00% 36 0 100.00%
111bio.c:bio_rx_template_array 12 0 100.00% 21 0 100.00% 111bio.c:bio_rx_template_array 11 0 100.00% 21 0 100.00%
112bio.c:bio_parse_template_array 26 1 96.15% 34 4 88.24% 112bio.c:bio_parse_template_array 26 1 96.15% 34 4 88.24%
113bio.c:decode_template_array 12 1 91.67% 23 3 86.96% 113bio.c:decode_template_array 12 1 91.67% 23 3 86.96%
114bio.c:decode_template 9 0 100.00% 18 0 100.00% 114bio.c:decode_template 9 0 100.00% 18 0 100.00%
115bio.c:bio_set_template_name_wait 19 0 100.00% 24 0 100.00% 115bio.c:bio_set_template_name_wait 19 0 100.00% 24 0 100.00%
116bio.c:bio_enroll_begin_wait 17 1 94.12% 24 3 87.50% 116bio.c:bio_enroll_begin_wait 17 0 100.00% 24 0 100.00%
117bio.c:bio_rx_enroll_begin 16 0 100.00% 29 0 100.00% 117bio.c:bio_rx_enroll_begin 15 0 100.00% 29 0 100.00%
118bio.c:bio_parse_enroll_status 20 0 100.00% 31 0 100.00% 118bio.c:bio_parse_enroll_status 20 0 100.00% 31 0 100.00%
119bio.c:bio_parse_template_id 8 0 100.00% 12 0 100.00% 119bio.c:bio_parse_template_id 8 0 100.00% 12 0 100.00%
120bio.c:bio_enroll_continue_wait 19 0 100.00% 25 0 100.00% 120bio.c:bio_enroll_continue_wait 19 0 100.00% 25 0 100.00%
121bio.c:bio_rx_enroll_continue 12 0 100.00% 22 0 100.00% 121bio.c:bio_rx_enroll_continue 11 0 100.00% 22 0 100.00%
122bio.c:bio_enroll_cancel_wait 11 11 0.00% 12 12 0.00% 122bio.c:bio_enroll_cancel_wait 11 11 0.00% 12 12 0.00%
123bio.c:bio_enroll_remove_wait 17 0 100.00% 24 0 100.00% 123bio.c:bio_enroll_remove_wait 17 0 100.00% 24 0 100.00%
124bio.c:bio_get_info_wait 11 0 100.00% 11 0 100.00% 124bio.c:bio_get_info_wait 11 0 100.00% 11 0 100.00%
125bio.c:bio_rx_info 12 0 100.00% 21 0 100.00% 125bio.c:bio_rx_info 11 0 100.00% 21 0 100.00%
126bio.c:bio_reset_info 1 0 100.00% 4 0 100.00% 126bio.c:bio_reset_info 1 0 100.00% 4 0 100.00%
127bio.c:bio_parse_info 20 0 100.00% 31 0 100.00% 127bio.c:bio_parse_info 20 0 100.00% 31 0 100.00%
128bio.c:bio_reset_template_array 4 0 100.00% 8 0 100.00% 128bio.c:bio_reset_template_array 4 0 100.00% 8 0 100.00%
129bio.c:bio_reset_template 1 0 100.00% 6 0 100.00% 129bio.c:bio_reset_template 1 0 100.00% 6 0 100.00%
130bio.c:bio_reset_enroll 3 0 100.00% 7 0 100.00% 130bio.c:bio_reset_enroll 3 0 100.00% 7 0 100.00%
131--------------------------------------------------------------------------------------- 131---------------------------------------------------------------------------------------
132TOTAL 422 21 95.02% 661 25 96.22% 132TOTAL 418 20 95.22% 661 22 96.67%
133 133
134File '/home/pedro/projects/libfido2/src/blob.c': 134File '/libfido2/src/blob.c':
135Name Regions Miss Cover Lines Miss Cover 135Name Regions Miss Cover Lines Miss Cover
136--------------------------------------------------------------------------------------- 136---------------------------------------------------------------------------------------
137fido_blob_new 1 0 100.00% 3 0 100.00% 137fido_blob_new 1 0 100.00% 3 0 100.00%
@@ -144,7 +144,7 @@ fido_blob_is_empty 3 0 100.00% 3 0
144--------------------------------------------------------------------------------------- 144---------------------------------------------------------------------------------------
145TOTAL 39 1 97.44% 73 4 94.52% 145TOTAL 39 1 97.44% 73 4 94.52%
146 146
147File '/home/pedro/projects/libfido2/src/buf.c': 147File '/libfido2/src/buf.c':
148Name Regions Miss Cover Lines Miss Cover 148Name Regions Miss Cover Lines Miss Cover
149--------------------------------------------------------------------------------------- 149---------------------------------------------------------------------------------------
150fido_buf_read 4 0 100.00% 10 0 100.00% 150fido_buf_read 4 0 100.00% 10 0 100.00%
@@ -152,10 +152,10 @@ fido_buf_write 4 1 75.00% 10 1
152--------------------------------------------------------------------------------------- 152---------------------------------------------------------------------------------------
153TOTAL 8 1 87.50% 20 1 95.00% 153TOTAL 8 1 87.50% 20 1 95.00%
154 154
155File '/home/pedro/projects/libfido2/src/cbor.c': 155File '/libfido2/src/cbor.c':
156Name Regions Miss Cover Lines Miss Cover 156Name Regions Miss Cover Lines Miss Cover
157--------------------------------------------------------------------------------------- 157---------------------------------------------------------------------------------------
158cbor_map_iter 20 1 95.00% 30 4 86.67% 158cbor_map_iter 20 0 100.00% 30 0 100.00%
159cbor_array_iter 12 0 100.00% 20 0 100.00% 159cbor_array_iter 12 0 100.00% 20 0 100.00%
160cbor_parse_reply 27 0 100.00% 43 0 100.00% 160cbor_parse_reply 27 0 100.00% 43 0 100.00%
161cbor_vector_free 6 0 100.00% 5 0 100.00% 161cbor_vector_free 6 0 100.00% 5 0 100.00%
@@ -168,10 +168,10 @@ cbor_flatten_vector 14 1 92.86% 21 1
168cbor_build_frame 15 0 100.00% 32 0 100.00% 168cbor_build_frame 15 0 100.00% 32 0 100.00%
169cbor_encode_rp_entity 13 0 100.00% 14 0 100.00% 169cbor_encode_rp_entity 13 0 100.00% 14 0 100.00%
170cbor_encode_user_entity 21 0 100.00% 18 0 100.00% 170cbor_encode_user_entity 21 0 100.00% 18 0 100.00%
171cbor_encode_pubkey_param 36 0 100.00% 48 0 100.00% 171cbor_encode_pubkey_param 36 1 97.22% 48 0 100.00%
172cbor_encode_pubkey 10 0 100.00% 13 0 100.00% 172cbor_encode_pubkey 10 0 100.00% 13 0 100.00%
173cbor_encode_pubkey_list 18 2 88.89% 23 0 100.00% 173cbor_encode_pubkey_list 18 1 94.44% 23 0 100.00%
174cbor_encode_extensions 13 1 92.31% 16 0 100.00% 174cbor_encode_extensions 24 2 91.67% 26 3 88.46%
175cbor_encode_options 13 0 100.00% 14 0 100.00% 175cbor_encode_options 13 0 100.00% 14 0 100.00%
176cbor_encode_assert_options 13 0 100.00% 14 0 100.00% 176cbor_encode_assert_options 13 0 100.00% 14 0 100.00%
177cbor_encode_pin_auth 8 0 100.00% 12 0 100.00% 177cbor_encode_pin_auth 8 0 100.00% 12 0 100.00%
@@ -180,11 +180,11 @@ cbor_encode_pin_enc 4 0 100.00% 12 0
180cbor_encode_change_pin_auth 44 1 97.73% 69 3 95.65% 180cbor_encode_change_pin_auth 44 1 97.73% 69 3 95.65%
181cbor_encode_set_pin_auth 17 0 100.00% 28 0 100.00% 181cbor_encode_set_pin_auth 17 0 100.00% 28 0 100.00%
182cbor_encode_pin_hash_enc 15 0 100.00% 27 0 100.00% 182cbor_encode_pin_hash_enc 15 0 100.00% 27 0 100.00%
183cbor_encode_hmac_secret_param 41 1 97.56% 66 4 93.94% 183cbor_encode_hmac_secret_param 41 2 95.12% 66 9 86.36%
184cbor_decode_fmt 9 0 100.00% 18 0 100.00% 184cbor_decode_fmt 9 0 100.00% 18 0 100.00%
185cbor_decode_pubkey 21 1 95.24% 32 2 93.75% 185cbor_decode_pubkey 21 6 71.43% 32 7 78.12%
186cbor_decode_cred_authdata 31 0 100.00% 46 0 100.00% 186cbor_decode_cred_authdata 31 0 100.00% 47 0 100.00%
187cbor_decode_assert_authdata 23 0 100.00% 44 0 100.00% 187cbor_decode_assert_authdata 23 2 91.30% 44 2 95.45%
188cbor_decode_attstmt 8 0 100.00% 10 0 100.00% 188cbor_decode_attstmt 8 0 100.00% 10 0 100.00%
189cbor_decode_uint64 4 0 100.00% 10 0 100.00% 189cbor_decode_uint64 4 0 100.00% 10 0 100.00%
190cbor_decode_cred_id 8 0 100.00% 10 0 100.00% 190cbor_decode_cred_id 8 0 100.00% 10 0 100.00%
@@ -193,29 +193,30 @@ cbor_decode_rp_entity 8 0 100.00% 10 0
193cbor.c:ctap_check_cbor 28 0 100.00% 32 0 100.00% 193cbor.c:ctap_check_cbor 28 0 100.00% 32 0 100.00%
194cbor.c:check_key_type 8 0 100.00% 9 0 100.00% 194cbor.c:check_key_type 8 0 100.00% 9 0 100.00%
195cbor.c:cbor_add_arg 13 0 100.00% 28 0 100.00% 195cbor.c:cbor_add_arg 13 0 100.00% 28 0 100.00%
196cbor.c:cbor_add_uint8 14 1 92.86% 26 3 88.46%
196cbor.c:sha256 7 0 100.00% 15 0 100.00% 197cbor.c:sha256 7 0 100.00% 15 0 100.00%
197cbor.c:get_cose_alg 36 0 100.00% 48 0 100.00% 198cbor.c:get_cose_alg 36 6 83.33% 48 6 87.50%
198cbor.c:find_cose_alg 35 0 100.00% 40 0 100.00% 199cbor.c:find_cose_alg 35 0 100.00% 40 0 100.00%
199cbor.c:decode_attcred 25 0 100.00% 58 0 100.00% 200cbor.c:decode_attcred 25 0 100.00% 58 0 100.00%
200cbor.c:decode_extensions 16 4 75.00% 34 6 82.35% 201cbor.c:decode_extensions 14 9 35.71% 34 13 61.76%
201cbor.c:decode_extension 19 19 0.00% 27 27 0.00% 202cbor.c:decode_extension 27 27 0.00% 36 36 0.00%
202cbor.c:decode_hmac_secret 16 0 100.00% 32 0 100.00% 203cbor.c:decode_hmac_secret 16 4 75.00% 32 6 81.25%
203cbor.c:decode_hmac_secret_aux 7 0 100.00% 17 0 100.00% 204cbor.c:decode_hmac_secret_aux 7 7 0.00% 17 17 0.00%
204cbor.c:decode_attstmt_entry 29 0 100.00% 39 0 100.00% 205cbor.c:decode_attstmt_entry 38 0 100.00% 45 0 100.00%
205cbor.c:decode_x5c 4 0 100.00% 8 0 100.00% 206cbor.c:decode_x5c 4 0 100.00% 8 0 100.00%
206cbor.c:decode_cred_id_entry 10 0 100.00% 23 0 100.00% 207cbor.c:decode_cred_id_entry 10 0 100.00% 23 0 100.00%
207cbor.c:decode_user_entry 25 0 100.00% 39 0 100.00% 208cbor.c:decode_user_entry 25 0 100.00% 39 0 100.00%
208cbor.c:decode_rp_entity_entry 15 0 100.00% 29 0 100.00% 209cbor.c:decode_rp_entity_entry 15 0 100.00% 29 0 100.00%
209--------------------------------------------------------------------------------------- 210---------------------------------------------------------------------------------------
210TOTAL 844 31 96.33% 1319 47 96.44% 211TOTAL 884 70 92.08% 1371 106 92.27%
211 212
212File '/home/pedro/projects/libfido2/src/cred.c': 213File '/libfido2/src/cred.c':
213Name Regions Miss Cover Lines Miss Cover 214Name Regions Miss Cover Lines Miss Cover
214--------------------------------------------------------------------------------------- 215---------------------------------------------------------------------------------------
215fido_dev_make_cred 12 0 100.00% 9 0 100.00% 216fido_dev_make_cred 12 0 100.00% 10 0 100.00%
216fido_check_rp_id 4 0 100.00% 14 0 100.00% 217fido_check_rp_id 4 0 100.00% 14 0 100.00%
217fido_cred_verify 45 0 100.00% 71 0 100.00% 218fido_cred_verify 46 6 86.96% 71 11 84.51%
218fido_cred_verify_self 54 10 81.48% 90 14 84.44% 219fido_cred_verify_self 54 14 74.07% 90 22 75.56%
219fido_cred_new 1 0 100.00% 3 0 100.00% 220fido_cred_new 1 0 100.00% 3 0 100.00%
220fido_cred_reset_tx 1 0 100.00% 20 0 100.00% 221fido_cred_reset_tx 1 0 100.00% 20 0 100.00%
221fido_cred_reset_rx 1 0 100.00% 8 0 100.00% 222fido_cred_reset_rx 1 0 100.00% 8 0 100.00%
@@ -228,10 +229,11 @@ fido_cred_exclude 14 2 85.71% 25 3
228fido_cred_set_clientdata_hash 6 0 100.00% 6 0 100.00% 229fido_cred_set_clientdata_hash 6 0 100.00% 6 0 100.00%
229fido_cred_set_rp 18 2 88.89% 26 6 76.92% 230fido_cred_set_rp 18 2 88.89% 26 6 76.92%
230fido_cred_set_user 33 4 87.88% 50 13 74.00% 231fido_cred_set_user 33 4 87.88% 50 13 74.00%
231fido_cred_set_extensions 9 0 100.00% 8 0 100.00% 232fido_cred_set_extensions 15 0 100.00% 12 0 100.00%
232fido_cred_set_options 6 6 0.00% 6 6 0.00% 233fido_cred_set_options 6 6 0.00% 6 6 0.00%
233fido_cred_set_rk 2 0 100.00% 5 0 100.00% 234fido_cred_set_rk 2 0 100.00% 5 0 100.00%
234fido_cred_set_uv 2 0 100.00% 5 0 100.00% 235fido_cred_set_uv 2 0 100.00% 5 0 100.00%
236fido_cred_set_prot 21 2 90.48% 16 0 100.00%
235fido_cred_set_fmt 16 4 75.00% 15 1 93.33% 237fido_cred_set_fmt 16 4 75.00% 15 1 93.33%
236fido_cred_set_type 17 2 88.24% 9 1 88.89% 238fido_cred_set_type 17 2 88.24% 9 1 88.89%
237fido_cred_type 1 0 100.00% 3 0 100.00% 239fido_cred_type 1 0 100.00% 3 0 100.00%
@@ -244,10 +246,11 @@ fido_cred_sig_ptr 1 0 100.00% 3 0
244fido_cred_sig_len 1 0 100.00% 3 0 100.00% 246fido_cred_sig_len 1 0 100.00% 3 0 100.00%
245fido_cred_authdata_ptr 1 0 100.00% 3 0 100.00% 247fido_cred_authdata_ptr 1 0 100.00% 3 0 100.00%
246fido_cred_authdata_len 1 0 100.00% 3 0 100.00% 248fido_cred_authdata_len 1 0 100.00% 3 0 100.00%
247fido_cred_pubkey_ptr 9 0 100.00% 20 0 100.00% 249fido_cred_pubkey_ptr 9 2 77.78% 20 2 90.00%
248fido_cred_pubkey_len 9 0 100.00% 20 0 100.00% 250fido_cred_pubkey_len 9 2 77.78% 20 2 90.00%
249fido_cred_id_ptr 1 0 100.00% 3 0 100.00% 251fido_cred_id_ptr 1 0 100.00% 3 0 100.00%
250fido_cred_id_len 1 0 100.00% 3 0 100.00% 252fido_cred_id_len 1 0 100.00% 3 0 100.00%
253fido_cred_prot 1 0 100.00% 3 0 100.00%
251fido_cred_fmt 1 0 100.00% 3 0 100.00% 254fido_cred_fmt 1 0 100.00% 3 0 100.00%
252fido_cred_rp_id 1 0 100.00% 3 0 100.00% 255fido_cred_rp_id 1 0 100.00% 3 0 100.00%
253fido_cred_rp_name 1 0 100.00% 3 0 100.00% 256fido_cred_rp_name 1 0 100.00% 3 0 100.00%
@@ -257,19 +260,18 @@ fido_cred_user_id_ptr 1 0 100.00% 3 0
257fido_cred_user_id_len 1 0 100.00% 3 0 100.00% 260fido_cred_user_id_len 1 0 100.00% 3 0 100.00%
258cred.c:fido_dev_make_cred_wait 10 0 100.00% 9 0 100.00% 261cred.c:fido_dev_make_cred_wait 10 0 100.00% 9 0 100.00%
259cred.c:fido_dev_make_cred_tx 59 0 100.00% 81 0 100.00% 262cred.c:fido_dev_make_cred_tx 59 0 100.00% 81 0 100.00%
260cred.c:fido_dev_make_cred_rx 22 0 100.00% 28 0 100.00% 263cred.c:fido_dev_make_cred_rx 21 0 100.00% 28 0 100.00%
261cred.c:parse_makecred_reply 10 0 100.00% 23 0 100.00% 264cred.c:parse_makecred_reply 10 0 100.00% 23 0 100.00%
262cred.c:check_extensions 4 0 100.00% 9 0 100.00% 265cred.c:check_extensions 1 0 100.00% 3 0 100.00%
263cred.c:get_signed_hash_packed 23 1 95.65% 38 3 92.11%
264cred.c:get_signed_hash_u2f 22 0 100.00% 20 0 100.00% 266cred.c:get_signed_hash_u2f 22 0 100.00% 20 0 100.00%
265cred.c:verify_sig 27 1 96.30% 40 4 90.00% 267cred.c:verify_sig 27 2 92.59% 40 7 82.50%
266cred.c:fido_cred_clean_authdata 1 0 100.00% 9 0 100.00% 268cred.c:fido_cred_clean_authdata 1 0 100.00% 9 0 100.00%
267cred.c:fido_cred_clean_x509 1 0 100.00% 5 0 100.00% 269cred.c:fido_cred_clean_x509 1 0 100.00% 5 0 100.00%
268cred.c:fido_cred_clean_sig 1 0 100.00% 5 0 100.00% 270cred.c:fido_cred_clean_sig 1 0 100.00% 5 0 100.00%
269--------------------------------------------------------------------------------------- 271---------------------------------------------------------------------------------------
270TOTAL 532 35 93.42% 850 55 93.53% 272TOTAL 534 51 90.45% 830 78 90.60%
271 273
272File '/home/pedro/projects/libfido2/src/credman.c': 274File '/libfido2/src/credman.c':
273Name Regions Miss Cover Lines Miss Cover 275Name Regions Miss Cover Lines Miss Cover
274--------------------------------------------------------------------------------------- 276---------------------------------------------------------------------------------------
275fido_credman_get_dev_metadata 9 2 77.78% 8 0 100.00% 277fido_credman_get_dev_metadata 9 2 77.78% 8 0 100.00%
@@ -294,35 +296,41 @@ fido_credman_rp_id_hash_ptr 4 0 100.00% 6 0
294credman.c:credman_get_metadata_wait 11 0 100.00% 9 0 100.00% 296credman.c:credman_get_metadata_wait 11 0 100.00% 9 0 100.00%
295credman.c:credman_tx 30 0 100.00% 53 0 100.00% 297credman.c:credman_tx 30 0 100.00% 53 0 100.00%
296credman.c:credman_prepare_hmac 21 1 95.24% 43 2 95.35% 298credman.c:credman_prepare_hmac 21 1 95.24% 43 2 95.35%
297credman.c:credman_rx_metadata 12 0 100.00% 21 0 100.00% 299credman.c:credman_rx_metadata 11 0 100.00% 21 0 100.00%
298credman.c:credman_parse_metadata 9 0 100.00% 19 0 100.00% 300credman.c:credman_parse_metadata 9 0 100.00% 19 0 100.00%
299credman.c:credman_get_rk_wait 27 0 100.00% 26 0 100.00% 301credman.c:credman_get_rk_wait 27 0 100.00% 26 0 100.00%
300credman.c:credman_rx_rk 20 0 100.00% 36 0 100.00% 302credman.c:credman_rx_rk 19 0 100.00% 36 0 100.00%
301credman.c:credman_parse_rk_count 16 0 100.00% 25 0 100.00% 303credman.c:credman_parse_rk_count 16 0 100.00% 25 0 100.00%
302credman.c:credman_grow_array 17 2 88.24% 28 5 82.14% 304credman.c:credman_grow_array 17 2 88.24% 28 5 82.14%
303credman.c:credman_parse_rk 13 0 100.00% 25 0 100.00% 305credman.c:credman_parse_rk 13 0 100.00% 25 0 100.00%
304credman.c:credman_rx_next_rk 16 2 87.50% 26 4 84.62% 306credman.c:credman_rx_next_rk 15 2 86.67% 26 4 84.62%
305credman.c:credman_del_rk_wait 16 0 100.00% 19 0 100.00% 307credman.c:credman_del_rk_wait 16 0 100.00% 19 0 100.00%
306credman.c:credman_get_rp_wait 23 0 100.00% 16 0 100.00% 308credman.c:credman_get_rp_wait 23 0 100.00% 16 0 100.00%
307credman.c:credman_rx_rp 20 0 100.00% 36 0 100.00% 309credman.c:credman_rx_rp 19 0 100.00% 36 0 100.00%
308credman.c:credman_parse_rp_count 16 0 100.00% 25 0 100.00% 310credman.c:credman_parse_rp_count 16 0 100.00% 25 0 100.00%
309credman.c:credman_parse_rp 9 0 100.00% 19 0 100.00% 311credman.c:credman_parse_rp 9 0 100.00% 19 0 100.00%
310credman.c:credman_rx_next_rp 16 2 87.50% 26 4 84.62% 312credman.c:credman_rx_next_rp 15 2 86.67% 26 4 84.62%
311credman.c:credman_reset_rk 4 0 100.00% 10 0 100.00% 313credman.c:credman_reset_rk 4 0 100.00% 10 0 100.00%
312credman.c:credman_reset_rp 4 0 100.00% 15 0 100.00% 314credman.c:credman_reset_rp 4 0 100.00% 15 0 100.00%
313--------------------------------------------------------------------------------------- 315---------------------------------------------------------------------------------------
314TOTAL 381 18 95.28% 589 15 97.45% 316TOTAL 376 18 95.21% 589 15 97.45%
315 317
316File '/home/pedro/projects/libfido2/src/dev.c': 318File '/libfido2/src/dev.c':
317Name Regions Miss Cover Lines Miss Cover 319Name Regions Miss Cover Lines Miss Cover
318--------------------------------------------------------------------------------------- 320---------------------------------------------------------------------------------------
321fido_dev_register_manifest_func 10 10 0.00% 18 18 0.00%
322fido_dev_unregister_manifest_func 7 7 0.00% 13 13 0.00%
323fido_dev_info_manifest 17 17 0.00% 24 24 0.00%
324fido_dev_open_with_info 5 5 0.00% 6 6 0.00%
319fido_dev_open 1 0 100.00% 3 0 100.00% 325fido_dev_open 1 0 100.00% 3 0 100.00%
320fido_dev_close 8 2 75.00% 9 0 100.00% 326fido_dev_close 8 2 75.00% 9 0 100.00%
321fido_dev_cancel 8 2 75.00% 6 3 50.00% 327fido_dev_cancel 7 0 100.00% 6 0 100.00%
322fido_dev_set_io_functions 18 4 77.78% 19 6 68.42% 328fido_dev_set_io_functions 18 4 77.78% 16 6 62.50%
329fido_dev_set_transport_functions 6 6 0.00% 10 10 0.00%
323fido_init 7 1 85.71% 4 0 100.00% 330fido_init 7 1 85.71% 4 0 100.00%
324fido_dev_new 9 1 88.89% 22 4 81.82% 331fido_dev_new 5 0 100.00% 16 0 100.00%
325fido_dev_free 6 0 100.00% 10 0 100.00% 332fido_dev_new_with_info 17 17 0.00% 26 26 0.00%
333fido_dev_free 6 0 100.00% 11 0 100.00%
326fido_dev_protocol 1 0 100.00% 3 0 100.00% 334fido_dev_protocol 1 0 100.00% 3 0 100.00%
327fido_dev_major 1 0 100.00% 3 0 100.00% 335fido_dev_major 1 0 100.00% 3 0 100.00%
328fido_dev_minor 1 0 100.00% 3 0 100.00% 336fido_dev_minor 1 0 100.00% 3 0 100.00%
@@ -331,14 +339,15 @@ fido_dev_flags 1 0 100.00% 3 0
331fido_dev_is_fido2 2 0 100.00% 3 0 100.00% 339fido_dev_is_fido2 2 0 100.00% 3 0 100.00%
332fido_dev_force_u2f 2 0 100.00% 3 0 100.00% 340fido_dev_force_u2f 2 0 100.00% 3 0 100.00%
333fido_dev_force_fido2 2 2 0.00% 3 3 0.00% 341fido_dev_force_fido2 2 2 0.00% 3 3 0.00%
342dev.c:find_manifest_func_node 5 5 0.00% 9 9 0.00%
334dev.c:fido_dev_open_wait 10 0 100.00% 9 0 100.00% 343dev.c:fido_dev_open_wait 10 0 100.00% 9 0 100.00%
335dev.c:fido_dev_open_tx 26 8 69.23% 32 12 62.50% 344dev.c:fido_dev_open_tx 25 8 68.00% 32 12 62.50%
336dev.c:obtain_nonce 13 2 84.62% 18 2 88.89% 345dev.c:obtain_nonce 4 1 75.00% 5 1 80.00%
337dev.c:fido_dev_open_rx 14 0 100.00% 27 0 100.00% 346dev.c:fido_dev_open_rx 32 0 100.00% 53 0 100.00%
338--------------------------------------------------------------------------------------- 347---------------------------------------------------------------------------------------
339TOTAL 131 22 83.21% 183 30 83.61% 348TOTAL 201 85 57.71% 294 128 56.46%
340 349
341File '/home/pedro/projects/libfido2/src/ecdh.c': 350File '/libfido2/src/ecdh.c':
342Name Regions Miss Cover Lines Miss Cover 351Name Regions Miss Cover Lines Miss Cover
343--------------------------------------------------------------------------------------- 352---------------------------------------------------------------------------------------
344fido_do_ecdh 29 0 100.00% 44 0 100.00% 353fido_do_ecdh 29 0 100.00% 44 0 100.00%
@@ -346,7 +355,7 @@ ecdh.c:do_ecdh 39 0 100.00% 60 0
346--------------------------------------------------------------------------------------- 355---------------------------------------------------------------------------------------
347TOTAL 68 0 100.00% 104 0 100.00% 356TOTAL 68 0 100.00% 104 0 100.00%
348 357
349File '/home/pedro/projects/libfido2/src/eddsa.c': 358File '/libfido2/src/eddsa.c':
350Name Regions Miss Cover Lines Miss Cover 359Name Regions Miss Cover Lines Miss Cover
351--------------------------------------------------------------------------------------- 360---------------------------------------------------------------------------------------
352eddsa_pk_decode 8 0 100.00% 10 0 100.00% 361eddsa_pk_decode 8 0 100.00% 10 0 100.00%
@@ -354,20 +363,20 @@ eddsa_pk_new 1 0 100.00% 3 0
354eddsa_pk_free 6 0 100.00% 11 0 100.00% 363eddsa_pk_free 6 0 100.00% 11 0 100.00%
355eddsa_pk_from_ptr 6 0 100.00% 8 0 100.00% 364eddsa_pk_from_ptr 6 0 100.00% 8 0 100.00%
356eddsa_pk_to_EVP_PKEY 3 0 100.00% 9 0 100.00% 365eddsa_pk_to_EVP_PKEY 3 0 100.00% 9 0 100.00%
357eddsa_pk_from_EVP_PKEY 14 4 71.43% 12 2 83.33% 366eddsa_pk_from_EVP_PKEY 14 0 100.00% 12 0 100.00%
358eddsa.c:decode_pubkey_point 8 0 100.00% 14 0 100.00% 367eddsa.c:decode_pubkey_point 8 0 100.00% 14 0 100.00%
359eddsa.c:decode_coord 8 0 100.00% 12 0 100.00% 368eddsa.c:decode_coord 8 0 100.00% 12 0 100.00%
360--------------------------------------------------------------------------------------- 369---------------------------------------------------------------------------------------
361TOTAL 54 4 92.59% 79 2 97.47% 370TOTAL 54 0 100.00% 79 0 100.00%
362 371
363File '/home/pedro/projects/libfido2/src/err.c': 372File '/libfido2/src/err.c':
364Name Regions Miss Cover Lines Miss Cover 373Name Regions Miss Cover Lines Miss Cover
365--------------------------------------------------------------------------------------- 374---------------------------------------------------------------------------------------
366fido_strerr 108 108 0.00% 112 112 0.00% 375fido_strerr 108 108 0.00% 112 112 0.00%
367--------------------------------------------------------------------------------------- 376---------------------------------------------------------------------------------------
368TOTAL 108 108 0.00% 112 112 0.00% 377TOTAL 108 108 0.00% 112 112 0.00%
369 378
370File '/home/pedro/projects/libfido2/src/es256.c': 379File '/libfido2/src/es256.c':
371Name Regions Miss Cover Lines Miss Cover 380Name Regions Miss Cover Lines Miss Cover
372--------------------------------------------------------------------------------------- 381---------------------------------------------------------------------------------------
373es256_pk_decode 8 0 100.00% 10 0 100.00% 382es256_pk_decode 8 0 100.00% 10 0 100.00%
@@ -376,28 +385,28 @@ es256_sk_new 1 0 100.00% 3 0
376es256_sk_free 6 0 100.00% 11 0 100.00% 385es256_sk_free 6 0 100.00% 11 0 100.00%
377es256_pk_new 1 0 100.00% 3 0 100.00% 386es256_pk_new 1 0 100.00% 3 0 100.00%
378es256_pk_free 6 0 100.00% 11 0 100.00% 387es256_pk_free 6 0 100.00% 11 0 100.00%
379es256_pk_from_ptr 6 0 100.00% 8 0 100.00% 388es256_pk_from_ptr 11 0 100.00% 13 0 100.00%
380es256_pk_set_x 1 0 100.00% 5 0 100.00% 389es256_pk_set_x 1 0 100.00% 5 0 100.00%
381es256_pk_set_y 1 0 100.00% 5 0 100.00% 390es256_pk_set_y 1 0 100.00% 5 0 100.00%
382es256_sk_create 39 2 94.87% 46 6 86.96% 391es256_sk_create 39 0 100.00% 46 0 100.00%
383es256_pk_to_EVP_PKEY 41 0 100.00% 58 0 100.00% 392es256_pk_to_EVP_PKEY 41 0 100.00% 58 0 100.00%
384es256_pk_from_EC_KEY 38 2 94.74% 39 7 82.05% 393es256_pk_from_EC_KEY 38 0 100.00% 39 0 100.00%
385es256_sk_to_EVP_PKEY 27 0 100.00% 41 0 100.00% 394es256_sk_to_EVP_PKEY 27 0 100.00% 41 0 100.00%
386es256_derive_pk 25 0 100.00% 34 0 100.00% 395es256_derive_pk 25 0 100.00% 34 0 100.00%
387es256.c:decode_pubkey_point 9 0 100.00% 16 0 100.00% 396es256.c:decode_pubkey_point 9 0 100.00% 16 0 100.00%
388es256.c:decode_coord 8 0 100.00% 12 0 100.00% 397es256.c:decode_coord 8 0 100.00% 12 0 100.00%
389--------------------------------------------------------------------------------------- 398---------------------------------------------------------------------------------------
390TOTAL 273 4 98.53% 372 13 96.51% 399TOTAL 278 0 100.00% 377 0 100.00%
391 400
392File '/home/pedro/projects/libfido2/src/extern.h': 401File '/libfido2/src/extern.h':
393Name Regions Miss Cover Lines Miss Cover 402Name Regions Miss Cover Lines Miss Cover
394--------------------------------------------------------------------------------------- 403---------------------------------------------------------------------------------------
395 404
396File '/home/pedro/projects/libfido2/src/fido.h': 405File '/libfido2/src/fido.h':
397Name Regions Miss Cover Lines Miss Cover 406Name Regions Miss Cover Lines Miss Cover
398--------------------------------------------------------------------------------------- 407---------------------------------------------------------------------------------------
399 408
400File '/home/pedro/projects/libfido2/src/hid.c': 409File '/libfido2/src/hid.c':
401Name Regions Miss Cover Lines Miss Cover 410Name Regions Miss Cover Lines Miss Cover
402--------------------------------------------------------------------------------------- 411---------------------------------------------------------------------------------------
403fido_dev_info_new 1 1 0.00% 3 3 0.00% 412fido_dev_info_new 1 1 0.00% 3 3 0.00%
@@ -411,30 +420,31 @@ fido_dev_info_product_string 1 1 0.00% 3 3
411--------------------------------------------------------------------------------------- 420---------------------------------------------------------------------------------------
412TOTAL 16 16 0.00% 38 38 0.00% 421TOTAL 16 16 0.00% 38 38 0.00%
413 422
414File '/home/pedro/projects/libfido2/src/hid_linux.c': 423File '/libfido2/src/hid_linux.c':
415Name Regions Miss Cover Lines Miss Cover 424Name Regions Miss Cover Lines Miss Cover
416--------------------------------------------------------------------------------------- 425---------------------------------------------------------------------------------------
417fido_dev_info_manifest 33 33 0.00% 40 40 0.00% 426fido_hid_manifest 33 33 0.00% 46 46 0.00%
418fido_hid_open 6 6 0.00% 11 11 0.00% 427fido_hid_open 6 6 0.00% 11 11 0.00%
419fido_hid_close 1 1 0.00% 6 6 0.00% 428fido_hid_close 1 1 0.00% 6 6 0.00%
420fido_hid_read 12 12 0.00% 16 16 0.00% 429fido_hid_read 12 12 0.00% 16 16 0.00%
421fido_hid_write 12 12 0.00% 16 16 0.00% 430fido_hid_write 12 12 0.00% 16 16 0.00%
422hid_linux.c:copy_info 35 35 0.00% 56 56 0.00% 431hid_linux.c:copy_info 35 35 0.00% 56 56 0.00%
423hid_linux.c:is_fido 6 6 0.00% 14 14 0.00% 432hid_linux.c:is_fido 6 6 0.00% 14 14 0.00%
424hid_linux.c:get_report_descriptor 17 17 0.00% 31 31 0.00% 433hid_linux.c:get_report_descriptor 17 17 0.00% 30 30 0.00%
425hid_linux.c:get_usage_info 16 16 0.00% 33 33 0.00% 434hid_linux.c:get_usage_info 16 16 0.00% 33 33 0.00%
426hid_linux.c:get_key_len 6 6 0.00% 14 14 0.00% 435hid_linux.c:get_key_len 6 6 0.00% 14 14 0.00%
427hid_linux.c:get_key_val 6 6 0.00% 20 20 0.00% 436hid_linux.c:get_key_val 6 6 0.00% 20 20 0.00%
428hid_linux.c:parse_uevent 16 16 0.00% 30 30 0.00% 437hid_linux.c:parse_uevent 16 16 0.00% 30 30 0.00%
429--------------------------------------------------------------------------------------- 438---------------------------------------------------------------------------------------
430TOTAL 166 166 0.00% 287 287 0.00% 439TOTAL 166 166 0.00% 292 292 0.00%
431 440
432File '/home/pedro/projects/libfido2/src/info.c': 441File '/libfido2/src/info.c':
433Name Regions Miss Cover Lines Miss Cover 442Name Regions Miss Cover Lines Miss Cover
434--------------------------------------------------------------------------------------- 443---------------------------------------------------------------------------------------
444fido_dev_get_cbor_info_wait 10 0 100.00% 9 0 100.00%
435fido_dev_get_cbor_info 1 0 100.00% 3 0 100.00% 445fido_dev_get_cbor_info 1 0 100.00% 3 0 100.00%
436fido_cbor_info_new 1 0 100.00% 3 0 100.00% 446fido_cbor_info_new 1 0 100.00% 3 0 100.00%
437fido_cbor_info_free 6 1 83.33% 14 0 100.00% 447fido_cbor_info_free 6 0 100.00% 14 0 100.00%
438fido_cbor_info_versions_ptr 1 0 100.00% 3 0 100.00% 448fido_cbor_info_versions_ptr 1 0 100.00% 3 0 100.00%
439fido_cbor_info_versions_len 1 0 100.00% 3 0 100.00% 449fido_cbor_info_versions_len 1 0 100.00% 3 0 100.00%
440fido_cbor_info_extensions_ptr 1 0 100.00% 3 0 100.00% 450fido_cbor_info_extensions_ptr 1 0 100.00% 3 0 100.00%
@@ -447,9 +457,8 @@ fido_cbor_info_options_len 1 0 100.00% 3 0
447fido_cbor_info_maxmsgsiz 1 0 100.00% 3 0 100.00% 457fido_cbor_info_maxmsgsiz 1 0 100.00% 3 0 100.00%
448fido_cbor_info_protocols_ptr 1 0 100.00% 3 0 100.00% 458fido_cbor_info_protocols_ptr 1 0 100.00% 3 0 100.00%
449fido_cbor_info_protocols_len 1 0 100.00% 3 0 100.00% 459fido_cbor_info_protocols_len 1 0 100.00% 3 0 100.00%
450info.c:fido_dev_get_cbor_info_wait 10 0 100.00% 9 0 100.00% 460info.c:fido_dev_get_cbor_info_tx 8 0 100.00% 12 0 100.00%
451info.c:fido_dev_get_cbor_info_tx 9 0 100.00% 13 0 100.00% 461info.c:fido_dev_get_cbor_info_rx 6 0 100.00% 18 0 100.00%
452info.c:fido_dev_get_cbor_info_rx 7 0 100.00% 18 0 100.00%
453info.c:parse_reply_element 13 0 100.00% 27 0 100.00% 462info.c:parse_reply_element 13 0 100.00% 27 0 100.00%
454info.c:decode_versions 12 0 100.00% 21 0 100.00% 463info.c:decode_versions 12 0 100.00% 21 0 100.00%
455info.c:decode_version 4 0 100.00% 14 0 100.00% 464info.c:decode_version 4 0 100.00% 14 0 100.00%
@@ -464,22 +473,25 @@ info.c:free_str_array 4 0 100.00% 8 0
464info.c:free_opt_array 4 0 100.00% 9 0 100.00% 473info.c:free_opt_array 4 0 100.00% 9 0 100.00%
465info.c:free_byte_array 1 0 100.00% 6 0 100.00% 474info.c:free_byte_array 1 0 100.00% 6 0 100.00%
466--------------------------------------------------------------------------------------- 475---------------------------------------------------------------------------------------
467TOTAL 148 1 99.32% 305 0 100.00% 476TOTAL 146 0 100.00% 304 0 100.00%
468 477
469File '/home/pedro/projects/libfido2/src/io.c': 478File '/libfido2/src/io.c':
470Name Regions Miss Cover Lines Miss Cover 479Name Regions Miss Cover Lines Miss Cover
471--------------------------------------------------------------------------------------- 480---------------------------------------------------------------------------------------
472fido_tx 18 0 100.00% 35 0 100.00% 481fido_tx 14 1 92.86% 18 0 100.00%
473fido_rx 34 3 91.18% 84 12 85.71% 482fido_rx 13 2 84.62% 21 3 85.71%
474fido_rx_cbor_status 9 0 100.00% 13 0 100.00% 483fido_rx_cbor_status 8 0 100.00% 12 0 100.00%
475io.c:tx_preamble 16 1 93.75% 24 1 95.83% 484io.c:tx_empty 7 0 100.00% 16 0 100.00%
476io.c:tx_frame 16 1 93.75% 21 0 100.00% 485io.c:tx 13 0 100.00% 21 0 100.00%
477io.c:rx_preamble 11 0 100.00% 12 0 100.00% 486io.c:tx_preamble 10 0 100.00% 20 0 100.00%
478io.c:rx_frame 9 1 88.89% 12 0 100.00% 487io.c:tx_frame 9 0 100.00% 18 0 100.00%
479--------------------------------------------------------------------------------------- 488io.c:rx 25 1 96.00% 58 4 93.10%
480TOTAL 113 6 94.69% 201 13 93.53% 489io.c:rx_preamble 18 1 94.44% 25 4 84.00%
490io.c:rx_frame 6 0 100.00% 9 0 100.00%
491---------------------------------------------------------------------------------------
492TOTAL 123 5 95.93% 218 11 94.95%
481 493
482File '/home/pedro/projects/libfido2/src/iso7816.c': 494File '/libfido2/src/iso7816.c':
483Name Regions Miss Cover Lines Miss Cover 495Name Regions Miss Cover Lines Miss Cover
484--------------------------------------------------------------------------------------- 496---------------------------------------------------------------------------------------
485iso7816_new 4 0 100.00% 19 0 100.00% 497iso7816_new 4 0 100.00% 19 0 100.00%
@@ -490,25 +502,27 @@ iso7816_len 1 0 100.00% 4 0
490--------------------------------------------------------------------------------------- 502---------------------------------------------------------------------------------------
491TOTAL 18 1 94.44% 47 0 100.00% 503TOTAL 18 1 94.44% 47 0 100.00%
492 504
493File '/home/pedro/projects/libfido2/src/log.c': 505File '/libfido2/src/log.c':
494Name Regions Miss Cover Lines Miss Cover 506Name Regions Miss Cover Lines Miss Cover
495--------------------------------------------------------------------------------------- 507---------------------------------------------------------------------------------------
496fido_log_init 1 1 0.00% 3 3 0.00% 508fido_log_init 1 0 100.00% 4 0 100.00%
497fido_log_xxd 11 8 27.27% 18 12 33.33% 509fido_log_debug 11 1 90.91% 16 0 100.00%
498fido_log_debug 4 1 75.00% 13 8 38.46% 510fido_log_xxd 18 0 100.00% 23 0 100.00%
511fido_set_log_handler 3 0 100.00% 4 0 100.00%
512log.c:log_on_stderr 1 1 0.00% 3 3 0.00%
499--------------------------------------------------------------------------------------- 513---------------------------------------------------------------------------------------
500TOTAL 16 10 37.50% 34 23 32.35% 514TOTAL 34 2 94.12% 50 3 94.00%
501 515
502File '/home/pedro/projects/libfido2/src/pin.c': 516File '/libfido2/src/pin.c':
503Name Regions Miss Cover Lines Miss Cover 517Name Regions Miss Cover Lines Miss Cover
504--------------------------------------------------------------------------------------- 518---------------------------------------------------------------------------------------
505fido_dev_get_pin_token 1 0 100.00% 3 0 100.00% 519fido_dev_get_pin_token 1 0 100.00% 3 0 100.00%
506fido_dev_set_pin 1 0 100.00% 3 0 100.00% 520fido_dev_set_pin 1 0 100.00% 3 0 100.00%
507fido_dev_get_retry_count 1 0 100.00% 3 0 100.00% 521fido_dev_get_retry_count 1 0 100.00% 3 0 100.00%
508cbor_add_pin_params 17 0 100.00% 27 0 100.00% 522cbor_add_pin_params 17 0 100.00% 27 0 100.00%
509pin.c:fido_dev_get_pin_token_wait 10 0 100.00% 9 0 100.00% 523pin.c:fido_dev_get_pin_token_wait 10 0 100.00% 10 0 100.00%
510pin.c:fido_dev_get_pin_token_tx 29 0 100.00% 40 0 100.00% 524pin.c:fido_dev_get_pin_token_tx 29 0 100.00% 40 0 100.00%
511pin.c:fido_dev_get_pin_token_rx 21 0 100.00% 36 0 100.00% 525pin.c:fido_dev_get_pin_token_rx 20 0 100.00% 36 0 100.00%
512pin.c:parse_pintoken 8 0 100.00% 12 0 100.00% 526pin.c:parse_pintoken 8 0 100.00% 12 0 100.00%
513pin.c:fido_dev_set_pin_wait 16 0 100.00% 22 0 100.00% 527pin.c:fido_dev_set_pin_wait 16 0 100.00% 22 0 100.00%
514pin.c:fido_dev_change_pin_tx 41 0 100.00% 59 0 100.00% 528pin.c:fido_dev_change_pin_tx 41 0 100.00% 59 0 100.00%
@@ -516,49 +530,49 @@ pin.c:pad64 18 0 100.00% 24 0
516pin.c:fido_dev_set_pin_tx 33 0 100.00% 48 0 100.00% 530pin.c:fido_dev_set_pin_tx 33 0 100.00% 48 0 100.00%
517pin.c:fido_dev_get_retry_count_wait 10 0 100.00% 9 0 100.00% 531pin.c:fido_dev_get_retry_count_wait 10 0 100.00% 9 0 100.00%
518pin.c:fido_dev_get_retry_count_tx 19 0 100.00% 28 0 100.00% 532pin.c:fido_dev_get_retry_count_tx 19 0 100.00% 28 0 100.00%
519pin.c:fido_dev_get_retry_count_rx 12 0 100.00% 21 0 100.00% 533pin.c:fido_dev_get_retry_count_rx 11 0 100.00% 21 0 100.00%
520pin.c:parse_retry_count 13 0 100.00% 20 0 100.00% 534pin.c:parse_retry_count 13 0 100.00% 20 0 100.00%
521--------------------------------------------------------------------------------------- 535---------------------------------------------------------------------------------------
522TOTAL 250 0 100.00% 364 0 100.00% 536TOTAL 248 0 100.00% 365 0 100.00%
523 537
524File '/home/pedro/projects/libfido2/src/reset.c': 538File '/libfido2/src/reset.c':
525Name Regions Miss Cover Lines Miss Cover 539Name Regions Miss Cover Lines Miss Cover
526--------------------------------------------------------------------------------------- 540---------------------------------------------------------------------------------------
527fido_dev_reset 1 0 100.00% 3 0 100.00% 541fido_dev_reset 1 0 100.00% 3 0 100.00%
528reset.c:fido_dev_reset_wait 10 0 100.00% 9 0 100.00% 542reset.c:fido_dev_reset_wait 10 0 100.00% 9 0 100.00%
529reset.c:fido_dev_reset_tx 9 0 100.00% 11 0 100.00% 543reset.c:fido_dev_reset_tx 8 0 100.00% 10 0 100.00%
530--------------------------------------------------------------------------------------- 544---------------------------------------------------------------------------------------
531TOTAL 20 0 100.00% 23 0 100.00% 545TOTAL 19 0 100.00% 22 0 100.00%
532 546
533File '/home/pedro/projects/libfido2/src/rs256.c': 547File '/libfido2/src/rs256.c':
534Name Regions Miss Cover Lines Miss Cover 548Name Regions Miss Cover Lines Miss Cover
535--------------------------------------------------------------------------------------- 549---------------------------------------------------------------------------------------
536rs256_pk_decode 8 0 100.00% 10 0 100.00% 550rs256_pk_decode 8 8 0.00% 10 10 0.00%
537rs256_pk_new 1 0 100.00% 3 0 100.00% 551rs256_pk_new 1 0 100.00% 3 0 100.00%
538rs256_pk_free 6 0 100.00% 11 0 100.00% 552rs256_pk_free 6 0 100.00% 11 0 100.00%
539rs256_pk_from_ptr 6 0 100.00% 8 0 100.00% 553rs256_pk_from_ptr 6 0 100.00% 8 0 100.00%
540rs256_pk_to_EVP_PKEY 32 0 100.00% 48 0 100.00% 554rs256_pk_to_EVP_PKEY 32 0 100.00% 48 0 100.00%
541rs256_pk_from_RSA 32 6 81.25% 32 9 71.88% 555rs256_pk_from_RSA 32 4 87.50% 32 6 81.25%
542rs256.c:decode_rsa_pubkey 9 0 100.00% 16 0 100.00% 556rs256.c:decode_rsa_pubkey 9 9 0.00% 16 16 0.00%
543rs256.c:decode_bignum 8 0 100.00% 12 0 100.00% 557rs256.c:decode_bignum 8 8 0.00% 12 12 0.00%
544--------------------------------------------------------------------------------------- 558---------------------------------------------------------------------------------------
545TOTAL 102 6 94.12% 140 9 93.57% 559TOTAL 102 29 71.57% 140 44 68.57%
546 560
547File '/home/pedro/projects/libfido2/src/u2f.c': 561File '/libfido2/src/u2f.c':
548Name Regions Miss Cover Lines Miss Cover 562Name Regions Miss Cover Lines Miss Cover
549--------------------------------------------------------------------------------------- 563---------------------------------------------------------------------------------------
550u2f_register 70 1 98.57% 89 0 100.00% 564u2f_register 70 5 92.86% 88 7 92.05%
551u2f_authenticate 27 0 100.00% 33 0 100.00% 565u2f_authenticate 32 4 87.50% 44 2 95.45%
552u2f.c:key_lookup 44 0 100.00% 69 0 100.00% 566u2f.c:key_lookup 44 0 100.00% 69 0 100.00%
553u2f.c:send_dummy_register 31 1 96.77% 50 0 100.00% 567u2f.c:send_dummy_register 31 5 83.87% 49 8 83.67%
554u2f.c:parse_register_reply 57 0 100.00% 83 0 100.00% 568u2f.c:parse_register_reply 57 0 100.00% 83 0 100.00%
555u2f.c:x5c_get 21 1 95.24% 37 3 91.89% 569u2f.c:x5c_get 21 2 90.48% 37 6 83.78%
556u2f.c:sig_get 8 1 87.50% 16 6 62.50% 570u2f.c:sig_get 8 1 87.50% 16 6 62.50%
557u2f.c:encode_cred_authdata 37 2 94.59% 82 6 92.68% 571u2f.c:encode_cred_authdata 37 3 91.89% 82 9 89.02%
558u2f.c:cbor_blob_from_ec_point 22 0 100.00% 39 0 100.00% 572u2f.c:cbor_blob_from_ec_point 22 1 95.45% 39 3 92.31%
559u2f.c:u2f_authenticate_single 34 2 94.12% 53 4 92.45% 573u2f.c:u2f_authenticate_single 36 2 94.44% 58 4 93.10%
560u2f.c:do_auth 50 1 98.00% 72 0 100.00% 574u2f.c:do_auth 50 3 94.00% 71 4 94.37%
561u2f.c:parse_auth_reply 23 2 91.30% 29 3 89.66% 575u2f.c:parse_auth_reply 23 2 91.30% 29 3 89.66%
562u2f.c:authdata_fake 12 0 100.00% 34 0 100.00% 576u2f.c:authdata_fake 12 0 100.00% 34 0 100.00%
563--------------------------------------------------------------------------------------- 577---------------------------------------------------------------------------------------
564TOTAL 436 11 97.48% 686 22 96.79% 578TOTAL 443 28 93.68% 699 52 92.56%
diff --git a/fuzz/fuzz_assert.c b/fuzz/fuzz_assert.c
index 0395345..5b72658 100644
--- a/fuzz/fuzz_assert.c
+++ b/fuzz/fuzz_assert.c
@@ -12,6 +12,10 @@
12#include <stdio.h> 12#include <stdio.h>
13 13
14#include "mutator_aux.h" 14#include "mutator_aux.h"
15#include "wiredata_fido2.h"
16#include "wiredata_u2f.h"
17#include "dummy.h"
18
15#include "fido.h" 19#include "fido.h"
16#include "fido/es256.h" 20#include "fido/es256.h"
17#include "fido/rs256.h" 21#include "fido/rs256.h"
@@ -54,140 +58,16 @@ struct param {
54 uint8_t uv; 58 uint8_t uv;
55}; 59};
56 60
57/* Example parameters. */
58static const char dummy_rp_id[] = "localhost";
59static const char dummy_pin[] = "9}4gT:8d=A37Dh}U";
60
61static const uint8_t dummy_cdh[] = {
62 0xec, 0x8d, 0x8f, 0x78, 0x42, 0x4a, 0x2b, 0xb7,
63 0x82, 0x34, 0xaa, 0xca, 0x07, 0xa1, 0xf6, 0x56,
64 0x42, 0x1c, 0xb6, 0xf6, 0xb3, 0x00, 0x86, 0x52,
65 0x35, 0x2d, 0xa2, 0x62, 0x4a, 0xbe, 0x89, 0x76,
66};
67
68static const uint8_t dummy_es256[] = {
69 0xcc, 0x1b, 0x50, 0xac, 0xc4, 0x19, 0xf8, 0x3a,
70 0xee, 0x0a, 0x77, 0xd6, 0xf3, 0x53, 0xdb, 0xef,
71 0xf2, 0xb9, 0x5c, 0x2d, 0x8b, 0x1e, 0x52, 0x58,
72 0x88, 0xf4, 0x0b, 0x85, 0x1f, 0x40, 0x6d, 0x18,
73 0x15, 0xb3, 0xcc, 0x25, 0x7c, 0x38, 0x3d, 0xec,
74 0xdf, 0xad, 0xbd, 0x46, 0x91, 0xc3, 0xac, 0x30,
75 0x94, 0x2a, 0xf7, 0x78, 0x35, 0x70, 0x59, 0x6f,
76 0x28, 0xcb, 0x8e, 0x07, 0x85, 0xb5, 0x91, 0x96,
77};
78
79static const uint8_t dummy_rs256[] = {
80 0xd2, 0xa8, 0xc0, 0x11, 0x82, 0x9e, 0x57, 0x2e,
81 0x60, 0xae, 0x8c, 0xb0, 0x09, 0xe1, 0x58, 0x2b,
82 0x99, 0xec, 0xc3, 0x11, 0x1b, 0xef, 0x81, 0x49,
83 0x34, 0x53, 0x6a, 0x01, 0x65, 0x2c, 0x24, 0x09,
84 0x30, 0x87, 0x98, 0x51, 0x6e, 0x30, 0x4f, 0x60,
85 0xbd, 0x54, 0xd2, 0x54, 0xbd, 0x94, 0x42, 0xdd,
86 0x63, 0xe5, 0x2c, 0xc6, 0x04, 0x32, 0xc0, 0x8f,
87 0x72, 0xd5, 0xb4, 0xf0, 0x4f, 0x42, 0xe5, 0xb0,
88 0xa2, 0x95, 0x11, 0xfe, 0xd8, 0xb0, 0x65, 0x34,
89 0xff, 0xfb, 0x44, 0x97, 0x52, 0xfc, 0x67, 0x23,
90 0x0b, 0xad, 0xf3, 0x3a, 0x82, 0xd4, 0x96, 0x10,
91 0x87, 0x6b, 0xfa, 0xd6, 0x51, 0x60, 0x3e, 0x1c,
92 0xae, 0x19, 0xb8, 0xce, 0x08, 0xae, 0x9a, 0xee,
93 0x78, 0x16, 0x22, 0xcc, 0x92, 0xcb, 0xa8, 0x95,
94 0x34, 0xe5, 0xb9, 0x42, 0x6a, 0xf0, 0x2e, 0x82,
95 0x1f, 0x4c, 0x7d, 0x84, 0x94, 0x68, 0x7b, 0x97,
96 0x2b, 0xf7, 0x7d, 0x67, 0x83, 0xbb, 0xc7, 0x8a,
97 0x31, 0x5a, 0xf3, 0x2a, 0x95, 0xdf, 0x63, 0xe7,
98 0x4e, 0xee, 0x26, 0xda, 0x87, 0x00, 0xe2, 0x23,
99 0x4a, 0x33, 0x9a, 0xa0, 0x1b, 0xce, 0x60, 0x1f,
100 0x98, 0xa1, 0xb0, 0xdb, 0xbf, 0x20, 0x59, 0x27,
101 0xf2, 0x06, 0xd9, 0xbe, 0x37, 0xa4, 0x03, 0x6b,
102 0x6a, 0x4e, 0xaf, 0x22, 0x68, 0xf3, 0xff, 0x28,
103 0x59, 0x05, 0xc9, 0xf1, 0x28, 0xf4, 0xbb, 0x35,
104 0xe0, 0xc2, 0x68, 0xc2, 0xaa, 0x54, 0xac, 0x8c,
105 0xc1, 0x69, 0x9e, 0x4b, 0x32, 0xfc, 0x53, 0x58,
106 0x85, 0x7d, 0x3f, 0x51, 0xd1, 0xc9, 0x03, 0x02,
107 0x13, 0x61, 0x62, 0xda, 0xf8, 0xfe, 0x3e, 0xc8,
108 0x95, 0x12, 0xfb, 0x0c, 0xdf, 0x06, 0x65, 0x6f,
109 0x23, 0xc7, 0x83, 0x7c, 0x50, 0x2d, 0x27, 0x25,
110 0x4d, 0xbf, 0x94, 0xf0, 0x89, 0x04, 0xb9, 0x2d,
111 0xc4, 0xa5, 0x32, 0xa9, 0x25, 0x0a, 0x99, 0x59,
112 0x01, 0x00, 0x01,
113};
114
115static const uint8_t dummy_eddsa[] = {
116 0xfe, 0x8b, 0x61, 0x50, 0x31, 0x7a, 0xe6, 0xdf,
117 0xb1, 0x04, 0x9d, 0x4d, 0xb5, 0x7a, 0x5e, 0x96,
118 0x4c, 0xb2, 0xf9, 0x5f, 0x72, 0x47, 0xb5, 0x18,
119 0xe2, 0x39, 0xdf, 0x2f, 0x87, 0x19, 0xb3, 0x02,
120};
121
122/* 61/*
123 * Collection of HID reports from an authenticator issued with a FIDO2 62 * Collection of HID reports from an authenticator issued with a FIDO2
124 * get assertion using the example parameters above. 63 * get assertion using the example parameters above.
125 */ 64 */
126static const uint8_t dummy_wire_data_fido[] = { 65static const uint8_t dummy_wire_data_fido[] = {
127 0xff, 0xff, 0xff, 0xff, 0x86, 0x00, 0x11, 0xf7, 66 WIREDATA_CTAP_INIT,
128 0x6f, 0xda, 0x52, 0xfd, 0xcb, 0xb6, 0x24, 0x00, 67 WIREDATA_CTAP_CBOR_INFO,
129 0x92, 0x00, 0x0e, 0x02, 0x05, 0x00, 0x02, 0x05, 68 WIREDATA_CTAP_CBOR_AUTHKEY,
130 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 69 WIREDATA_CTAP_CBOR_PINTOKEN,
131 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 70 WIREDATA_CTAP_CBOR_ASSERT,
132 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
133 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
134 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
135 0x00, 0x92, 0x00, 0x0e, 0x90, 0x00, 0x51, 0x00,
136 0xa1, 0x01, 0xa5, 0x01, 0x02, 0x03, 0x38, 0x18,
137 0x20, 0x01, 0x21, 0x58, 0x20, 0xe9, 0x1d, 0x9b,
138 0xac, 0x14, 0x25, 0x5f, 0xda, 0x1e, 0x11, 0xdb,
139 0xae, 0xc2, 0x90, 0x22, 0xca, 0x32, 0xec, 0x32,
140 0xe6, 0x05, 0x15, 0x44, 0xe5, 0xe8, 0xbc, 0x4f,
141 0x0a, 0xb6, 0x1a, 0xeb, 0x11, 0x22, 0x58, 0x20,
142 0xcc, 0x72, 0xf0, 0x22, 0xe8, 0x28, 0x82, 0xc5,
143 0x00, 0x92, 0x00, 0x0e, 0x00, 0xa6, 0x65, 0x6e,
144 0xff, 0x1e, 0xe3, 0x7f, 0x27, 0x44, 0x2d, 0xfb,
145 0x8d, 0x41, 0xfa, 0x85, 0x0e, 0xcb, 0xda, 0x95,
146 0x64, 0x64, 0x9b, 0x1f, 0x34, 0x00, 0x00, 0x00,
147 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
148 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
149 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
150 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
151 0x00, 0x92, 0x00, 0x0e, 0x90, 0x00, 0x14, 0x00,
152 0xa1, 0x02, 0x50, 0xee, 0x40, 0x4c, 0x85, 0xd7,
153 0xa1, 0x2f, 0x56, 0xc4, 0x4e, 0xc5, 0x93, 0x41,
154 0xd0, 0x3b, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00,
155 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
156 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
157 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
158 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
159 0x00, 0x92, 0x00, 0x0e, 0x90, 0x00, 0xcb, 0x00,
160 0xa3, 0x01, 0xa2, 0x62, 0x69, 0x64, 0x58, 0x40,
161 0x4a, 0x4c, 0x9e, 0xcc, 0x81, 0x7d, 0x42, 0x03,
162 0x2b, 0x41, 0xd1, 0x38, 0xd3, 0x49, 0xb4, 0xfc,
163 0xfb, 0xe4, 0x4e, 0xe4, 0xff, 0x76, 0x34, 0x16,
164 0x68, 0x06, 0x9d, 0xa6, 0x01, 0x32, 0xb9, 0xff,
165 0xc2, 0x35, 0x0d, 0x89, 0x43, 0x66, 0x12, 0xf8,
166 0x8e, 0x5b, 0xde, 0xf4, 0xcc, 0xec, 0x9d, 0x03,
167 0x00, 0x92, 0x00, 0x0e, 0x00, 0x85, 0xc2, 0xf5,
168 0xe6, 0x8e, 0xeb, 0x3f, 0x3a, 0xec, 0xc3, 0x1d,
169 0x04, 0x6e, 0xf3, 0x5b, 0x88, 0x64, 0x74, 0x79,
170 0x70, 0x65, 0x6a, 0x70, 0x75, 0x62, 0x6c, 0x69,
171 0x63, 0x2d, 0x6b, 0x65, 0x79, 0x02, 0x58, 0x25,
172 0x49, 0x96, 0x0d, 0xe5, 0x88, 0x0e, 0x8c, 0x68,
173 0x74, 0x34, 0x17, 0x0f, 0x64, 0x76, 0x60, 0x5b,
174 0x8f, 0xe4, 0xae, 0xb9, 0xa2, 0x86, 0x32, 0xc7,
175 0x00, 0x92, 0x00, 0x0e, 0x01, 0x99, 0x5c, 0xf3,
176 0xba, 0x83, 0x1d, 0x97, 0x63, 0x04, 0x00, 0x00,
177 0x00, 0x09, 0x03, 0x58, 0x47, 0x30, 0x45, 0x02,
178 0x21, 0x00, 0xcf, 0x3f, 0x36, 0x0e, 0x1f, 0x6f,
179 0xd6, 0xa0, 0x9d, 0x13, 0xcf, 0x55, 0xf7, 0x49,
180 0x8f, 0xc8, 0xc9, 0x03, 0x12, 0x76, 0x41, 0x75,
181 0x7b, 0xb5, 0x0a, 0x90, 0xa5, 0x82, 0x26, 0xf1,
182 0x6b, 0x80, 0x02, 0x20, 0x34, 0x9b, 0x7a, 0x82,
183 0x00, 0x92, 0x00, 0x0e, 0x02, 0xd3, 0xe1, 0x79,
184 0x49, 0x55, 0x41, 0x9f, 0xa4, 0x06, 0x06, 0xbd,
185 0xc8, 0xb9, 0x2b, 0x5f, 0xe1, 0xa7, 0x99, 0x1c,
186 0xa1, 0xfc, 0x7e, 0x3e, 0xd5, 0x85, 0x2e, 0x11,
187 0x75, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
188 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
189 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
190 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
191}; 71};
192 72
193/* 73/*
@@ -195,102 +75,12 @@ static const uint8_t dummy_wire_data_fido[] = {
195 * authentication using the example parameters above. 75 * authentication using the example parameters above.
196 */ 76 */
197static const uint8_t dummy_wire_data_u2f[] = { 77static const uint8_t dummy_wire_data_u2f[] = {
198 0xff, 0xff, 0xff, 0xff, 0x86, 0x00, 0x11, 0x0f, 78 WIREDATA_CTAP_INIT,
199 0x26, 0x9c, 0xd3, 0x87, 0x0d, 0x7b, 0xf6, 0x00, 79 WIREDATA_CTAP_U2F_6985,
200 0x00, 0x99, 0x01, 0x02, 0x01, 0x01, 0x00, 0x01, 80 WIREDATA_CTAP_U2F_6985,
201 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 81 WIREDATA_CTAP_U2F_6985,
202 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 82 WIREDATA_CTAP_U2F_6985,
203 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 83 WIREDATA_CTAP_U2F_AUTH,
204 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
205 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
206 0x00, 0x00, 0x99, 0x01, 0x83, 0x00, 0x02, 0x69,
207 0x85, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
208 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
209 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
210 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
211 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
212 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
213 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
214 0x00, 0x00, 0x99, 0x01, 0x83, 0x00, 0x02, 0x69,
215 0x85, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
216 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
217 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
218 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
219 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
220 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
221 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
222 0x00, 0x00, 0x99, 0x01, 0x83, 0x00, 0x02, 0x69,
223 0x85, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
224 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
225 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
226 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
227 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
228 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
229 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
230 0x00, 0x00, 0x99, 0x01, 0x83, 0x00, 0x02, 0x69,
231 0x85, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
232 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
233 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
234 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
235 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
236 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
237 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
238 0x00, 0x00, 0x99, 0x01, 0x83, 0x00, 0x02, 0x69,
239 0x85, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
240 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
241 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
242 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
243 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
244 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
245 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
246 0x00, 0x00, 0x99, 0x01, 0x83, 0x00, 0x02, 0x69,
247 0x85, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
248 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
249 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
250 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
251 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
252 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
253 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
254 0x00, 0x00, 0x99, 0x01, 0x83, 0x00, 0x02, 0x69,
255 0x85, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
256 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
257 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
258 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
259 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
260 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
261 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
262 0x00, 0x00, 0x99, 0x01, 0x83, 0x00, 0x02, 0x69,
263 0x85, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
264 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
265 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
266 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
267 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
268 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
269 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
270 0x00, 0x00, 0x99, 0x01, 0x83, 0x00, 0x02, 0x69,
271 0x85, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
272 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
273 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
274 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
275 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
276 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
277 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
278 0x00, 0x00, 0x99, 0x01, 0x83, 0x00, 0x4e, 0x01,
279 0x00, 0x00, 0x00, 0x2c, 0x30, 0x45, 0x02, 0x20,
280 0x1c, 0xf5, 0x7c, 0xf6, 0xde, 0xbe, 0xe9, 0x86,
281 0xee, 0x97, 0xb7, 0x64, 0xa3, 0x4e, 0x7a, 0x70,
282 0x85, 0xd0, 0x66, 0xf9, 0xf0, 0xcd, 0x04, 0x5d,
283 0x97, 0xf2, 0x3c, 0x22, 0xe3, 0x0e, 0x61, 0xc8,
284 0x02, 0x21, 0x00, 0x97, 0xef, 0xae, 0x36, 0xe6,
285 0x17, 0x9f, 0x5e, 0x2d, 0xd7, 0x8c, 0x34, 0xa7,
286 0x00, 0x00, 0x99, 0x01, 0x00, 0xa1, 0xe9, 0xfb,
287 0x8f, 0x86, 0x8c, 0xe3, 0x1e, 0xde, 0x3f, 0x4e,
288 0x1b, 0xe1, 0x2f, 0x8f, 0x2f, 0xca, 0x42, 0x26,
289 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
290 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
291 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
292 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
293 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
294}; 84};
295 85
296int LLVMFuzzerTestOneInput(const uint8_t *, size_t); 86int LLVMFuzzerTestOneInput(const uint8_t *, size_t);
@@ -346,6 +136,13 @@ pack(uint8_t *ptr, size_t len, const struct param *p)
346 return (max - len); 136 return (max - len);
347} 137}
348 138
139static size_t
140input_len(int max)
141{
142 return (5 * len_byte() + 2 * len_int() + 2 * len_string(max) +
143 6 * len_blob(max));
144}
145
349static void 146static void
350get_assert(fido_assert_t *assert, uint8_t u2f, const struct blob *cdh, 147get_assert(fido_assert_t *assert, uint8_t u2f, const struct blob *cdh,
351 const char *rp_id, int ext, uint8_t up, uint8_t uv, const char *pin, 148 const char *rp_id, int ext, uint8_t up, uint8_t uv, const char *pin,
@@ -354,6 +151,8 @@ get_assert(fido_assert_t *assert, uint8_t u2f, const struct blob *cdh,
354 fido_dev_t *dev; 151 fido_dev_t *dev;
355 fido_dev_io_t io; 152 fido_dev_io_t io;
356 153
154 memset(&io, 0, sizeof(io));
155
357 io.open = dev_open; 156 io.open = dev_open;
358 io.close = dev_close; 157 io.close = dev_close;
359 io.read = dev_read; 158 io.read = dev_read;
@@ -478,12 +277,14 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
478 277
479 memset(&p, 0, sizeof(p)); 278 memset(&p, 0, sizeof(p));
480 279
481 if (unpack(data, size, &p) < 0) 280 if (size < input_len(GETLEN_MIN) || size > input_len(GETLEN_MAX) ||
281 unpack(data, size, &p) < 0)
482 return (0); 282 return (0);
483 283
484 srandom((unsigned int)p.seed); 284 prng_init((unsigned int)p.seed);
485 285
486 fido_init(0); 286 fido_init(FIDO_DEBUG);
287 fido_set_log_handler(consume_str);
487 288
488 switch (p.type & 3) { 289 switch (p.type & 3) {
489 case 0: 290 case 0:
@@ -577,18 +378,20 @@ pack_dummy(uint8_t *ptr, size_t len)
577 378
578 memset(&dummy, 0, sizeof(dummy)); 379 memset(&dummy, 0, sizeof(dummy));
579 380
580 dummy.type = 1; 381 dummy.type = 1; /* rsa */
581 dummy.ext = FIDO_EXT_HMAC_SECRET; 382 dummy.ext = FIDO_EXT_HMAC_SECRET;
582 383
583 strlcpy(dummy.pin, dummy_pin, sizeof(dummy.pin)); 384 strlcpy(dummy.pin, dummy_pin, sizeof(dummy.pin));
584 strlcpy(dummy.rp_id, dummy_rp_id, sizeof(dummy.rp_id)); 385 strlcpy(dummy.rp_id, dummy_rp_id, sizeof(dummy.rp_id));
585 386
387 dummy.cred.len = sizeof(dummy_cdh); /* XXX */
586 dummy.cdh.len = sizeof(dummy_cdh); 388 dummy.cdh.len = sizeof(dummy_cdh);
587 dummy.es256.len = sizeof(dummy_es256); 389 dummy.es256.len = sizeof(dummy_es256);
588 dummy.rs256.len = sizeof(dummy_rs256); 390 dummy.rs256.len = sizeof(dummy_rs256);
589 dummy.eddsa.len = sizeof(dummy_eddsa); 391 dummy.eddsa.len = sizeof(dummy_eddsa);
590 dummy.wire_data.len = sizeof(dummy_wire_data_fido); 392 dummy.wire_data.len = sizeof(dummy_wire_data_fido);
591 393
394 memcpy(&dummy.cred.body, &dummy_cdh, dummy.cred.len); /* XXX */
592 memcpy(&dummy.cdh.body, &dummy_cdh, dummy.cdh.len); 395 memcpy(&dummy.cdh.body, &dummy_cdh, dummy.cdh.len);
593 memcpy(&dummy.wire_data.body, &dummy_wire_data_fido, 396 memcpy(&dummy.wire_data.body, &dummy_wire_data_fido,
594 dummy.wire_data.len); 397 dummy.wire_data.len);
diff --git a/fuzz/fuzz_bio.c b/fuzz/fuzz_bio.c
index f1596a7..05f6ce3 100644
--- a/fuzz/fuzz_bio.c
+++ b/fuzz/fuzz_bio.c
@@ -11,6 +11,9 @@
11#include <stdio.h> 11#include <stdio.h>
12 12
13#include "mutator_aux.h" 13#include "mutator_aux.h"
14#include "wiredata_fido2.h"
15#include "dummy.h"
16
14#include "fido.h" 17#include "fido.h"
15#include "fido/bio.h" 18#include "fido/bio.h"
16 19
@@ -39,32 +42,14 @@ struct param {
39 struct blob remove_wire_data; 42 struct blob remove_wire_data;
40}; 43};
41 44
42/* Example parameters. */
43static const uint8_t dummy_id[] = { 0x5e, 0xd2, };
44static const char dummy_pin[] = "3Q;I){TAx";
45static const char dummy_name[] = "finger1";
46
47/* 45/*
48 * Collection of HID reports from an authenticator issued with a FIDO2 46 * Collection of HID reports from an authenticator issued with a FIDO2
49 * 'getFingerprintSensorInfo' bio enrollment command. 47 * 'getFingerprintSensorInfo' bio enrollment command.
50 */ 48 */
51static const uint8_t dummy_info_wire_data[] = { 49static const uint8_t dummy_info_wire_data[] = {
52 0xff, 0xff, 0xff, 0xff, 0x86, 0x00, 0x11, 0xf0, 50 WIREDATA_CTAP_INIT,
53 0x08, 0xc1, 0x8f, 0x76, 0x4b, 0x8f, 0xa9, 0x00, 51 WIREDATA_CTAP_CBOR_INFO,
54 0x10, 0x00, 0x04, 0x02, 0x00, 0x04, 0x06, 0x05, 52 WIREDATA_CTAP_CBOR_BIO_INFO,
55 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
56 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
57 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
58 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
59 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
60 0x00, 0x10, 0x00, 0x04, 0x90, 0x00, 0x06, 0x00,
61 0xa2, 0x02, 0x01, 0x03, 0x04, 0x00, 0x00, 0x00,
62 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
63 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
64 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
65 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
66 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
67 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
68}; 53};
69 54
70/* 55/*
@@ -72,221 +57,11 @@ static const uint8_t dummy_info_wire_data[] = {
72 * 'enrollBegin' + 'enrollCaptureNextSample' bio enrollment commands. 57 * 'enrollBegin' + 'enrollCaptureNextSample' bio enrollment commands.
73 */ 58 */
74static const uint8_t dummy_enroll_wire_data[] = { 59static const uint8_t dummy_enroll_wire_data[] = {
75 0xff, 0xff, 0xff, 0xff, 0x86, 0x00, 0x11, 0x06, 60 WIREDATA_CTAP_INIT,
76 0xb4, 0xba, 0x2e, 0xb3, 0x88, 0x24, 0x38, 0x00, 61 WIREDATA_CTAP_CBOR_INFO,
77 0x0a, 0x00, 0x05, 0x02, 0x00, 0x04, 0x06, 0x05, 62 WIREDATA_CTAP_CBOR_AUTHKEY,
78 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 63 WIREDATA_CTAP_CBOR_PINTOKEN,
79 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 64 WIREDATA_CTAP_CBOR_BIO_ENROLL,
80 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
81 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
82 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
83 0x00, 0x0a, 0x00, 0x05, 0x90, 0x00, 0x51, 0x00,
84 0xa1, 0x01, 0xa5, 0x01, 0x02, 0x03, 0x38, 0x18,
85 0x20, 0x01, 0x21, 0x58, 0x20, 0xc9, 0x12, 0x01,
86 0xab, 0x88, 0xd7, 0x0a, 0x24, 0xdd, 0xdc, 0xde,
87 0x16, 0x27, 0x50, 0x77, 0x37, 0x06, 0xd3, 0x48,
88 0xe6, 0xf9, 0xdb, 0xaa, 0x10, 0x83, 0x81, 0xac,
89 0x13, 0x3c, 0xf9, 0x77, 0x2d, 0x22, 0x58, 0x20,
90 0xda, 0x20, 0x71, 0x03, 0x01, 0x40, 0xac, 0xd0,
91 0x00, 0x0a, 0x00, 0x05, 0x00, 0xb8, 0xdf, 0x2a,
92 0x95, 0xd3, 0x88, 0x1c, 0x06, 0x34, 0x30, 0xf1,
93 0xf3, 0xcd, 0x27, 0x40, 0x90, 0x5c, 0xc6, 0x74,
94 0x66, 0xff, 0x10, 0xde, 0xb6, 0x00, 0x00, 0x00,
95 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
96 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
97 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
98 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
99 0x00, 0x0a, 0x00, 0x05, 0x90, 0x00, 0x14, 0x00,
100 0xa1, 0x02, 0x50, 0x18, 0x81, 0xff, 0xf2, 0xf5,
101 0xde, 0x74, 0x43, 0xd5, 0xe0, 0x77, 0x37, 0x6b,
102 0x6c, 0x18, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00,
103 0x00, 0x00, 0x00, 0x00, 0x00, 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, 0x0a, 0x00, 0x05, 0xbb, 0x00, 0x01, 0x02,
108 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
109 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
110 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
111 0x00, 0x00, 0x00, 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, 0x0a, 0x00, 0x05, 0xbb, 0x00, 0x01, 0x02,
116 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
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, 0x0a, 0x00, 0x05, 0xbb, 0x00, 0x01, 0x02,
124 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
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, 0x0a, 0x00, 0x05, 0xbb, 0x00, 0x01, 0x02,
132 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
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, 0x0a, 0x00, 0x05, 0xbb, 0x00, 0x01, 0x02,
140 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
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, 0x0a, 0x00, 0x05, 0xbb, 0x00, 0x01, 0x02,
148 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
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, 0x0a, 0x00, 0x05, 0xbb, 0x00, 0x01, 0x02,
156 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
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, 0x0a, 0x00, 0x05, 0xbb, 0x00, 0x01, 0x02,
164 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
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, 0x0a, 0x00, 0x05, 0xbb, 0x00, 0x01, 0x02,
172 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
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, 0x0a, 0x00, 0x05, 0xbb, 0x00, 0x01, 0x02,
180 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
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, 0x0a, 0x00, 0x05, 0x90, 0x00, 0x0a, 0x00,
188 0xa3, 0x04, 0x42, 0x68, 0x96, 0x05, 0x00, 0x06,
189 0x02, 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, 0x0a, 0x00, 0x05, 0xbb, 0x00, 0x01, 0x02,
196 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
197 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
198 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
199 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
200 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
201 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
202 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
203 0x00, 0x0a, 0x00, 0x05, 0xbb, 0x00, 0x01, 0x02,
204 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
205 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
206 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
207 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
208 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
209 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
210 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
211 0x00, 0x0a, 0x00, 0x05, 0xbb, 0x00, 0x01, 0x02,
212 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
213 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
214 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
215 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
216 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
217 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
218 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
219 0x00, 0x0a, 0x00, 0x05, 0xbb, 0x00, 0x01, 0x02,
220 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
221 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
222 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
223 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
224 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
225 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
226 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
227 0x00, 0x0a, 0x00, 0x05, 0xbb, 0x00, 0x01, 0x02,
228 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
229 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
230 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
231 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
232 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
233 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
234 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
235 0x00, 0x0a, 0x00, 0x05, 0x90, 0x00, 0x06, 0x00,
236 0xa2, 0x05, 0x00, 0x06, 0x01, 0x00, 0x00, 0x00,
237 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
238 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
239 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
240 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
241 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
242 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
243 0x00, 0x0a, 0x00, 0x05, 0xbb, 0x00, 0x01, 0x02,
244 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
245 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
246 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
247 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
248 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
249 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
250 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
251 0x00, 0x0a, 0x00, 0x05, 0xbb, 0x00, 0x01, 0x02,
252 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
253 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
254 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
255 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
256 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
257 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
258 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
259 0x00, 0x0a, 0x00, 0x05, 0xbb, 0x00, 0x01, 0x02,
260 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
261 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
262 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
263 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
264 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
265 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
266 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
267 0x00, 0x0a, 0x00, 0x05, 0xbb, 0x00, 0x01, 0x02,
268 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
269 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
270 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
271 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
272 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
273 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
274 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
275 0x00, 0x0a, 0x00, 0x05, 0xbb, 0x00, 0x01, 0x02,
276 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
277 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
278 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
279 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
280 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
281 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
282 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
283 0x00, 0x0a, 0x00, 0x05, 0x90, 0x00, 0x06, 0x00,
284 0xa2, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00,
285 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
286 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
287 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
288 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
289 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
290}; 65};
291 66
292/* 67/*
@@ -294,46 +69,11 @@ static const uint8_t dummy_enroll_wire_data[] = {
294 * 'enumerateEnrollments' bio enrollment command. 69 * 'enumerateEnrollments' bio enrollment command.
295 */ 70 */
296static const uint8_t dummy_list_wire_data[] = { 71static const uint8_t dummy_list_wire_data[] = {
297 0xff, 0xff, 0xff, 0xff, 0x86, 0x00, 0x11, 0xae, 72 WIREDATA_CTAP_INIT,
298 0x21, 0x88, 0x51, 0x09, 0x6f, 0xd7, 0xbb, 0x00, 73 WIREDATA_CTAP_CBOR_INFO,
299 0x10, 0x00, 0x0f, 0x02, 0x00, 0x04, 0x06, 0x05, 74 WIREDATA_CTAP_CBOR_AUTHKEY,
300 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 75 WIREDATA_CTAP_CBOR_PINTOKEN,
301 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 76 WIREDATA_CTAP_CBOR_BIO_ENUM,
302 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
303 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
304 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
305 0x00, 0x10, 0x00, 0x0f, 0x90, 0x00, 0x51, 0x00,
306 0xa1, 0x01, 0xa5, 0x01, 0x02, 0x03, 0x38, 0x18,
307 0x20, 0x01, 0x21, 0x58, 0x20, 0x5a, 0x70, 0x63,
308 0x11, 0x5b, 0xa6, 0xe1, 0x8e, 0x4a, 0xb0, 0x75,
309 0xe7, 0xfd, 0x39, 0x26, 0x29, 0xed, 0x69, 0xb0,
310 0xc1, 0x1f, 0xa5, 0x7d, 0xcb, 0x64, 0x1e, 0x7c,
311 0x9f, 0x60, 0x5e, 0xb2, 0xf8, 0x22, 0x58, 0x20,
312 0xec, 0xe9, 0x1b, 0x11, 0xac, 0x2a, 0x0d, 0xd5,
313 0x00, 0x10, 0x00, 0x0f, 0x00, 0x3b, 0x9f, 0xba,
314 0x0f, 0x25, 0xd5, 0x24, 0x33, 0x4c, 0x5d, 0x0f,
315 0x63, 0xbf, 0xf1, 0xf3, 0x64, 0x55, 0x78, 0x1a,
316 0x59, 0x6e, 0x65, 0x59, 0xfc, 0x00, 0x00, 0x00,
317 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
318 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
319 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
320 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
321 0x00, 0x10, 0x00, 0x0f, 0x90, 0x00, 0x14, 0x00,
322 0xa1, 0x02, 0x50, 0xb9, 0x31, 0x34, 0xe2, 0x71,
323 0x6a, 0x8e, 0xa3, 0x60, 0xec, 0x5e, 0xd2, 0x13,
324 0x2e, 0x19, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
325 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
326 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
327 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
328 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
329 0x00, 0x10, 0x00, 0x0f, 0x90, 0x00, 0x2e, 0x00,
330 0xa1, 0x07, 0x83, 0xa2, 0x01, 0x42, 0xce, 0xa3,
331 0x02, 0x67, 0x66, 0x69, 0x6e, 0x67, 0x65, 0x72,
332 0x31, 0xa2, 0x01, 0x42, 0xbf, 0x5e, 0x02, 0x67,
333 0x66, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x32, 0xa2,
334 0x01, 0x42, 0x5e, 0xd2, 0x02, 0x67, 0x66, 0x69,
335 0x6e, 0x67, 0x65, 0x72, 0x33, 0x00, 0x00, 0x00,
336 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
337}; 77};
338 78
339/* 79/*
@@ -341,46 +81,11 @@ static const uint8_t dummy_list_wire_data[] = {
341 * 'setFriendlyName' bio enrollment command. 81 * 'setFriendlyName' bio enrollment command.
342 */ 82 */
343static const uint8_t dummy_set_name_wire_data[] = { 83static const uint8_t dummy_set_name_wire_data[] = {
344 0xff, 0xff, 0xff, 0xff, 0x86, 0x00, 0x11, 0xac, 84 WIREDATA_CTAP_INIT,
345 0x48, 0xfd, 0xbd, 0xdd, 0x36, 0x24, 0x4d, 0x00, 85 WIREDATA_CTAP_CBOR_INFO,
346 0x10, 0x00, 0x10, 0x02, 0x00, 0x04, 0x06, 0x05, 86 WIREDATA_CTAP_CBOR_AUTHKEY,
347 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 87 WIREDATA_CTAP_CBOR_PINTOKEN,
348 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 88 WIREDATA_CTAP_CBOR_STATUS,
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, 0x10, 0x00, 0x10, 0x90, 0x00, 0x51, 0x00,
353 0xa1, 0x01, 0xa5, 0x01, 0x02, 0x03, 0x38, 0x18,
354 0x20, 0x01, 0x21, 0x58, 0x20, 0x5a, 0x70, 0x63,
355 0x11, 0x5b, 0xa6, 0xe1, 0x8e, 0x4a, 0xb0, 0x75,
356 0xe7, 0xfd, 0x39, 0x26, 0x29, 0xed, 0x69, 0xb0,
357 0xc1, 0x1f, 0xa5, 0x7d, 0xcb, 0x64, 0x1e, 0x7c,
358 0x9f, 0x60, 0x5e, 0xb2, 0xf8, 0x22, 0x58, 0x20,
359 0xec, 0xe9, 0x1b, 0x11, 0xac, 0x2a, 0x0d, 0xd5,
360 0x00, 0x10, 0x00, 0x10, 0x00, 0x3b, 0x9f, 0xba,
361 0x0f, 0x25, 0xd5, 0x24, 0x33, 0x4c, 0x5d, 0x0f,
362 0x63, 0xbf, 0xf1, 0xf3, 0x64, 0x55, 0x78, 0x1a,
363 0x59, 0x6e, 0x65, 0x59, 0xfc, 0x00, 0x00, 0x00,
364 0x00, 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, 0x10, 0x00, 0x10, 0x90, 0x00, 0x14, 0x00,
369 0xa1, 0x02, 0x50, 0x40, 0x95, 0xf3, 0xcb, 0xae,
370 0xf2, 0x8d, 0xd9, 0xe0, 0xe0, 0x8a, 0xbd, 0xc3,
371 0x03, 0x58, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00,
372 0x00, 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, 0x10, 0x00, 0x10, 0x90, 0x00, 0x01, 0x00,
377 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
378 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
379 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
380 0x00, 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}; 89};
385 90
386/* 91/*
@@ -388,46 +93,11 @@ static const uint8_t dummy_set_name_wire_data[] = {
388 * 'removeEnrollment' bio enrollment command. 93 * 'removeEnrollment' bio enrollment command.
389 */ 94 */
390static const uint8_t dummy_remove_wire_data[] = { 95static const uint8_t dummy_remove_wire_data[] = {
391 0xff, 0xff, 0xff, 0xff, 0x86, 0x00, 0x11, 0x4b, 96 WIREDATA_CTAP_INIT,
392 0x24, 0xde, 0xd9, 0x06, 0x57, 0x1a, 0xbd, 0x00, 97 WIREDATA_CTAP_CBOR_INFO,
393 0x10, 0x00, 0x15, 0x02, 0x00, 0x04, 0x06, 0x05, 98 WIREDATA_CTAP_CBOR_AUTHKEY,
394 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 99 WIREDATA_CTAP_CBOR_PINTOKEN,
395 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 100 WIREDATA_CTAP_CBOR_STATUS,
396 0x00, 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, 0x10, 0x00, 0x15, 0x90, 0x00, 0x51, 0x00,
400 0xa1, 0x01, 0xa5, 0x01, 0x02, 0x03, 0x38, 0x18,
401 0x20, 0x01, 0x21, 0x58, 0x20, 0x5a, 0x70, 0x63,
402 0x11, 0x5b, 0xa6, 0xe1, 0x8e, 0x4a, 0xb0, 0x75,
403 0xe7, 0xfd, 0x39, 0x26, 0x29, 0xed, 0x69, 0xb0,
404 0xc1, 0x1f, 0xa5, 0x7d, 0xcb, 0x64, 0x1e, 0x7c,
405 0x9f, 0x60, 0x5e, 0xb2, 0xf8, 0x22, 0x58, 0x20,
406 0xec, 0xe9, 0x1b, 0x11, 0xac, 0x2a, 0x0d, 0xd5,
407 0x00, 0x10, 0x00, 0x15, 0x00, 0x3b, 0x9f, 0xba,
408 0x0f, 0x25, 0xd5, 0x24, 0x33, 0x4c, 0x5d, 0x0f,
409 0x63, 0xbf, 0xf1, 0xf3, 0x64, 0x55, 0x78, 0x1a,
410 0x59, 0x6e, 0x65, 0x59, 0xfc, 0x00, 0x00, 0x00,
411 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
412 0x00, 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, 0x10, 0x00, 0x15, 0x90, 0x00, 0x14, 0x00,
416 0xa1, 0x02, 0x50, 0xb0, 0xd0, 0x71, 0x2f, 0xa7,
417 0x8b, 0x89, 0xbd, 0xca, 0xa4, 0x1e, 0x6c, 0x43,
418 0xa1, 0x71, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00,
419 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
420 0x00, 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, 0x10, 0x00, 0x15, 0x90, 0x00, 0x01, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
428 0x00, 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}; 101};
432 102
433int LLVMFuzzerTestOneInput(const uint8_t *, size_t); 103int LLVMFuzzerTestOneInput(const uint8_t *, size_t);
@@ -471,12 +141,20 @@ pack(uint8_t *ptr, size_t len, const struct param *p)
471 return (max - len); 141 return (max - len);
472} 142}
473 143
144static size_t
145input_len(int max)
146{
147 return (2 * len_string(max) + len_int() + 6 * len_blob(max));
148}
149
474static fido_dev_t * 150static fido_dev_t *
475prepare_dev() 151prepare_dev()
476{ 152{
477 fido_dev_t *dev; 153 fido_dev_t *dev;
478 fido_dev_io_t io; 154 fido_dev_io_t io;
479 155
156 memset(&io, 0, sizeof(io));
157
480 io.open = dev_open; 158 io.open = dev_open;
481 io.close = dev_close; 159 io.close = dev_close;
482 io.read = dev_read; 160 io.read = dev_read;
@@ -659,12 +337,14 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
659 337
660 memset(&p, 0, sizeof(p)); 338 memset(&p, 0, sizeof(p));
661 339
662 if (unpack(data, size, &p) < 0) 340 if (size < input_len(GETLEN_MIN) || size > input_len(GETLEN_MAX) ||
341 unpack(data, size, &p) < 0)
663 return (0); 342 return (0);
664 343
665 srandom((unsigned int)p.seed); 344 prng_init((unsigned int)p.seed);
666 345
667 fido_init(0); 346 fido_init(FIDO_DEBUG);
347 fido_set_log_handler(consume_str);
668 348
669 get_info(&p); 349 get_info(&p);
670 enroll(&p); 350 enroll(&p);
diff --git a/fuzz/fuzz_cred.c b/fuzz/fuzz_cred.c
index 7bd1d3c..cc37903 100644
--- a/fuzz/fuzz_cred.c
+++ b/fuzz/fuzz_cred.c
@@ -11,6 +11,9 @@
11#include <stdio.h> 11#include <stdio.h>
12 12
13#include "mutator_aux.h" 13#include "mutator_aux.h"
14#include "wiredata_fido2.h"
15#include "wiredata_u2f.h"
16#include "dummy.h"
14#include "fido.h" 17#include "fido.h"
15 18
16#include "../openbsd-compat/openbsd-compat.h" 19#include "../openbsd-compat/openbsd-compat.h"
@@ -54,281 +57,19 @@ struct param {
54 uint8_t uv; 57 uint8_t uv;
55}; 58};
56 59
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/* 60/*
80 * Collection of HID reports from an authenticator issued with a FIDO2 61 * Collection of HID reports from an authenticator issued with a FIDO2
81 * make credential using the example parameters above. 62 * make credential using the example parameters above.
82 */ 63 */
83static const uint8_t dummy_wire_data_fido[] = { 64static const uint8_t dummy_wire_data_fido[] = {
84 0xff, 0xff, 0xff, 0xff, 0x86, 0x00, 0x11, 0xb0, 65 WIREDATA_CTAP_INIT,
85 0x84, 0xeb, 0xec, 0x4d, 0x97, 0x72, 0x09, 0x00, 66 WIREDATA_CTAP_CBOR_INFO,
86 0x91, 0x00, 0x03, 0x02, 0x05, 0x00, 0x02, 0x05, 67 WIREDATA_CTAP_CBOR_AUTHKEY,
87 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 68 WIREDATA_CTAP_CBOR_PINTOKEN,
88 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 69 WIREDATA_CTAP_KEEPALIVE,
89 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 70 WIREDATA_CTAP_KEEPALIVE,
90 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 71 WIREDATA_CTAP_KEEPALIVE,
91 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 72 WIREDATA_CTAP_CBOR_CRED,
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}; 73};
333 74
334/* 75/*
@@ -336,294 +77,13 @@ static const uint8_t dummy_wire_data_fido[] = {
336 * registration using the example parameters above. 77 * registration using the example parameters above.
337 */ 78 */
338static const uint8_t dummy_wire_data_u2f[] = { 79static const uint8_t dummy_wire_data_u2f[] = {
339 0xff, 0xff, 0xff, 0xff, 0x86, 0x00, 0x11, 0x8e, 80 WIREDATA_CTAP_INIT,
340 0x80, 0xd0, 0xe2, 0x3b, 0x24, 0x93, 0xea, 0x00, 81 WIREDATA_CTAP_U2F_6985,
341 0x00, 0x99, 0x01, 0x02, 0x01, 0x01, 0x00, 0x01, 82 WIREDATA_CTAP_U2F_6985,
342 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 83 WIREDATA_CTAP_U2F_6985,
343 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 84 WIREDATA_CTAP_U2F_6985,
344 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 85 WIREDATA_CTAP_U2F_6985,
345 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 86 WIREDATA_CTAP_U2F_REGISTER,
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}; 87};
628 88
629int LLVMFuzzerTestOneInput(const uint8_t *, size_t); 89int LLVMFuzzerTestOneInput(const uint8_t *, size_t);
@@ -683,6 +143,13 @@ pack(uint8_t *ptr, size_t len, const struct param *p)
683 return (max - len); 143 return (max - len);
684} 144}
685 145
146static size_t
147input_len(int max)
148{
149 return (5 * len_byte() + 6 * len_string(max) + 2 * len_int() +
150 4 * len_blob(max));
151}
152
686static void 153static void
687make_cred(fido_cred_t *cred, uint8_t u2f, int type, const struct blob *cdh, 154make_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, 155 const char *rp_id, const char *rp_name, struct blob *user_id,
@@ -693,6 +160,8 @@ make_cred(fido_cred_t *cred, uint8_t u2f, int type, const struct blob *cdh,
693 fido_dev_t *dev; 160 fido_dev_t *dev;
694 fido_dev_io_t io; 161 fido_dev_io_t io;
695 162
163 memset(&io, 0, sizeof(io));
164
696 io.open = dev_open; 165 io.open = dev_open;
697 io.close = dev_close; 166 io.close = dev_close;
698 io.read = dev_read; 167 io.read = dev_read;
@@ -720,6 +189,8 @@ make_cred(fido_cred_t *cred, uint8_t u2f, int type, const struct blob *cdh,
720 fido_cred_set_rk(cred, FIDO_OPT_TRUE); 189 fido_cred_set_rk(cred, FIDO_OPT_TRUE);
721 if (uv & 1) 190 if (uv & 1)
722 fido_cred_set_uv(cred, FIDO_OPT_TRUE); 191 fido_cred_set_uv(cred, FIDO_OPT_TRUE);
192 if (user_id->len)
193 fido_cred_set_prot(cred, user_id->body[0] & 0x03);
723 194
724 fido_dev_make_cred(dev, cred, u2f & 1 ? NULL : pin); 195 fido_dev_make_cred(dev, cred, u2f & 1 ? NULL : pin);
725 196
@@ -733,15 +204,13 @@ verify_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, 204 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, 205 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, 206 const unsigned char *x5c_ptr, size_t x5c_len, const unsigned char *sig_ptr,
736 size_t sig_len, const char *fmt) 207 size_t sig_len, const char *fmt, int prot)
737{ 208{
738 fido_cred_t *cred; 209 fido_cred_t *cred;
739 uint8_t flags; 210 uint8_t flags;
740 211
741 if ((cred = fido_cred_new()) == NULL) { 212 if ((cred = fido_cred_new()) == NULL)
742 warnx("%s: fido_cred_new", __func__);
743 return; 213 return;
744 }
745 214
746 fido_cred_set_type(cred, type); 215 fido_cred_set_type(cred, type);
747 fido_cred_set_clientdata_hash(cred, cdh_ptr, cdh_len); 216 fido_cred_set_clientdata_hash(cred, cdh_ptr, cdh_len);
@@ -751,6 +220,7 @@ verify_cred(int type, const unsigned char *cdh_ptr, size_t cdh_len,
751 fido_cred_set_extensions(cred, ext); 220 fido_cred_set_extensions(cred, ext);
752 fido_cred_set_x509(cred, x5c_ptr, x5c_len); 221 fido_cred_set_x509(cred, x5c_ptr, x5c_len);
753 fido_cred_set_sig(cred, sig_ptr, sig_len); 222 fido_cred_set_sig(cred, sig_ptr, sig_len);
223 fido_cred_set_prot(cred, prot);
754 224
755 if (rk & 1) 225 if (rk & 1)
756 fido_cred_set_rk(cred, FIDO_OPT_TRUE); 226 fido_cred_set_rk(cred, FIDO_OPT_TRUE);
@@ -786,12 +256,14 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
786 256
787 memset(&p, 0, sizeof(p)); 257 memset(&p, 0, sizeof(p));
788 258
789 if (unpack(data, size, &p) < 0) 259 if (size < input_len(GETLEN_MIN) || size > input_len(GETLEN_MAX) ||
260 unpack(data, size, &p) < 0)
790 return (0); 261 return (0);
791 262
792 srandom((unsigned int)p.seed); 263 prng_init((unsigned int)p.seed);
793 264
794 fido_init(0); 265 fido_init(FIDO_DEBUG);
266 fido_set_log_handler(consume_str);
795 267
796 if ((cred = fido_cred_new()) == NULL) 268 if ((cred = fido_cred_new()) == NULL)
797 return (0); 269 return (0);
@@ -821,7 +293,7 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
821 fido_cred_authdata_len(cred), p.ext, p.rk, p.uv, 293 fido_cred_authdata_len(cred), p.ext, p.rk, p.uv,
822 fido_cred_x5c_ptr(cred), fido_cred_x5c_len(cred), 294 fido_cred_x5c_ptr(cred), fido_cred_x5c_len(cred),
823 fido_cred_sig_ptr(cred), fido_cred_sig_len(cred), 295 fido_cred_sig_ptr(cred), fido_cred_sig_len(cred),
824 fido_cred_fmt(cred)); 296 fido_cred_fmt(cred), fido_cred_prot(cred));
825 297
826 fido_cred_free(&cred); 298 fido_cred_free(&cred);
827 299
diff --git a/fuzz/fuzz_credman.c b/fuzz/fuzz_credman.c
index 4359938..323d0a9 100644
--- a/fuzz/fuzz_credman.c
+++ b/fuzz/fuzz_credman.c
@@ -11,6 +11,9 @@
11#include <stdio.h> 11#include <stdio.h>
12 12
13#include "mutator_aux.h" 13#include "mutator_aux.h"
14#include "wiredata_fido2.h"
15#include "dummy.h"
16
14#include "fido.h" 17#include "fido.h"
15#include "fido/credman.h" 18#include "fido/credman.h"
16 19
@@ -37,59 +40,16 @@ struct param {
37 struct blob rp_wire_data; 40 struct blob rp_wire_data;
38}; 41};
39 42
40/* Example parameters. */
41static const uint8_t dummy_cred_id[] = {
42 0x4f, 0x72, 0x98, 0x42, 0x4a, 0xe1, 0x17, 0xa5,
43 0x85, 0xa0, 0xef, 0x3b, 0x11, 0x24, 0x4a, 0x3d,
44};
45static const char dummy_pin[] = "[n#899:~m";
46static const char dummy_rp_id[] = "yubico.com";
47
48/* 43/*
49 * Collection of HID reports from an authenticator issued with a FIDO2 44 * Collection of HID reports from an authenticator issued with a FIDO2
50 * 'getCredsMetadata' credential management command. 45 * 'getCredsMetadata' credential management command.
51 */ 46 */
52static const uint8_t dummy_meta_wire_data[] = { 47static const uint8_t dummy_meta_wire_data[] = {
53 0xff, 0xff, 0xff, 0xff, 0x86, 0x00, 0x11, 0xc5, 48 WIREDATA_CTAP_INIT,
54 0xb7, 0x89, 0xba, 0x8d, 0x5f, 0x94, 0x1b, 0x00, 49 WIREDATA_CTAP_CBOR_INFO,
55 0x12, 0x00, 0x04, 0x02, 0x00, 0x04, 0x05, 0x05, 50 WIREDATA_CTAP_CBOR_AUTHKEY,
56 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 51 WIREDATA_CTAP_CBOR_PINTOKEN,
57 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 52 WIREDATA_CTAP_CBOR_CREDMAN_META,
58 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
59 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
60 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
61 0x00, 0x12, 0x00, 0x04, 0x90, 0x00, 0x51, 0x00,
62 0xa1, 0x01, 0xa5, 0x01, 0x02, 0x03, 0x38, 0x18,
63 0x20, 0x01, 0x21, 0x58, 0x20, 0x93, 0xc5, 0x64,
64 0x71, 0xe9, 0xd1, 0xb8, 0xed, 0xf6, 0xd5, 0xf3,
65 0xa7, 0xd5, 0x96, 0x70, 0xbb, 0xd5, 0x20, 0xa1,
66 0xa3, 0xd3, 0x93, 0x4c, 0x5c, 0x20, 0x5c, 0x22,
67 0xeb, 0xb0, 0x6a, 0x27, 0x59, 0x22, 0x58, 0x20,
68 0x63, 0x02, 0x33, 0xa8, 0xed, 0x3c, 0xbc, 0xe9,
69 0x00, 0x12, 0x00, 0x04, 0x00, 0xda, 0x44, 0xf5,
70 0xed, 0xda, 0xe6, 0xa4, 0xad, 0x3f, 0x9e, 0xf8,
71 0x50, 0x8d, 0x01, 0x47, 0x6c, 0x4e, 0x72, 0xa4,
72 0x04, 0x13, 0xa8, 0x65, 0x97, 0x00, 0x00, 0x00,
73 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
74 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
75 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
76 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
77 0x00, 0x12, 0x00, 0x04, 0x90, 0x00, 0x14, 0x00,
78 0xa1, 0x02, 0x50, 0x6f, 0x11, 0x96, 0x21, 0x92,
79 0x52, 0xf1, 0x6b, 0xd4, 0x2c, 0xe3, 0xf8, 0xc9,
80 0x8c, 0x47, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
81 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
82 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
83 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
84 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
85 0x00, 0x12, 0x00, 0x04, 0x90, 0x00, 0x07, 0x00,
86 0xa2, 0x01, 0x00, 0x02, 0x18, 0x19, 0x00, 0x00,
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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
93}; 53};
94 54
95/* 55/*
@@ -97,62 +57,11 @@ static const uint8_t dummy_meta_wire_data[] = {
97 * 'enumerateRPsBegin' credential management command. 57 * 'enumerateRPsBegin' credential management command.
98 */ 58 */
99static const uint8_t dummy_rp_wire_data[] = { 59static const uint8_t dummy_rp_wire_data[] = {
100 0xff, 0xff, 0xff, 0xff, 0x86, 0x00, 0x11, 0x87, 60 WIREDATA_CTAP_INIT,
101 0xbf, 0xc6, 0x7f, 0x36, 0xf5, 0xe2, 0x49, 0x00, 61 WIREDATA_CTAP_CBOR_INFO,
102 0x15, 0x00, 0x02, 0x02, 0x00, 0x04, 0x05, 0x05, 62 WIREDATA_CTAP_CBOR_AUTHKEY,
103 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 63 WIREDATA_CTAP_CBOR_PINTOKEN,
104 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 64 WIREDATA_CTAP_CBOR_CREDMAN_RPLIST,
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, 0x15, 0x00, 0x02, 0x90, 0x00, 0x51, 0x00,
109 0xa1, 0x01, 0xa5, 0x01, 0x02, 0x03, 0x38, 0x18,
110 0x20, 0x01, 0x21, 0x58, 0x20, 0x12, 0xc1, 0x81,
111 0x6b, 0x92, 0x6a, 0x56, 0x05, 0xfe, 0xdb, 0xab,
112 0x90, 0x2f, 0x57, 0x0b, 0x3d, 0x85, 0x3e, 0x3f,
113 0xbc, 0xe5, 0xd3, 0xb6, 0x86, 0xdf, 0x10, 0x43,
114 0xc2, 0xaf, 0x87, 0x34, 0x0e, 0x22, 0x58, 0x20,
115 0xd3, 0x0f, 0x7e, 0x5d, 0x10, 0x33, 0x57, 0x24,
116 0x00, 0x15, 0x00, 0x02, 0x00, 0x6e, 0x90, 0x58,
117 0x61, 0x2a, 0xd2, 0xc2, 0x1e, 0x08, 0xea, 0x91,
118 0xcb, 0x44, 0x66, 0x73, 0x29, 0x92, 0x29, 0x59,
119 0x91, 0xa3, 0x4d, 0x2c, 0xbb, 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, 0x15, 0x00, 0x02, 0x90, 0x00, 0x14, 0x00,
125 0xa1, 0x02, 0x50, 0x6d, 0x95, 0x0e, 0x73, 0x78,
126 0x46, 0x13, 0x2e, 0x07, 0xbf, 0xeb, 0x61, 0x31,
127 0x37, 0x36, 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, 0x15, 0x00, 0x02, 0x90, 0x00, 0x37, 0x00,
133 0xa3, 0x03, 0xa1, 0x62, 0x69, 0x64, 0x6a, 0x79,
134 0x75, 0x62, 0x69, 0x63, 0x6f, 0x2e, 0x63, 0x6f,
135 0x6d, 0x04, 0x58, 0x20, 0x37, 0x82, 0x09, 0xb7,
136 0x2d, 0xef, 0xcb, 0xa9, 0x1d, 0xcb, 0xf8, 0x54,
137 0xed, 0xb4, 0xda, 0xa6, 0x48, 0x82, 0x8a, 0x2c,
138 0xbd, 0x18, 0x0a, 0xfc, 0x77, 0xa7, 0x44, 0x34,
139 0x65, 0x5a, 0x1c, 0x7d, 0x05, 0x03, 0x00, 0x00,
140 0x00, 0x15, 0x00, 0x02, 0x90, 0x00, 0x36, 0x00,
141 0xa2, 0x03, 0xa1, 0x62, 0x69, 0x64, 0x6b, 0x79,
142 0x75, 0x62, 0x69, 0x6b, 0x65, 0x79, 0x2e, 0x6f,
143 0x72, 0x67, 0x04, 0x58, 0x20, 0x12, 0x6b, 0xba,
144 0x6a, 0x2d, 0x7a, 0x81, 0x84, 0x25, 0x7b, 0x74,
145 0xdd, 0x1d, 0xdd, 0x46, 0xb6, 0x2a, 0x8c, 0xa2,
146 0xa7, 0x83, 0xfe, 0xdb, 0x5b, 0x19, 0x48, 0x73,
147 0x55, 0xb7, 0xe3, 0x46, 0x09, 0x00, 0x00, 0x00,
148 0x00, 0x15, 0x00, 0x02, 0x90, 0x00, 0x37, 0x00,
149 0xa2, 0x03, 0xa1, 0x62, 0x69, 0x64, 0x6c, 0x77,
150 0x65, 0x62, 0x61, 0x75, 0x74, 0x68, 0x6e, 0x2e,
151 0x64, 0x65, 0x76, 0x04, 0x58, 0x20, 0xd6, 0x32,
152 0x7d, 0x8c, 0x6a, 0x5d, 0xe6, 0xae, 0x0e, 0x33,
153 0xd0, 0xa3, 0x31, 0xfb, 0x67, 0x77, 0xb9, 0x4e,
154 0xf4, 0x73, 0x19, 0xfe, 0x7e, 0xfd, 0xfa, 0x82,
155 0x70, 0x8e, 0x1f, 0xbb, 0xa2, 0x55, 0x00, 0x00,
156}; 65};
157 66
158/* 67/*
@@ -160,182 +69,11 @@ static const uint8_t dummy_rp_wire_data[] = {
160 * 'enumerateCredentialsBegin' credential management command. 69 * 'enumerateCredentialsBegin' credential management command.
161 */ 70 */
162static const uint8_t dummy_rk_wire_data[] = { 71static const uint8_t dummy_rk_wire_data[] = {
163 0xff, 0xff, 0xff, 0xff, 0x86, 0x00, 0x11, 0x35, 72 WIREDATA_CTAP_INIT,
164 0x3b, 0x34, 0xb9, 0xcb, 0xeb, 0x40, 0x55, 0x00, 73 WIREDATA_CTAP_CBOR_INFO,
165 0x15, 0x00, 0x04, 0x02, 0x00, 0x04, 0x05, 0x05, 74 WIREDATA_CTAP_CBOR_AUTHKEY,
166 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 75 WIREDATA_CTAP_CBOR_PINTOKEN,
167 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 76 WIREDATA_CTAP_CBOR_CREDMAN_RKLIST,
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, 0x15, 0x00, 0x04, 0x90, 0x00, 0x51, 0x00,
172 0xa1, 0x01, 0xa5, 0x01, 0x02, 0x03, 0x38, 0x18,
173 0x20, 0x01, 0x21, 0x58, 0x20, 0x12, 0xc1, 0x81,
174 0x6b, 0x92, 0x6a, 0x56, 0x05, 0xfe, 0xdb, 0xab,
175 0x90, 0x2f, 0x57, 0x0b, 0x3d, 0x85, 0x3e, 0x3f,
176 0xbc, 0xe5, 0xd3, 0xb6, 0x86, 0xdf, 0x10, 0x43,
177 0xc2, 0xaf, 0x87, 0x34, 0x0e, 0x22, 0x58, 0x20,
178 0xd3, 0x0f, 0x7e, 0x5d, 0x10, 0x33, 0x57, 0x24,
179 0x00, 0x15, 0x00, 0x04, 0x00, 0x6e, 0x90, 0x58,
180 0x61, 0x2a, 0xd2, 0xc2, 0x1e, 0x08, 0xea, 0x91,
181 0xcb, 0x44, 0x66, 0x73, 0x29, 0x92, 0x29, 0x59,
182 0x91, 0xa3, 0x4d, 0x2c, 0xbb, 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, 0x15, 0x00, 0x04, 0x90, 0x00, 0x14, 0x00,
188 0xa1, 0x02, 0x50, 0x1b, 0xf0, 0x01, 0x0d, 0x32,
189 0xee, 0x28, 0xa4, 0x5a, 0x7f, 0x56, 0x5b, 0x28,
190 0xfd, 0x1f, 0x48, 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, 0x15, 0x00, 0x04, 0x90, 0x00, 0xc5, 0x00,
196 0xa5, 0x06, 0xa3, 0x62, 0x69, 0x64, 0x58, 0x20,
197 0xe4, 0xe1, 0x06, 0x31, 0xde, 0x00, 0x0f, 0x4f,
198 0x12, 0x6e, 0xc9, 0x68, 0x2d, 0x43, 0x3f, 0xf1,
199 0x02, 0x2c, 0x6e, 0xe6, 0x96, 0x10, 0xbf, 0x73,
200 0x35, 0xc9, 0x20, 0x27, 0x06, 0xba, 0x39, 0x09,
201 0x64, 0x6e, 0x61, 0x6d, 0x65, 0x6a, 0x62, 0x6f,
202 0x62, 0x20, 0x62, 0x61, 0x6e, 0x61, 0x6e, 0x61,
203 0x00, 0x15, 0x00, 0x04, 0x00, 0x6b, 0x64, 0x69,
204 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d,
205 0x65, 0x67, 0x62, 0x62, 0x61, 0x6e, 0x61, 0x6e,
206 0x61, 0x07, 0xa2, 0x62, 0x69, 0x64, 0x50, 0x19,
207 0xf7, 0x78, 0x0c, 0xa0, 0xbc, 0xb9, 0xa6, 0xd5,
208 0x1e, 0xd7, 0x87, 0xfb, 0x6c, 0x80, 0x03, 0x64,
209 0x74, 0x79, 0x70, 0x65, 0x6a, 0x70, 0x75, 0x62,
210 0x6c, 0x69, 0x63, 0x2d, 0x6b, 0x65, 0x79, 0x08,
211 0x00, 0x15, 0x00, 0x04, 0x01, 0xa5, 0x01, 0x02,
212 0x03, 0x26, 0x20, 0x01, 0x21, 0x58, 0x20, 0x81,
213 0x6c, 0xdd, 0x8c, 0x8f, 0x8c, 0xc8, 0x43, 0xa7,
214 0xbb, 0x79, 0x51, 0x09, 0xb1, 0xdf, 0xbe, 0xc4,
215 0xa5, 0x54, 0x16, 0x9e, 0x58, 0x56, 0xb3, 0x0b,
216 0x34, 0x4f, 0xa5, 0x6c, 0x05, 0xa2, 0x21, 0x22,
217 0x58, 0x20, 0xcd, 0xc2, 0x0c, 0x99, 0x83, 0x5a,
218 0x61, 0x73, 0xd8, 0xe0, 0x74, 0x23, 0x46, 0x64,
219 0x00, 0x15, 0x00, 0x04, 0x02, 0x39, 0x4c, 0xb0,
220 0xf4, 0x6c, 0x0a, 0x37, 0x72, 0xaa, 0xa8, 0xea,
221 0x58, 0xd3, 0xd4, 0xe0, 0x51, 0xb2, 0x28, 0x09,
222 0x05, 0x0a, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
223 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
224 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
225 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
226 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
227 0x00, 0x15, 0x00, 0x04, 0x90, 0x00, 0xa0, 0x00,
228 0xa4, 0x06, 0xa3, 0x62, 0x69, 0x64, 0x58, 0x20,
229 0x56, 0xa1, 0x3c, 0x06, 0x2b, 0xad, 0xa2, 0x21,
230 0x7d, 0xcd, 0x91, 0x08, 0x47, 0xa8, 0x8a, 0x06,
231 0x06, 0xf6, 0x66, 0x91, 0xf6, 0xeb, 0x89, 0xe4,
232 0xdf, 0x26, 0xbc, 0x46, 0x59, 0xc3, 0x7d, 0xc0,
233 0x64, 0x6e, 0x61, 0x6d, 0x65, 0x6a, 0x62, 0x6f,
234 0x62, 0x20, 0x62, 0x61, 0x6e, 0x61, 0x6e, 0x61,
235 0x00, 0x15, 0x00, 0x04, 0x00, 0x6b, 0x64, 0x69,
236 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d,
237 0x65, 0x67, 0x62, 0x62, 0x61, 0x6e, 0x61, 0x6e,
238 0x61, 0x07, 0xa2, 0x62, 0x69, 0x64, 0x50, 0xd8,
239 0x27, 0x4b, 0x25, 0xed, 0x19, 0xef, 0x11, 0xaf,
240 0xa6, 0x89, 0x7b, 0x84, 0x50, 0xe7, 0x62, 0x64,
241 0x74, 0x79, 0x70, 0x65, 0x6a, 0x70, 0x75, 0x62,
242 0x6c, 0x69, 0x63, 0x2d, 0x6b, 0x65, 0x79, 0x08,
243 0x00, 0x15, 0x00, 0x04, 0x01, 0xa4, 0x01, 0x01,
244 0x03, 0x27, 0x20, 0x06, 0x21, 0x58, 0x20, 0x8d,
245 0xfe, 0x45, 0xd5, 0x7d, 0xb6, 0x17, 0xab, 0x86,
246 0x2d, 0x32, 0xf6, 0x85, 0xf0, 0x92, 0x76, 0xb7,
247 0xce, 0x73, 0xca, 0x4e, 0x0e, 0xfd, 0xd5, 0xdb,
248 0x2a, 0x1d, 0x55, 0x90, 0x96, 0x52, 0xc2, 0x0a,
249 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
250 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
251 0x00, 0x15, 0x00, 0x04, 0x90, 0x00, 0xa0, 0x00,
252 0xa4, 0x06, 0xa3, 0x62, 0x69, 0x64, 0x58, 0x20,
253 0x04, 0x0e, 0x0f, 0xa0, 0xcd, 0x60, 0x35, 0x9a,
254 0xba, 0x47, 0x0c, 0x10, 0xb6, 0x82, 0x6e, 0x2f,
255 0x66, 0xb9, 0xa7, 0xcf, 0xd8, 0x47, 0xb4, 0x3d,
256 0xfd, 0x77, 0x1a, 0x38, 0x22, 0xa1, 0xda, 0xa5,
257 0x64, 0x6e, 0x61, 0x6d, 0x65, 0x6a, 0x62, 0x6f,
258 0x62, 0x20, 0x62, 0x61, 0x6e, 0x61, 0x6e, 0x61,
259 0x00, 0x15, 0x00, 0x04, 0x00, 0x6b, 0x64, 0x69,
260 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d,
261 0x65, 0x67, 0x62, 0x62, 0x61, 0x6e, 0x61, 0x6e,
262 0x61, 0x07, 0xa2, 0x62, 0x69, 0x64, 0x50, 0x00,
263 0x5d, 0xdf, 0xef, 0xe2, 0xf3, 0x06, 0xb2, 0xa5,
264 0x46, 0x4d, 0x98, 0xbc, 0x14, 0x65, 0xc1, 0x64,
265 0x74, 0x79, 0x70, 0x65, 0x6a, 0x70, 0x75, 0x62,
266 0x6c, 0x69, 0x63, 0x2d, 0x6b, 0x65, 0x79, 0x08,
267 0x00, 0x15, 0x00, 0x04, 0x01, 0xa4, 0x01, 0x01,
268 0x03, 0x27, 0x20, 0x06, 0x21, 0x58, 0x20, 0x72,
269 0x79, 0x14, 0x69, 0xdf, 0xcb, 0x64, 0x75, 0xee,
270 0xd4, 0x45, 0x94, 0xbc, 0x48, 0x4d, 0x2a, 0x9f,
271 0xc9, 0xf4, 0xb5, 0x1b, 0x05, 0xa6, 0x5b, 0x54,
272 0x9a, 0xac, 0x6c, 0x2e, 0xc6, 0x90, 0x62, 0x0a,
273 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
274 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
275 0x00, 0x15, 0x00, 0x04, 0x90, 0x00, 0xc3, 0x00,
276 0xa4, 0x06, 0xa3, 0x62, 0x69, 0x64, 0x58, 0x20,
277 0xce, 0x32, 0xd8, 0x79, 0xdd, 0x86, 0xa2, 0x42,
278 0x7c, 0xc3, 0xe1, 0x95, 0x12, 0x93, 0x1a, 0x03,
279 0xe6, 0x70, 0xb8, 0xff, 0xcd, 0xa5, 0xdf, 0x15,
280 0xfc, 0x88, 0x2a, 0xf5, 0x44, 0xf1, 0x33, 0x9c,
281 0x64, 0x6e, 0x61, 0x6d, 0x65, 0x6a, 0x62, 0x6f,
282 0x62, 0x20, 0x62, 0x61, 0x6e, 0x61, 0x6e, 0x61,
283 0x00, 0x15, 0x00, 0x04, 0x00, 0x6b, 0x64, 0x69,
284 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d,
285 0x65, 0x67, 0x62, 0x62, 0x61, 0x6e, 0x61, 0x6e,
286 0x61, 0x07, 0xa2, 0x62, 0x69, 0x64, 0x50, 0x0a,
287 0x26, 0x5b, 0x7e, 0x1a, 0x2a, 0xba, 0x70, 0x5f,
288 0x18, 0x26, 0x14, 0xb2, 0x71, 0xca, 0x98, 0x64,
289 0x74, 0x79, 0x70, 0x65, 0x6a, 0x70, 0x75, 0x62,
290 0x6c, 0x69, 0x63, 0x2d, 0x6b, 0x65, 0x79, 0x08,
291 0x00, 0x15, 0x00, 0x04, 0x01, 0xa5, 0x01, 0x02,
292 0x03, 0x26, 0x20, 0x01, 0x21, 0x58, 0x20, 0x8b,
293 0x48, 0xf0, 0x69, 0xfb, 0x22, 0xfb, 0xf3, 0x86,
294 0x57, 0x7c, 0xdd, 0x82, 0x2c, 0x1c, 0x0c, 0xdc,
295 0x27, 0xe2, 0x6a, 0x4c, 0x1a, 0x10, 0x04, 0x27,
296 0x51, 0x3e, 0x2a, 0x9d, 0x3a, 0xb6, 0xb5, 0x22,
297 0x58, 0x20, 0x70, 0xfe, 0x91, 0x67, 0x64, 0x53,
298 0x63, 0x83, 0x72, 0x31, 0xe9, 0xe5, 0x20, 0xb7,
299 0x00, 0x15, 0x00, 0x04, 0x02, 0xee, 0xc9, 0xfb,
300 0x63, 0xd7, 0xe4, 0x76, 0x39, 0x80, 0x82, 0x74,
301 0xb8, 0xfa, 0x67, 0xf5, 0x1b, 0x8f, 0xe0, 0x0a,
302 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
303 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
304 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
305 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
306 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
307 0x00, 0x15, 0x00, 0x04, 0x90, 0x00, 0xc3, 0x00,
308 0xa4, 0x06, 0xa3, 0x62, 0x69, 0x64, 0x58, 0x20,
309 0xf9, 0xa3, 0x67, 0xbf, 0x5e, 0x80, 0x95, 0xdb,
310 0x4c, 0xc5, 0x8f, 0x65, 0x36, 0xc5, 0xaf, 0xdd,
311 0x90, 0x2e, 0x62, 0x68, 0x67, 0x9c, 0xa2, 0x26,
312 0x2f, 0x2a, 0xf9, 0x3a, 0xda, 0x15, 0xf2, 0x27,
313 0x64, 0x6e, 0x61, 0x6d, 0x65, 0x6a, 0x62, 0x6f,
314 0x62, 0x20, 0x62, 0x61, 0x6e, 0x61, 0x6e, 0x61,
315 0x00, 0x15, 0x00, 0x04, 0x00, 0x6b, 0x64, 0x69,
316 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d,
317 0x65, 0x67, 0x62, 0x62, 0x61, 0x6e, 0x61, 0x6e,
318 0x61, 0x07, 0xa2, 0x62, 0x69, 0x64, 0x50, 0xfb,
319 0xa6, 0xbe, 0xc1, 0x01, 0xf6, 0x7a, 0x81, 0xf9,
320 0xcd, 0x6d, 0x20, 0x41, 0x7a, 0x1c, 0x40, 0x64,
321 0x74, 0x79, 0x70, 0x65, 0x6a, 0x70, 0x75, 0x62,
322 0x6c, 0x69, 0x63, 0x2d, 0x6b, 0x65, 0x79, 0x08,
323 0x00, 0x15, 0x00, 0x04, 0x01, 0xa5, 0x01, 0x02,
324 0x03, 0x26, 0x20, 0x01, 0x21, 0x58, 0x20, 0xda,
325 0x2b, 0x53, 0xc3, 0xbe, 0x48, 0xf8, 0xab, 0xbd,
326 0x06, 0x28, 0x46, 0xfa, 0x35, 0xab, 0xf9, 0xc5,
327 0x2e, 0xfd, 0x3c, 0x38, 0x88, 0xb3, 0xe1, 0xa7,
328 0xc5, 0xc6, 0xed, 0x72, 0x54, 0x37, 0x93, 0x22,
329 0x58, 0x20, 0x12, 0x82, 0x32, 0x2d, 0xab, 0xbc,
330 0x64, 0xb3, 0xed, 0xcc, 0xd5, 0x22, 0xec, 0x79,
331 0x00, 0x15, 0x00, 0x04, 0x02, 0x4b, 0xe2, 0x4d,
332 0x0c, 0x4b, 0x8d, 0x31, 0x4c, 0xb4, 0x0f, 0xd4,
333 0xa9, 0xbe, 0x0c, 0xab, 0x9e, 0x0a, 0xc9, 0x0a,
334 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
335 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
336 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
337 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
338 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
339}; 77};
340 78
341/* 79/*
@@ -343,46 +81,11 @@ static const uint8_t dummy_rk_wire_data[] = {
343 * 'deleteCredential' credential management command. 81 * 'deleteCredential' credential management command.
344 */ 82 */
345static const uint8_t dummy_del_wire_data[] = { 83static const uint8_t dummy_del_wire_data[] = {
346 0xff, 0xff, 0xff, 0xff, 0x86, 0x00, 0x11, 0x8b, 84 WIREDATA_CTAP_INIT,
347 0xe1, 0xf0, 0x3a, 0x18, 0xa5, 0xda, 0x59, 0x00, 85 WIREDATA_CTAP_CBOR_INFO,
348 0x15, 0x00, 0x05, 0x02, 0x00, 0x04, 0x05, 0x05, 86 WIREDATA_CTAP_CBOR_AUTHKEY,
349 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 87 WIREDATA_CTAP_CBOR_PINTOKEN,
350 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 88 WIREDATA_CTAP_CBOR_STATUS,
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, 0x15, 0x00, 0x05, 0x90, 0x00, 0x51, 0x00,
355 0xa1, 0x01, 0xa5, 0x01, 0x02, 0x03, 0x38, 0x18,
356 0x20, 0x01, 0x21, 0x58, 0x20, 0x12, 0xc1, 0x81,
357 0x6b, 0x92, 0x6a, 0x56, 0x05, 0xfe, 0xdb, 0xab,
358 0x90, 0x2f, 0x57, 0x0b, 0x3d, 0x85, 0x3e, 0x3f,
359 0xbc, 0xe5, 0xd3, 0xb6, 0x86, 0xdf, 0x10, 0x43,
360 0xc2, 0xaf, 0x87, 0x34, 0x0e, 0x22, 0x58, 0x20,
361 0xd3, 0x0f, 0x7e, 0x5d, 0x10, 0x33, 0x57, 0x24,
362 0x00, 0x15, 0x00, 0x05, 0x00, 0x6e, 0x90, 0x58,
363 0x61, 0x2a, 0xd2, 0xc2, 0x1e, 0x08, 0xea, 0x91,
364 0xcb, 0x44, 0x66, 0x73, 0x29, 0x92, 0x29, 0x59,
365 0x91, 0xa3, 0x4d, 0x2c, 0xbb, 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, 0x15, 0x00, 0x05, 0x90, 0x00, 0x14, 0x00,
371 0xa1, 0x02, 0x50, 0x33, 0xf1, 0x3b, 0xde, 0x1e,
372 0xa5, 0xd1, 0xbf, 0xf6, 0x5d, 0x63, 0xb6, 0xfc,
373 0xd2, 0x24, 0xe8, 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, 0x15, 0x00, 0x05, 0x90, 0x00, 0x01, 0x00,
379 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
380 0x00, 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}; 89};
387 90
388int LLVMFuzzerTestOneInput(const uint8_t *, size_t); 91int LLVMFuzzerTestOneInput(const uint8_t *, size_t);
@@ -424,12 +127,20 @@ pack(uint8_t *ptr, size_t len, const struct param *p)
424 return (max - len); 127 return (max - len);
425} 128}
426 129
130static size_t
131input_len(int max)
132{
133 return (2 * len_string(max) + 5 * len_blob(max) + len_int());
134}
135
427static fido_dev_t * 136static fido_dev_t *
428prepare_dev() 137prepare_dev()
429{ 138{
430 fido_dev_t *dev; 139 fido_dev_t *dev;
431 fido_dev_io_t io; 140 fido_dev_io_t io;
432 141
142 memset(&io, 0, sizeof(io));
143
433 io.open = dev_open; 144 io.open = dev_open;
434 io.close = dev_close; 145 io.close = dev_close;
435 io.read = dev_read; 146 io.read = dev_read;
@@ -454,9 +165,9 @@ get_metadata(struct param *p)
454 165
455 set_wire_data(p->meta_wire_data.body, p->meta_wire_data.len); 166 set_wire_data(p->meta_wire_data.body, p->meta_wire_data.len);
456 167
457 if ((dev = prepare_dev()) == NULL) { 168 if ((dev = prepare_dev()) == NULL)
458 return; 169 return;
459 } 170
460 if ((metadata = fido_credman_metadata_new()) == NULL) { 171 if ((metadata = fido_credman_metadata_new()) == NULL) {
461 fido_dev_close(dev); 172 fido_dev_close(dev);
462 fido_dev_free(&dev); 173 fido_dev_free(&dev);
@@ -483,9 +194,9 @@ get_rp_list(struct param *p)
483 194
484 set_wire_data(p->rp_wire_data.body, p->rp_wire_data.len); 195 set_wire_data(p->rp_wire_data.body, p->rp_wire_data.len);
485 196
486 if ((dev = prepare_dev()) == NULL) { 197 if ((dev = prepare_dev()) == NULL)
487 return; 198 return;
488 } 199
489 if ((rp = fido_credman_rp_new()) == NULL) { 200 if ((rp = fido_credman_rp_new()) == NULL) {
490 fido_dev_close(dev); 201 fido_dev_close(dev);
491 fido_dev_free(&dev); 202 fido_dev_free(&dev);
@@ -519,9 +230,9 @@ get_rk_list(struct param *p)
519 230
520 set_wire_data(p->rk_wire_data.body, p->rk_wire_data.len); 231 set_wire_data(p->rk_wire_data.body, p->rk_wire_data.len);
521 232
522 if ((dev = prepare_dev()) == NULL) { 233 if ((dev = prepare_dev()) == NULL)
523 return; 234 return;
524 } 235
525 if ((rk = fido_credman_rk_new()) == NULL) { 236 if ((rk = fido_credman_rk_new()) == NULL) {
526 fido_dev_close(dev); 237 fido_dev_close(dev);
527 fido_dev_free(&dev); 238 fido_dev_free(&dev);
@@ -560,9 +271,8 @@ del_rk(struct param *p)
560 271
561 set_wire_data(p->del_wire_data.body, p->del_wire_data.len); 272 set_wire_data(p->del_wire_data.body, p->del_wire_data.len);
562 273
563 if ((dev = prepare_dev()) == NULL) { 274 if ((dev = prepare_dev()) == NULL)
564 return; 275 return;
565 }
566 276
567 fido_credman_del_dev_rk(dev, p->cred_id.body, p->cred_id.len, p->pin); 277 fido_credman_del_dev_rk(dev, p->cred_id.body, p->cred_id.len, p->pin);
568 fido_dev_close(dev); 278 fido_dev_close(dev);
@@ -576,12 +286,14 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
576 286
577 memset(&p, 0, sizeof(p)); 287 memset(&p, 0, sizeof(p));
578 288
579 if (unpack(data, size, &p) < 0) 289 if (size < input_len(GETLEN_MIN) || size > input_len(GETLEN_MAX) ||
290 unpack(data, size, &p) < 0)
580 return (0); 291 return (0);
581 292
582 srandom((unsigned int)p.seed); 293 prng_init((unsigned int)p.seed);
583 294
584 fido_init(0); 295 fido_init(FIDO_DEBUG);
296 fido_set_log_handler(consume_str);
585 297
586 get_metadata(&p); 298 get_metadata(&p);
587 get_rp_list(&p); 299 get_rp_list(&p);
diff --git a/fuzz/fuzz_mgmt.c b/fuzz/fuzz_mgmt.c
index 741b375..d46daf6 100644
--- a/fuzz/fuzz_mgmt.c
+++ b/fuzz/fuzz_mgmt.c
@@ -11,6 +11,8 @@
11#include <string.h> 11#include <string.h>
12 12
13#include "mutator_aux.h" 13#include "mutator_aux.h"
14#include "wiredata_fido2.h"
15#include "dummy.h"
14#include "fido.h" 16#include "fido.h"
15 17
16#include "../openbsd-compat/openbsd-compat.h" 18#include "../openbsd-compat/openbsd-compat.h"
@@ -35,207 +37,39 @@ struct param {
35 int seed; 37 int seed;
36}; 38};
37 39
38/* Example parameters. */
39static const char dummy_pin1[] = "skepp cg0u3;Y..";
40static const char dummy_pin2[] = "bastilha 6rJrfQZI.";
41
42static const uint8_t dummy_reset_wire_data[] = { 40static const uint8_t dummy_reset_wire_data[] = {
43 0xff, 0xff, 0xff, 0xff, 0x86, 0x00, 0x11, 0x91, 41 WIREDATA_CTAP_INIT,
44 0xef, 0xbe, 0x74, 0x39, 0x1a, 0x1c, 0x4a, 0x00, 42 WIREDATA_CTAP_CBOR_INFO,
45 0x22, 0x00, 0x01, 0x02, 0x05, 0x02, 0x01, 0x05, 43 WIREDATA_CTAP_KEEPALIVE,
46 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 44 WIREDATA_CTAP_KEEPALIVE,
47 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 45 WIREDATA_CTAP_KEEPALIVE,
48 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 46 WIREDATA_CTAP_CBOR_RESET,
49 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
50 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
51 0x00, 0x22, 0x00, 0x01, 0xbb, 0x00, 0x01, 0x02,
52 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
53 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
54 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
55 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
56 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
57 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
58 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
59 0x00, 0x22, 0x00, 0x01, 0xbb, 0x00, 0x01, 0x02,
60 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
61 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
62 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
63 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
64 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
65 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
66 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
67 0x00, 0x22, 0x00, 0x01, 0xbb, 0x00, 0x01, 0x02,
68 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
69 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
70 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
71 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
72 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
73 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
74 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
75 0x00, 0x22, 0x00, 0x01, 0xbb, 0x00, 0x01, 0x02,
76 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
77 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
78 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
79 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
80 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
81 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
82 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
83 0x00, 0x22, 0x00, 0x01, 0xbb, 0x00, 0x01, 0x02,
84 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
85 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
86 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
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, 0x22, 0x00, 0x01, 0xbb, 0x00, 0x01, 0x01,
92 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
93 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
94 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
95 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
96 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
97 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
98 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
99 0x00, 0x22, 0x00, 0x01, 0x90, 0x00, 0x01, 0x00,
100 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
101 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
102 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
103 0x00, 0x00, 0x00, 0x00, 0x00, 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}; 47};
108 48
109static const uint8_t dummy_info_wire_data[] = { 49static const uint8_t dummy_info_wire_data[] = {
110 0xff, 0xff, 0xff, 0xff, 0x86, 0x00, 0x11, 0x80, 50 WIREDATA_CTAP_INIT,
111 0x43, 0x56, 0x40, 0xb1, 0x4e, 0xd9, 0x2d, 0x00, 51 WIREDATA_CTAP_CBOR_INFO,
112 0x22, 0x00, 0x02, 0x02, 0x05, 0x02, 0x01, 0x05, 52 WIREDATA_CTAP_CBOR_INFO,
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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
117 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
118 0x00, 0x22, 0x00, 0x02, 0x90, 0x00, 0xb9, 0x00,
119 0xa9, 0x01, 0x83, 0x66, 0x55, 0x32, 0x46, 0x5f,
120 0x56, 0x32, 0x68, 0x46, 0x49, 0x44, 0x4f, 0x5f,
121 0x32, 0x5f, 0x30, 0x6c, 0x46, 0x49, 0x44, 0x4f,
122 0x5f, 0x32, 0x5f, 0x31, 0x5f, 0x50, 0x52, 0x45,
123 0x02, 0x82, 0x6b, 0x63, 0x72, 0x65, 0x64, 0x50,
124 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x6b, 0x68,
125 0x6d, 0x61, 0x63, 0x2d, 0x73, 0x65, 0x63, 0x72,
126 0x00, 0x22, 0x00, 0x02, 0x00, 0x65, 0x74, 0x03,
127 0x50, 0x19, 0x56, 0xe5, 0xbd, 0xa3, 0x74, 0x45,
128 0xf1, 0xa8, 0x14, 0x35, 0x64, 0x03, 0xfd, 0xbc,
129 0x18, 0x04, 0xa5, 0x62, 0x72, 0x6b, 0xf5, 0x62,
130 0x75, 0x70, 0xf5, 0x64, 0x70, 0x6c, 0x61, 0x74,
131 0xf4, 0x69, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74,
132 0x50, 0x69, 0x6e, 0xf4, 0x75, 0x63, 0x72, 0x65,
133 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4d,
134 0x00, 0x22, 0x00, 0x02, 0x01, 0x67, 0x6d, 0x74,
135 0x50, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0xf5,
136 0x05, 0x19, 0x04, 0xb0, 0x06, 0x81, 0x01, 0x07,
137 0x08, 0x08, 0x18, 0x80, 0x0a, 0x82, 0xa2, 0x63,
138 0x61, 0x6c, 0x67, 0x26, 0x64, 0x74, 0x79, 0x70,
139 0x65, 0x6a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63,
140 0x2d, 0x6b, 0x65, 0x79, 0xa2, 0x63, 0x61, 0x6c,
141 0x67, 0x27, 0x64, 0x74, 0x79, 0x70, 0x65, 0x6a,
142 0x00, 0x22, 0x00, 0x02, 0x02, 0x70, 0x75, 0x62,
143 0x6c, 0x69, 0x63, 0x2d, 0x6b, 0x65, 0x79, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
149 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
150}; 53};
151 54
152static const uint8_t dummy_set_pin_wire_data[] = { 55static const uint8_t dummy_set_pin_wire_data[] = {
153 0xff, 0xff, 0xff, 0xff, 0x86, 0x00, 0x11, 0x59, 56 WIREDATA_CTAP_INIT,
154 0x50, 0x8c, 0x27, 0x14, 0x83, 0x43, 0xd5, 0x00, 57 WIREDATA_CTAP_CBOR_INFO,
155 0x22, 0x00, 0x03, 0x02, 0x05, 0x02, 0x01, 0x05, 58 WIREDATA_CTAP_CBOR_AUTHKEY,
156 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 59 WIREDATA_CTAP_CBOR_STATUS,
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, 0x22, 0x00, 0x03, 0x90, 0x00, 0x51, 0x00,
162 0xa1, 0x01, 0xa5, 0x01, 0x02, 0x03, 0x38, 0x18,
163 0x20, 0x01, 0x21, 0x58, 0x20, 0x2a, 0xb8, 0x2d,
164 0x36, 0x69, 0xab, 0x30, 0x9d, 0xe3, 0x5e, 0x9b,
165 0xfb, 0x94, 0xfc, 0x1d, 0x92, 0x95, 0xaf, 0x01,
166 0x47, 0xfe, 0x4b, 0x87, 0xe5, 0xcf, 0x3f, 0x05,
167 0x0b, 0x39, 0xda, 0x17, 0x49, 0x22, 0x58, 0x20,
168 0x15, 0x1b, 0xbe, 0x08, 0x78, 0x60, 0x4d, 0x3c,
169 0x00, 0x22, 0x00, 0x03, 0x00, 0x3f, 0xf1, 0x60,
170 0xa6, 0xd8, 0xf8, 0xed, 0xce, 0x4a, 0x30, 0x5d,
171 0x1a, 0xaf, 0x80, 0xc4, 0x0a, 0xd2, 0x6f, 0x77,
172 0x38, 0x12, 0x97, 0xaa, 0xbd, 0x00, 0x00, 0x00,
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, 0x22, 0x00, 0x03, 0x90, 0x00, 0x01, 0x00,
178 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
179 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
180 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
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}; 60};
186 61
187static const uint8_t dummy_change_pin_wire_data[] = { 62static const uint8_t dummy_change_pin_wire_data[] = {
188 0xff, 0xff, 0xff, 0xff, 0x86, 0x00, 0x11, 0x48, 63 WIREDATA_CTAP_INIT,
189 0xfd, 0xf9, 0xde, 0x28, 0x21, 0x99, 0xd5, 0x00, 64 WIREDATA_CTAP_CBOR_INFO,
190 0x22, 0x00, 0x04, 0x02, 0x05, 0x02, 0x01, 0x05, 65 WIREDATA_CTAP_CBOR_AUTHKEY,
191 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 66 WIREDATA_CTAP_CBOR_STATUS,
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, 0x22, 0x00, 0x04, 0x90, 0x00, 0x51, 0x00,
197 0xa1, 0x01, 0xa5, 0x01, 0x02, 0x03, 0x38, 0x18,
198 0x20, 0x01, 0x21, 0x58, 0x20, 0x2a, 0xb8, 0x2d,
199 0x36, 0x69, 0xab, 0x30, 0x9d, 0xe3, 0x5e, 0x9b,
200 0xfb, 0x94, 0xfc, 0x1d, 0x92, 0x95, 0xaf, 0x01,
201 0x47, 0xfe, 0x4b, 0x87, 0xe5, 0xcf, 0x3f, 0x05,
202 0x0b, 0x39, 0xda, 0x17, 0x49, 0x22, 0x58, 0x20,
203 0x15, 0x1b, 0xbe, 0x08, 0x78, 0x60, 0x4d, 0x3c,
204 0x00, 0x22, 0x00, 0x04, 0x00, 0x3f, 0xf1, 0x60,
205 0xa6, 0xd8, 0xf8, 0xed, 0xce, 0x4a, 0x30, 0x5d,
206 0x1a, 0xaf, 0x80, 0xc4, 0x0a, 0xd2, 0x6f, 0x77,
207 0x38, 0x12, 0x97, 0xaa, 0xbd, 0x00, 0x00, 0x00,
208 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
209 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
210 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
211 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
212 0x00, 0x22, 0x00, 0x04, 0x90, 0x00, 0x01, 0x00,
213 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
214 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
215 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
216 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
217 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
218 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
219 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
220}; 67};
221 68
222static const uint8_t dummy_retry_wire_data[] = { 69static const uint8_t dummy_retry_wire_data[] = {
223 0xff, 0xff, 0xff, 0xff, 0x86, 0x00, 0x11, 0x7f, 70 WIREDATA_CTAP_INIT,
224 0xaa, 0x73, 0x3e, 0x95, 0x98, 0xa8, 0x60, 0x00, 71 WIREDATA_CTAP_CBOR_INFO,
225 0x22, 0x00, 0x05, 0x02, 0x05, 0x02, 0x01, 0x05, 72 WIREDATA_CTAP_CBOR_RETRIES,
226 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
227 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
228 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
229 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
230 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
231 0x00, 0x22, 0x00, 0x05, 0x90, 0x00, 0x04, 0x00,
232 0xa1, 0x03, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
233 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
234 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
235 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
236 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
237 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
238 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
239}; 73};
240 74
241int LLVMFuzzerTestOneInput(const uint8_t *, size_t); 75int LLVMFuzzerTestOneInput(const uint8_t *, size_t);
@@ -277,12 +111,20 @@ pack(uint8_t *ptr, size_t len, const struct param *p)
277 return (max - len); 111 return (max - len);
278} 112}
279 113
114static size_t
115input_len(int max)
116{
117 return (2 * len_string(max) + 5 * len_blob(max) + len_int());
118}
119
280static fido_dev_t * 120static fido_dev_t *
281prepare_dev() 121prepare_dev()
282{ 122{
283 fido_dev_t *dev; 123 fido_dev_t *dev;
284 fido_dev_io_t io; 124 fido_dev_io_t io;
285 125
126 memset(&io, 0, sizeof(io));
127
286 io.open = dev_open; 128 io.open = dev_open;
287 io.close = dev_close; 129 io.close = dev_close;
288 io.read = dev_read; 130 io.read = dev_read;
@@ -304,9 +146,8 @@ dev_reset(struct param *p)
304 146
305 set_wire_data(p->reset_wire_data.body, p->reset_wire_data.len); 147 set_wire_data(p->reset_wire_data.body, p->reset_wire_data.len);
306 148
307 if ((dev = prepare_dev()) == NULL) { 149 if ((dev = prepare_dev()) == NULL)
308 return; 150 return;
309 }
310 151
311 fido_dev_reset(dev); 152 fido_dev_reset(dev);
312 fido_dev_close(dev); 153 fido_dev_close(dev);
@@ -327,9 +168,8 @@ dev_get_cbor_info(struct param *p)
327 168
328 set_wire_data(p->info_wire_data.body, p->info_wire_data.len); 169 set_wire_data(p->info_wire_data.body, p->info_wire_data.len);
329 170
330 if ((dev = prepare_dev()) == NULL) { 171 if ((dev = prepare_dev()) == NULL)
331 return; 172 return;
332 }
333 173
334 proto = fido_dev_protocol(dev); 174 proto = fido_dev_protocol(dev);
335 major = fido_dev_major(dev); 175 major = fido_dev_major(dev);
@@ -343,15 +183,10 @@ dev_get_cbor_info(struct param *p)
343 consume(&build, sizeof(build)); 183 consume(&build, sizeof(build));
344 consume(&flags, sizeof(flags)); 184 consume(&flags, sizeof(flags));
345 185
346 if ((ci = fido_cbor_info_new()) == NULL) { 186 if ((ci = fido_cbor_info_new()) == NULL)
347 fido_dev_close(dev); 187 goto out;
348 fido_dev_free(&dev);
349 return;
350 }
351 188
352 fido_dev_get_cbor_info(dev, ci); 189 fido_dev_get_cbor_info(dev, ci);
353 fido_dev_close(dev);
354 fido_dev_free(&dev);
355 190
356 for (size_t i = 0; i < fido_cbor_info_versions_len(ci); i++) { 191 for (size_t i = 0; i < fido_cbor_info_versions_len(ci); i++) {
357 char * const *sa = fido_cbor_info_versions_ptr(ci); 192 char * const *sa = fido_cbor_info_versions_ptr(ci);
@@ -372,10 +207,17 @@ dev_get_cbor_info(struct param *p)
372 n = fido_cbor_info_maxmsgsiz(ci); 207 n = fido_cbor_info_maxmsgsiz(ci);
373 consume(&n, sizeof(n)); 208 consume(&n, sizeof(n));
374 209
210 n = fido_cbor_info_fwversion(ci);
211 consume(&n, sizeof(n));
212
375 consume(fido_cbor_info_aaguid_ptr(ci), fido_cbor_info_aaguid_len(ci)); 213 consume(fido_cbor_info_aaguid_ptr(ci), fido_cbor_info_aaguid_len(ci));
376 consume(fido_cbor_info_protocols_ptr(ci), 214 consume(fido_cbor_info_protocols_ptr(ci),
377 fido_cbor_info_protocols_len(ci)); 215 fido_cbor_info_protocols_len(ci));
378 216
217out:
218 fido_dev_close(dev);
219 fido_dev_free(&dev);
220
379 fido_cbor_info_free(&ci); 221 fido_cbor_info_free(&ci);
380} 222}
381 223
@@ -386,9 +228,8 @@ dev_set_pin(struct param *p)
386 228
387 set_wire_data(p->set_pin_wire_data.body, p->set_pin_wire_data.len); 229 set_wire_data(p->set_pin_wire_data.body, p->set_pin_wire_data.len);
388 230
389 if ((dev = prepare_dev()) == NULL) { 231 if ((dev = prepare_dev()) == NULL)
390 return; 232 return;
391 }
392 233
393 fido_dev_set_pin(dev, p->pin1, NULL); 234 fido_dev_set_pin(dev, p->pin1, NULL);
394 fido_dev_close(dev); 235 fido_dev_close(dev);
@@ -402,9 +243,8 @@ dev_change_pin(struct param *p)
402 243
403 set_wire_data(p->change_pin_wire_data.body, p->change_pin_wire_data.len); 244 set_wire_data(p->change_pin_wire_data.body, p->change_pin_wire_data.len);
404 245
405 if ((dev = prepare_dev()) == NULL) { 246 if ((dev = prepare_dev()) == NULL)
406 return; 247 return;
407 }
408 248
409 fido_dev_set_pin(dev, p->pin2, p->pin1); 249 fido_dev_set_pin(dev, p->pin2, p->pin1);
410 fido_dev_close(dev); 250 fido_dev_close(dev);
@@ -419,9 +259,8 @@ dev_get_retry_count(struct param *p)
419 259
420 set_wire_data(p->retry_wire_data.body, p->retry_wire_data.len); 260 set_wire_data(p->retry_wire_data.body, p->retry_wire_data.len);
421 261
422 if ((dev = prepare_dev()) == NULL) { 262 if ((dev = prepare_dev()) == NULL)
423 return; 263 return;
424 }
425 264
426 fido_dev_get_retry_count(dev, &n); 265 fido_dev_get_retry_count(dev, &n);
427 consume(&n, sizeof(n)); 266 consume(&n, sizeof(n));
@@ -436,12 +275,14 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
436 275
437 memset(&p, 0, sizeof(p)); 276 memset(&p, 0, sizeof(p));
438 277
439 if (unpack(data, size, &p) < 0) 278 if (size < input_len(GETLEN_MIN) || size > input_len(GETLEN_MAX) ||
279 unpack(data, size, &p) < 0)
440 return (0); 280 return (0);
441 281
442 srandom((unsigned int)p.seed); 282 prng_init((unsigned int)p.seed);
443 283
444 fido_init(0); 284 fido_init(FIDO_DEBUG);
285 fido_set_log_handler(consume_str);
445 286
446 dev_reset(&p); 287 dev_reset(&p);
447 dev_get_cbor_info(&p); 288 dev_get_cbor_info(&p);
diff --git a/fuzz/harnesses/assert b/fuzz/harnesses/assert
deleted file mode 100755
index 55cd889..0000000
--- a/fuzz/harnesses/assert
+++ /dev/null
@@ -1,32 +0,0 @@
1#!/bin/bash -u
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
6T=assert
7
8sync() {
9 mkdir ${T}
10 ssh "${REMOTE}" "cd ${T}/afl-out && tar -cf- queue ../pubkey" | \
11 tar -C ${T} -xf-
12}
13
14run() {
15 find ${T}/queue -type f | while read f; do
16 cat "${f}" | LD_PRELOAD=${PRELOAD} build/examples/assert \
17 ${T}/pubkey nodev 2>/dev/null 1>&2
18 done
19}
20
21case "$1" in
22sync)
23 sync
24 ;;
25run)
26 run
27 exit 0
28 ;;
29*)
30 echo unknown command "$1"
31 exit 1
32esac
diff --git a/fuzz/harnesses/assert-rsa-h-p b/fuzz/harnesses/assert-rsa-h-p
deleted file mode 100755
index 8eb9ea6..0000000
--- a/fuzz/harnesses/assert-rsa-h-p
+++ /dev/null
@@ -1,33 +0,0 @@
1#!/bin/bash -u
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
6T=assert-rsa-h-p
7
8sync() {
9 mkdir ${T}
10 ssh "${REMOTE}" "cd ${T}/afl-out && tar -cf- queue ../pubkey ../hmac-salt" | \
11 tar -C ${T} -xf-
12}
13
14run() {
15 find ${T}/queue -type f | while read f; do
16 cat "${f}" | LD_PRELOAD=${PRELOAD} build/examples/assert \
17 -t rsa -h ${T}/hmac-out -s ${T}/hmac-salt \
18 -p ${T}/pubkey nodev 2>/dev/null 1>&2
19 done
20}
21
22case "$1" in
23sync)
24 sync
25 ;;
26run)
27 run
28 exit 0
29 ;;
30*)
31 echo unknown command "$1"
32 exit 1
33esac
diff --git a/fuzz/harnesses/assert-u2f b/fuzz/harnesses/assert-u2f
deleted file mode 100755
index 257d1d6..0000000
--- a/fuzz/harnesses/assert-u2f
+++ /dev/null
@@ -1,32 +0,0 @@
1#!/bin/bash -u
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
6T=assert-u2f
7
8sync() {
9 mkdir ${T}
10 ssh "${REMOTE}" "cd ${T}/afl-out && tar -cf- queue ../cred_id ../pubkey" | \
11 tar -C ${T} -xf-
12}
13
14run() {
15 find ${T}/queue -type f | while read f; do
16 cat "${f}" | LD_PRELOAD=${PRELOAD} build/examples/assert -up \
17 -a ${T}/cred_id ${T}/pubkey nodev 2>/dev/null 1>&2
18 done
19}
20
21case "$1" in
22sync)
23 sync
24 ;;
25run)
26 run
27 exit 0
28 ;;
29*)
30 echo unknown command "$1"
31 exit 1
32esac
diff --git a/fuzz/harnesses/cred b/fuzz/harnesses/cred
deleted file mode 100755
index 71ee845..0000000
--- a/fuzz/harnesses/cred
+++ /dev/null
@@ -1,31 +0,0 @@
1#!/bin/bash -u
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
6T=cred
7
8sync() {
9 mkdir ${T}
10 ssh "${REMOTE}" "cd ${T}/afl-out && tar -cf- queue" | tar -C ${T} -xf-
11}
12
13run() {
14 find ${T}/queue -type f | while read f; do
15 cat "${f}" | LD_PRELOAD=${PRELOAD} build/examples/cred \
16 -k ${T}/pubkey -i ${T}/cred_id nodev 2>/dev/null 1>&2
17 done
18}
19
20case "$1" in
21sync)
22 sync
23 ;;
24run)
25 run
26 exit 0
27 ;;
28*)
29 echo unknown command "$1"
30 exit 1
31esac
diff --git a/fuzz/harnesses/cred-rsa-h-p b/fuzz/harnesses/cred-rsa-h-p
deleted file mode 100755
index bb14c23..0000000
--- a/fuzz/harnesses/cred-rsa-h-p
+++ /dev/null
@@ -1,32 +0,0 @@
1#!/bin/bash -u
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
6T=cred-rsa-h-p
7
8sync() {
9 mkdir ${T}
10 ssh "${REMOTE}" "cd ${T}/afl-out && tar -cf- queue" | tar -C ${T} -xf-
11}
12
13run() {
14 find ${T}/queue -type f | while read f; do
15 cat "${f}" | LD_PRELOAD=${PRELOAD} build/examples/cred \
16 -t rsa -r -k ${T}/pubkey -i ${T}/cred_id -h nodev \
17 2>/dev/null 1>&2
18 done
19}
20
21case "$1" in
22sync)
23 sync
24 ;;
25run)
26 run
27 exit 0
28 ;;
29*)
30 echo unknown command "$1"
31 exit 1
32esac
diff --git a/fuzz/harnesses/cred-u2f b/fuzz/harnesses/cred-u2f
deleted file mode 100755
index 3af4393..0000000
--- a/fuzz/harnesses/cred-u2f
+++ /dev/null
@@ -1,31 +0,0 @@
1#!/bin/bash -u
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
6T=cred-u2f
7
8sync() {
9 mkdir ${T}
10 ssh "${REMOTE}" "cd ${T}/afl-out && tar -cf- queue" | tar -C ${T} -xf-
11}
12
13run() {
14 find ${T}/queue -type f | while read f; do
15 cat "${f}" | LD_PRELOAD=${PRELOAD} build/examples/cred \
16 -k ${T}/pubkey -i ${T}/cred_id -u nodev 2>/dev/null 1>&2
17 done
18}
19
20case "$1" in
21sync)
22 sync
23 ;;
24run)
25 run
26 exit 0
27 ;;
28*)
29 echo unknown command "$1"
30 exit 1
31esac
diff --git a/fuzz/harnesses/cred-u2f-exclude b/fuzz/harnesses/cred-u2f-exclude
deleted file mode 100755
index 3777134..0000000
--- a/fuzz/harnesses/cred-u2f-exclude
+++ /dev/null
@@ -1,33 +0,0 @@
1#!/bin/bash -u
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
6T=cred-u2f-exclude
7
8sync() {
9 mkdir ${T}
10 ssh "${REMOTE}" "cd ${T}/afl-out && tar -cf- queue ../excl_id" | \
11 tar -C ${T} -xf-
12}
13
14run() {
15 find ${T}/queue -type f | while read f; do
16 cat "${f}" | LD_PRELOAD=${PRELOAD} build/examples/cred \
17 -k ${T}/pubkey -i ${T}/cred_id -e ${T}/excl_id \
18 -u nodev 2>/dev/null 1>&2
19 done
20}
21
22case "$1" in
23sync)
24 sync
25 ;;
26run)
27 run
28 exit 0
29 ;;
30*)
31 echo unknown command "$1"
32 exit 1
33esac
diff --git a/fuzz/harnesses/fido2-assert-G b/fuzz/harnesses/fido2-assert-G
deleted file mode 100755
index 6671449..0000000
--- a/fuzz/harnesses/fido2-assert-G
+++ /dev/null
@@ -1,31 +0,0 @@
1#!/bin/bash -u
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
6T=fido2-assert-G
7
8sync() {
9 mkdir ${T}
10 ssh "${REMOTE}" "cd ${T}/afl-out && tar -cf- queue" | tar -C ${T} -xf-
11}
12
13run() {
14 find ${T}/queue -type f | while read f; do
15 cat "${f}" | LD_PRELOAD=${PRELOAD} build/tools/fido2-assert \
16 -G -i - nodev 2>/dev/null 1>&2
17 done
18}
19
20case "$1" in
21sync)
22 sync
23 ;;
24run)
25 run
26 exit 0
27 ;;
28*)
29 echo unknown command "$1"
30 exit 1
31esac
diff --git a/fuzz/harnesses/fido2-assert-V b/fuzz/harnesses/fido2-assert-V
deleted file mode 100755
index 898cb0f..0000000
--- a/fuzz/harnesses/fido2-assert-V
+++ /dev/null
@@ -1,32 +0,0 @@
1#!/bin/bash -u
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
6T=fido2-assert-V
7
8sync() {
9 mkdir ${T}
10 ssh "${REMOTE}" "cd ${T}/afl-out && tar -cf- queue ../pubkey" | \
11 tar -C ${T} -xf-
12}
13
14run() {
15 find ${T}/queue -type f | while read f; do
16 cat "${f}" | LD_PRELOAD=${PRELOAD} build/tools/fido2-assert -V \
17 pubkey es256 2>/dev/null 1>&2
18 done
19}
20
21case "$1" in
22sync)
23 sync
24 ;;
25run)
26 run
27 exit 0
28 ;;
29*)
30 echo unknown command "$1"
31 exit 1
32esac
diff --git a/fuzz/harnesses/fido2-cred-M b/fuzz/harnesses/fido2-cred-M
deleted file mode 100755
index f82fbf7..0000000
--- a/fuzz/harnesses/fido2-cred-M
+++ /dev/null
@@ -1,31 +0,0 @@
1#!/bin/bash -u
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
6T=fido2-cred-M
7
8sync() {
9 mkdir ${T}
10 ssh "${REMOTE}" "cd ${T}/afl-out && tar -cf- queue" | tar -C ${T} -xf-
11}
12
13run() {
14 find ${T}/queue -type f | while read f; do
15 cat "${f}" | LD_PRELOAD=${PRELOAD} build/tools/fido2-cred -M \
16 -q -i - nodev 2>/dev/null 1>&2
17 done
18}
19
20case "$1" in
21sync)
22 sync
23 ;;
24run)
25 run
26 exit 0
27 ;;
28*)
29 echo unknown command "$1"
30 exit 1
31esac
diff --git a/fuzz/harnesses/fido2-cred-V b/fuzz/harnesses/fido2-cred-V
deleted file mode 100755
index 13a648f..0000000
--- a/fuzz/harnesses/fido2-cred-V
+++ /dev/null
@@ -1,31 +0,0 @@
1#!/bin/bash -u
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
6T=fido2-cred-V
7
8sync() {
9 mkdir ${T}
10 ssh "${REMOTE}" "cd ${T}/afl-out && tar -cf- queue" | tar -C ${T} -xf-
11}
12
13run() {
14 find ${T}/queue -type f | while read f; do
15 cat "${f}" | LD_PRELOAD=${PRELOAD} build/tools/fido2-cred -V \
16 -o cred 2>/dev/null 1>&2
17 done
18}
19
20case "$1" in
21sync)
22 sync
23 ;;
24run)
25 run
26 exit 0
27 ;;
28*)
29 echo unknown command "$1"
30 exit 1
31esac
diff --git a/fuzz/harnesses/fuzz_assert b/fuzz/harnesses/fuzz_assert
deleted file mode 100755
index 6a0baa9..0000000
--- a/fuzz/harnesses/fuzz_assert
+++ /dev/null
@@ -1,29 +0,0 @@
1#!/bin/bash -u
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
6T=fuzz_assert
7
8sync() {
9 mkdir ${T}
10 ssh "${REMOTE}" "cd ${T} && tar -cf- corpus" | tar -C ${T} -xf-
11}
12
13run() {
14 build/fuzz/fuzz_assert -max_len=17408 -runs=1 ${T}/corpus \
15 2>/dev/null 1>&2
16}
17
18case "$1" in
19sync)
20 sync
21 ;;
22run)
23 run
24 exit 0
25 ;;
26*)
27 echo unknown command "$1"
28 exit 1
29esac
diff --git a/fuzz/harnesses/fuzz_bio b/fuzz/harnesses/fuzz_bio
deleted file mode 100755
index f4bab19..0000000
--- a/fuzz/harnesses/fuzz_bio
+++ /dev/null
@@ -1,29 +0,0 @@
1#!/bin/bash -u
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
6T=fuzz_bio
7
8sync() {
9 mkdir ${T}
10 ssh "${REMOTE}" "cd ${T} && tar -cf- corpus" | tar -C ${T} -xf-
11}
12
13run() {
14 build/fuzz/fuzz_bio -max_len=17408 -runs=1 ${T}/corpus \
15 2>/dev/null 1>&2
16}
17
18case "$1" in
19sync)
20 sync
21 ;;
22run)
23 run
24 exit 0
25 ;;
26*)
27 echo unknown command "$1"
28 exit 1
29esac
diff --git a/fuzz/harnesses/fuzz_cred b/fuzz/harnesses/fuzz_cred
deleted file mode 100755
index 8dfb168..0000000
--- a/fuzz/harnesses/fuzz_cred
+++ /dev/null
@@ -1,28 +0,0 @@
1#!/bin/bash -u
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
6T=fuzz_cred
7
8sync() {
9 mkdir ${T}
10 ssh "${REMOTE}" "cd ${T} && tar -cf- corpus" | tar -C ${T} -xf-
11}
12
13run() {
14 build/fuzz/fuzz_cred -max_len=17408 -runs=1 ${T}/corpus 2>/dev/null 1>&2
15}
16
17case "$1" in
18sync)
19 sync
20 ;;
21run)
22 run
23 exit 0
24 ;;
25*)
26 echo unknown command "$1"
27 exit 1
28esac
diff --git a/fuzz/harnesses/fuzz_credman b/fuzz/harnesses/fuzz_credman
deleted file mode 100755
index 7721a58..0000000
--- a/fuzz/harnesses/fuzz_credman
+++ /dev/null
@@ -1,28 +0,0 @@
1#!/bin/bash -u
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
6T=fuzz_credman
7
8sync() {
9 mkdir ${T}
10 ssh "${REMOTE}" "cd ${T} && tar -cf- corpus" | tar -C ${T} -xf-
11}
12
13run() {
14 build/fuzz/fuzz_credman -max_len=17408 -runs=1 ${T}/corpus 2>/dev/null 1>&2
15}
16
17case "$1" in
18sync)
19 sync
20 ;;
21run)
22 run
23 exit 0
24 ;;
25*)
26 echo unknown command "$1"
27 exit 1
28esac
diff --git a/fuzz/harnesses/fuzz_mgmt b/fuzz/harnesses/fuzz_mgmt
deleted file mode 100755
index 9224eea..0000000
--- a/fuzz/harnesses/fuzz_mgmt
+++ /dev/null
@@ -1,29 +0,0 @@
1#!/bin/bash -u
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
6T=fuzz_mgmt
7
8sync() {
9 mkdir ${T}
10 ssh "${REMOTE}" "cd ${T} && tar -cf- corpus" | tar -C ${T} -xf-
11}
12
13run() {
14 build/fuzz/fuzz_mgmt -max_len=17408 -runs=1 ${T}/corpus \
15 2>/dev/null 1>&2
16}
17
18case "$1" in
19sync)
20 sync
21 ;;
22run)
23 run
24 exit 0
25 ;;
26*)
27 echo unknown command "$1"
28 exit 1
29esac
diff --git a/fuzz/mutator_aux.c b/fuzz/mutator_aux.c
index 24aa716..fe09438 100644
--- a/fuzz/mutator_aux.c
+++ b/fuzz/mutator_aux.c
@@ -37,6 +37,12 @@ consume(const void *body, size_t len)
37 x ^= *ptr++; 37 x ^= *ptr++;
38} 38}
39 39
40void
41consume_str(const char *str)
42{
43 consume(str, strlen(str));
44}
45
40int 46int
41unpack_int(uint8_t t, uint8_t **ptr, size_t *len, int *v) NO_MSAN 47unpack_int(uint8_t t, uint8_t **ptr, size_t *len, int *v) NO_MSAN
42{ 48{
@@ -227,6 +233,30 @@ pack_blob(uint8_t t, uint8_t **ptr, size_t *len, const struct blob *v) NO_MSAN
227 return (0); 233 return (0);
228} 234}
229 235
236size_t
237len_int(void)
238{
239 return (sizeof(uint8_t) + sizeof(size_t) + sizeof(int));
240}
241
242size_t
243len_string(int max)
244{
245 return ((sizeof(uint8_t) + sizeof(size_t)) + (max ? MAXSTR - 1 : 0));
246}
247
248size_t
249len_byte(void)
250{
251 return (sizeof(uint8_t) + sizeof(size_t) + sizeof(uint8_t));
252}
253
254size_t
255len_blob(int max)
256{
257 return (sizeof(uint8_t) + sizeof(size_t) + (max ? MAXBLOB : 0));
258}
259
230void 260void
231mutate_byte(uint8_t *b) 261mutate_byte(uint8_t *b)
232{ 262{
diff --git a/fuzz/mutator_aux.h b/fuzz/mutator_aux.h
index 687f130..d14e177 100644
--- a/fuzz/mutator_aux.h
+++ b/fuzz/mutator_aux.h
@@ -7,6 +7,9 @@
7#ifndef _MUTATOR_AUX_H 7#ifndef _MUTATOR_AUX_H
8#define _MUTATOR_AUX_H 8#define _MUTATOR_AUX_H
9 9
10#include <stddef.h>
11#include <stdint.h>
12
10/* 13/*
11 * As of LLVM 7.0.1, MSAN support in libFuzzer was still experimental. 14 * As of LLVM 7.0.1, MSAN support in libFuzzer was still experimental.
12 * We therefore have to be careful when using our custom mutator, or 15 * We therefore have to be careful when using our custom mutator, or
@@ -31,6 +34,9 @@
31#define MAXSTR 1024 34#define MAXSTR 1024
32#define MAXBLOB 3072 35#define MAXBLOB 3072
33 36
37#define GETLEN_MIN 0
38#define GETLEN_MAX 1
39
34struct blob { 40struct blob {
35 uint8_t body[MAXBLOB]; 41 uint8_t body[MAXBLOB];
36 size_t len; 42 size_t len;
@@ -38,6 +44,7 @@ struct blob {
38 44
39size_t xstrlen(const char *); 45size_t xstrlen(const char *);
40void consume(const void *, size_t); 46void consume(const void *, size_t);
47void consume_str(const char *);
41 48
42int unpack_blob(uint8_t, uint8_t **, size_t *, struct blob *); 49int unpack_blob(uint8_t, uint8_t **, size_t *, struct blob *);
43int unpack_byte(uint8_t, uint8_t **, size_t *, uint8_t *); 50int unpack_byte(uint8_t, uint8_t **, size_t *, uint8_t *);
@@ -49,6 +56,11 @@ int pack_byte(uint8_t, uint8_t **, size_t *, uint8_t);
49int pack_int(uint8_t, uint8_t **, size_t *, int); 56int pack_int(uint8_t, uint8_t **, size_t *, int);
50int pack_string(uint8_t, uint8_t **, size_t *, const char *); 57int pack_string(uint8_t, uint8_t **, size_t *, const char *);
51 58
59size_t len_int(void);
60size_t len_string(int);
61size_t len_byte(void);
62size_t len_blob(int);
63
52void mutate_byte(uint8_t *); 64void mutate_byte(uint8_t *);
53void mutate_int(int *); 65void mutate_int(int *);
54void mutate_blob(struct blob *); 66void mutate_blob(struct blob *);
@@ -60,6 +72,9 @@ void set_wire_data(uint8_t *, size_t);
60int dev_read(void *, unsigned char *, size_t, int); 72int dev_read(void *, unsigned char *, size_t, int);
61int dev_write(void *, const unsigned char *, size_t); 73int dev_write(void *, const unsigned char *, size_t);
62 74
75void prng_init(unsigned long);
76unsigned long prng_uint32(void);
77
63uint32_t uniform_random(uint32_t); 78uint32_t uniform_random(uint32_t);
64 79
65#endif /* !_MUTATOR_AUX_H */ 80#endif /* !_MUTATOR_AUX_H */
diff --git a/fuzz/prng.c b/fuzz/prng.c
new file mode 100755
index 0000000..fa6d4e4
--- /dev/null
+++ b/fuzz/prng.c
@@ -0,0 +1,112 @@
1/*
2 A C-program for MT19937, with initialization improved 2002/1/26.
3 Coded by Takuji Nishimura and Makoto Matsumoto.
4
5 Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
6 All rights reserved.
7
8 Redistribution and use in source and binary forms, with or without
9 modification, are permitted provided that the following conditions
10 are met:
11
12 1. Redistributions of source code must retain the above copyright
13 notice, this list of conditions and the following disclaimer.
14
15 2. Redistributions in binary form must reproduce the above copyright
16 notice, this list of conditions and the following disclaimer in the
17 documentation and/or other materials provided with the distribution.
18
19 3. The names of its contributors may not be used to endorse or promote
20 products derived from this software without specific prior written
21 permission.
22
23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
27 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
29 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
35
36 Any feedback is very welcome.
37 http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
38 email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)
39*/
40
41#include <assert.h>
42#include <stdio.h>
43#include <stdlib.h>
44#include "mutator_aux.h"
45
46#define init_genrand prng_init
47#define genrand_int32 prng_uint32
48
49/* Period parameters */
50#define N 624
51#define M 397
52#define MATRIX_A 0x9908b0dfUL /* constant vector a */
53#define UPPER_MASK 0x80000000UL /* most significant w-r bits */
54#define LOWER_MASK 0x7fffffffUL /* least significant r bits */
55
56int prng_up = 0;
57static unsigned long mt[N]; /* the array for the state vector */
58static int mti=N+1; /* mti==N+1 means mt[N] is not initialized */
59
60/* initializes mt[N] with a seed */
61void init_genrand(unsigned long s)
62{
63 mt[0]= s & 0xffffffffUL;
64 for (mti=1; mti<N; mti++) {
65 mt[mti] =
66 (1812433253UL * (mt[mti-1] ^ (mt[mti-1] >> 30)) + mti);
67 /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */
68 /* In the previous versions, MSBs of the seed affect */
69 /* only MSBs of the array mt[]. */
70 /* 2002/01/09 modified by Makoto Matsumoto */
71 mt[mti] &= 0xffffffffUL;
72 /* for >32 bit machines */
73 }
74 prng_up = 1;
75}
76
77/* generates a random number on [0,0xffffffff]-interval */
78unsigned long genrand_int32(void)
79{
80 unsigned long y;
81 static unsigned long mag01[2]={0x0UL, MATRIX_A};
82 /* mag01[x] = x * MATRIX_A for x=0,1 */
83
84 if (mti >= N) { /* generate N words at one time */
85 int kk;
86
87 assert(mti != N+1);
88
89 for (kk=0;kk<N-M;kk++) {
90 y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);
91 mt[kk] = mt[kk+M] ^ (y >> 1) ^ mag01[y & 0x1UL];
92 }
93 for (;kk<N-1;kk++) {
94 y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);
95 mt[kk] = mt[kk+(M-N)] ^ (y >> 1) ^ mag01[y & 0x1UL];
96 }
97 y = (mt[N-1]&UPPER_MASK)|(mt[0]&LOWER_MASK);
98 mt[N-1] = mt[M-1] ^ (y >> 1) ^ mag01[y & 0x1UL];
99
100 mti = 0;
101 }
102
103 y = mt[mti++];
104
105 /* Tempering */
106 y ^= (y >> 11);
107 y ^= (y << 7) & 0x9d2c5680UL;
108 y ^= (y << 15) & 0xefc60000UL;
109 y ^= (y >> 18);
110
111 return y;
112}
diff --git a/fuzz/report b/fuzz/report
deleted file mode 100755
index bebb0ca..0000000
--- a/fuzz/report
+++ /dev/null
@@ -1,80 +0,0 @@
1#!/bin/bash -e
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# XXX This should really be a Makefile.
7
8T=""
9#T+=" harnesses/assert"
10#T+=" harnesses/assert-rsa-h-p"
11#T+=" harnesses/assert-u2f"
12#T+=" harnesses/cred"
13#T+=" harnesses/cred-rsa-h-p"
14#T+=" harnesses/cred-u2f"
15#T+=" harnesses/cred-u2f-exclude"
16#T+=" harnesses/fido2-assert-G"
17#T+=" harnesses/fido2-assert-V"
18#T+=" harnesses/fido2-cred-M"
19#T+=" harnesses/fido2-cred-V"
20T+=" harnesses/fuzz_assert"
21T+=" harnesses/fuzz_bio"
22T+=" harnesses/fuzz_cred"
23T+=" harnesses/fuzz_credman"
24T+=" harnesses/fuzz_mgmt"
25
26clean() {
27 echo cleaning
28 rm -rf obj
29 mkdir obj
30}
31
32build() {
33 echo building
34 mkdir obj/build
35 (cd obj/build && cmake -DFUZZ=1 -DLIBFUZZER=1 -DCMAKE_C_COMPILER=clang \
36 -DCOVERAGE=1 -DCMAKE_BUILD_TYPE=Debug ../../..) 2>/dev/null 1>&2
37 make -C obj/build 2>/dev/null 1>&2
38 cc -fPIC -D_GNU_SOURCE -shared -o obj/preload-fuzz.so preload-fuzz.c
39}
40
41sync() {
42 if [ -n "${REMOTE}" ]; then
43 for t in ${T}; do
44 echo syncing ${t}
45 (cd obj && REMOTE="${REMOTE}" ../${t} sync)
46 done
47 else
48 tar -C obj -zxf corpus.tgz
49 fi
50}
51
52run() {
53 export LLVM_PROFILE_FILE="profraw/%h-%p.profraw"
54 export PRELOAD=$(realpath obj/preload-fuzz.so)
55
56 for t in ${T}; do
57 echo running ${t}
58 (cd obj && ../${t} run)
59 done
60}
61
62merge() {
63 echo merging
64 (cd obj && \
65 llvm-profdata merge -sparse profraw/*.profraw \
66 -o libfido2.profdata &&
67 llvm-cov show -format=html -tab-size=8 build/src/libfido2.so \
68 -instr-profile=libfido2.profdata > report.html &&
69 llvm-cov report -use-color=false build/src/libfido2.so \
70 -instr-profile=libfido2.profdata > summary.txt &&
71 llvm-cov report -use-color=false -show-functions \
72 -instr-profile=libfido2.profdata build/src/libfido2.so \
73 ../../src/*.[ch] > functions.txt)
74}
75
76clean
77build
78sync
79run
80merge
diff --git a/fuzz/report.html.gz b/fuzz/report.html.gz
deleted file mode 100644
index 9f07223..0000000
--- a/fuzz/report.html.gz
+++ /dev/null
Binary files differ
diff --git a/fuzz/report.tgz b/fuzz/report.tgz
new file mode 100644
index 0000000..8a002f0
--- /dev/null
+++ b/fuzz/report.tgz
Binary files differ
diff --git a/fuzz/summary.txt b/fuzz/summary.txt
index e494865..da9d165 100644
--- a/fuzz/summary.txt
+++ b/fuzz/summary.txt
@@ -1,34 +1,36 @@
1Filename Regions Missed Regions Cover Functions Missed Functions Executed Lines Missed Lines Cover 1Filename Regions Missed Regions Cover Functions Missed Functions Executed Lines Missed Lines Cover
2-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3fuzz/prng.c 31 0 100.00% 2 0 100.00% 48 0 100.00%
3fuzz/uniform_random.c 7 1 85.71% 1 0 100.00% 23 1 95.65% 4fuzz/uniform_random.c 7 1 85.71% 1 0 100.00% 23 1 95.65%
4fuzz/wrap.c 4 0 100.00% 1 0 100.00% 7 0 100.00% 5fuzz/wrap.c 6 0 100.00% 1 0 100.00% 7 0 100.00%
5openbsd-compat/explicit_bzero.c 4 0 100.00% 1 0 100.00% 12 0 100.00% 6openbsd-compat/explicit_bzero.c 4 0 100.00% 1 0 100.00% 12 0 100.00%
6openbsd-compat/recallocarray.c 41 7 82.93% 1 0 100.00% 49 7 85.71% 7openbsd-compat/recallocarray.c 41 7 82.93% 1 0 100.00% 49 7 85.71%
8openbsd-compat/strlcat.c 12 1 91.67% 1 0 100.00% 25 1 96.00%
7openbsd-compat/timingsafe_bcmp.c 4 0 100.00% 1 0 100.00% 8 0 100.00% 9openbsd-compat/timingsafe_bcmp.c 4 0 100.00% 1 0 100.00% 8 0 100.00%
8src/aes256.c 56 0 100.00% 2 0 100.00% 82 0 100.00% 10src/aes256.c 56 0 100.00% 2 0 100.00% 82 0 100.00%
9src/assert.c 569 29 94.90% 53 1 98.11% 901 60 93.34% 11src/assert.c 566 43 92.40% 53 1 98.11% 900 87 90.33%
10src/authkey.c 45 0 100.00% 5 0 100.00% 75 0 100.00% 12src/authkey.c 44 0 100.00% 5 0 100.00% 75 0 100.00%
11src/bio.c 422 21 95.02% 49 2 95.92% 661 25 96.22% 13src/bio.c 418 20 95.22% 49 2 95.92% 661 22 96.67%
12src/blob.c 39 1 97.44% 7 0 100.00% 73 4 94.52% 14src/blob.c 39 1 97.44% 7 0 100.00% 73 4 94.52%
13src/buf.c 8 1 87.50% 2 0 100.00% 20 1 95.00% 15src/buf.c 8 1 87.50% 2 0 100.00% 20 1 95.00%
14src/cbor.c 844 31 96.33% 51 1 98.04% 1319 47 96.44% 16src/cbor.c 884 70 92.08% 52 2 96.15% 1371 106 92.27%
15src/cred.c 532 35 93.42% 54 1 98.15% 850 55 93.53% 17src/cred.c 534 51 90.45% 55 1 98.18% 830 78 90.60%
16src/credman.c 381 18 95.28% 38 0 100.00% 589 15 97.45% 18src/credman.c 376 18 95.21% 38 0 100.00% 589 15 97.45%
17src/dev.c 131 22 83.21% 19 1 94.74% 183 30 83.61% 19src/dev.c 201 85 57.71% 26 8 69.23% 294 128 56.46%
18src/ecdh.c 68 0 100.00% 2 0 100.00% 104 0 100.00% 20src/ecdh.c 68 0 100.00% 2 0 100.00% 104 0 100.00%
19src/eddsa.c 54 4 92.59% 8 0 100.00% 79 2 97.47% 21src/eddsa.c 54 0 100.00% 8 0 100.00% 79 0 100.00%
20src/err.c 108 108 0.00% 1 1 0.00% 112 112 0.00% 22src/err.c 108 108 0.00% 1 1 0.00% 112 112 0.00%
21src/es256.c 273 4 98.53% 16 0 100.00% 372 13 96.51% 23src/es256.c 278 0 100.00% 16 0 100.00% 377 0 100.00%
22src/hid.c 16 16 0.00% 8 8 0.00% 38 38 0.00% 24src/hid.c 16 16 0.00% 8 8 0.00% 38 38 0.00%
23src/hid_linux.c 166 166 0.00% 12 12 0.00% 287 287 0.00% 25src/hid_linux.c 166 166 0.00% 12 12 0.00% 292 292 0.00%
24src/info.c 148 1 99.32% 31 0 100.00% 305 0 100.00% 26src/info.c 146 0 100.00% 31 0 100.00% 304 0 100.00%
25src/io.c 113 6 94.69% 7 0 100.00% 201 13 93.53% 27src/io.c 123 5 95.93% 10 0 100.00% 218 11 94.95%
26src/iso7816.c 18 1 94.44% 5 0 100.00% 47 0 100.00% 28src/iso7816.c 18 1 94.44% 5 0 100.00% 47 0 100.00%
27src/log.c 16 10 37.50% 3 1 66.67% 34 23 32.35% 29src/log.c 34 2 94.12% 5 1 80.00% 50 3 94.00%
28src/pin.c 250 0 100.00% 16 0 100.00% 364 0 100.00% 30src/pin.c 248 0 100.00% 16 0 100.00% 365 0 100.00%
29src/reset.c 20 0 100.00% 3 0 100.00% 23 0 100.00% 31src/reset.c 19 0 100.00% 3 0 100.00% 22 0 100.00%
30src/rs256.c 102 6 94.12% 8 0 100.00% 140 9 93.57% 32src/rs256.c 102 29 71.57% 8 3 62.50% 140 44 68.57%
31src/u2f.c 436 11 97.48% 13 0 100.00% 686 22 96.79% 33src/u2f.c 443 28 93.68% 13 0 100.00% 699 52 92.56%
32 34
33Files which contain no functions: 35Files which contain no functions:
34src/extern.h 0 0 - 0 0 - 0 0 - 36src/extern.h 0 0 - 0 0 - 0 0 -
@@ -36,4 +38,4 @@ src/fido.h 0 0 -
36src/fido/err.h 0 0 - 0 0 - 0 0 - 38src/fido/err.h 0 0 - 0 0 - 0 0 -
37src/fido/param.h 0 0 - 0 0 - 0 0 - 39src/fido/param.h 0 0 - 0 0 - 0 0 -
38-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 40--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
39TOTAL 4875 499 89.76% 418 28 93.30% 7644 764 90.01% 41TOTAL 5054 653 87.08% 435 39 91.03% 7914 1002 87.34%
diff --git a/fuzz/uniform_random.c b/fuzz/uniform_random.c
index 7711d69..357091c 100644
--- a/fuzz/uniform_random.c
+++ b/fuzz/uniform_random.c
@@ -18,6 +18,7 @@
18#include <stdlib.h> 18#include <stdlib.h>
19 19
20uint32_t uniform_random(uint32_t); 20uint32_t uniform_random(uint32_t);
21unsigned long prng_uint32(void);
21 22
22/* 23/*
23 * Calculate a uniformly distributed random number less than upper_bound 24 * Calculate a uniformly distributed random number less than upper_bound
@@ -47,7 +48,7 @@ uniform_random(uint32_t upper_bound)
47 * to re-roll. 48 * to re-roll.
48 */ 49 */
49 for (;;) { 50 for (;;) {
50 r = (uint32_t)random(); 51 r = (uint32_t)prng_uint32();
51 if (r >= min) 52 if (r >= min)
52 break; 53 break;
53 } 54 }
diff --git a/fuzz/wiredata_fido2.h b/fuzz/wiredata_fido2.h
new file mode 100644
index 0000000..57402ef
--- /dev/null
+++ b/fuzz/wiredata_fido2.h
@@ -0,0 +1,569 @@
1/*
2 * Copyright (c) 2020 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 _WIREDATA_FIDO2_H
8#define _WIREDATA_FIDO2_H
9
10#define WIREDATA_CTAP_INIT \
11 0xff, 0xff, 0xff, 0xff, 0x86, 0x00, 0x11, 0x80, \
12 0x43, 0x56, 0x40, 0xb1, 0x4e, 0xd9, 0x2d, 0x00, \
13 0x22, 0x00, 0x02, 0x02, 0x05, 0x02, 0x01, 0x05, \
14 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
15 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
16 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
17 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
18 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
19
20#define WIREDATA_CTAP_KEEPALIVE \
21 0x00, 0x22, 0x00, 0x02, 0xbb, 0x00, 0x01, 0x02, \
22 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
23 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
24 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
25 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
26 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
27 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
28 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
29
30#define WIREDATA_CTAP_CBOR_INFO \
31 0x00, 0x22, 0x00, 0x02, 0x90, 0x00, 0xb9, 0x00, \
32 0xa9, 0x01, 0x83, 0x66, 0x55, 0x32, 0x46, 0x5f, \
33 0x56, 0x32, 0x68, 0x46, 0x49, 0x44, 0x4f, 0x5f, \
34 0x32, 0x5f, 0x30, 0x6c, 0x46, 0x49, 0x44, 0x4f, \
35 0x5f, 0x32, 0x5f, 0x31, 0x5f, 0x50, 0x52, 0x45, \
36 0x02, 0x82, 0x6b, 0x63, 0x72, 0x65, 0x64, 0x50, \
37 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x6b, 0x68, \
38 0x6d, 0x61, 0x63, 0x2d, 0x73, 0x65, 0x63, 0x72, \
39 0x00, 0x22, 0x00, 0x02, 0x00, 0x65, 0x74, 0x03, \
40 0x50, 0x19, 0x56, 0xe5, 0xbd, 0xa3, 0x74, 0x45, \
41 0xf1, 0xa8, 0x14, 0x35, 0x64, 0x03, 0xfd, 0xbc, \
42 0x18, 0x04, 0xa5, 0x62, 0x72, 0x6b, 0xf5, 0x62, \
43 0x75, 0x70, 0xf5, 0x64, 0x70, 0x6c, 0x61, 0x74, \
44 0xf4, 0x69, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, \
45 0x50, 0x69, 0x6e, 0xf4, 0x75, 0x63, 0x72, 0x65, \
46 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x4d, \
47 0x00, 0x22, 0x00, 0x02, 0x01, 0x67, 0x6d, 0x74, \
48 0x50, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0xf5, \
49 0x05, 0x19, 0x04, 0xb0, 0x06, 0x81, 0x01, 0x07, \
50 0x08, 0x08, 0x18, 0x80, 0x0a, 0x82, 0xa2, 0x63, \
51 0x61, 0x6c, 0x67, 0x26, 0x64, 0x74, 0x79, 0x70, \
52 0x65, 0x6a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, \
53 0x2d, 0x6b, 0x65, 0x79, 0xa2, 0x63, 0x61, 0x6c, \
54 0x67, 0x27, 0x64, 0x74, 0x79, 0x70, 0x65, 0x6a, \
55 0x00, 0x22, 0x00, 0x02, 0x02, 0x70, 0x75, 0x62, \
56 0x6c, 0x69, 0x63, 0x2d, 0x6b, 0x65, 0x79, 0x00, \
57 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
58 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
59 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
60 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
61 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
62 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
63
64#define WIREDATA_CTAP_CBOR_RESET \
65 0x00, 0x22, 0x00, 0x02, 0x90, 0x00, 0x01, 0x00, \
66 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
67 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
68 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
69 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
70 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
71 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
72 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
73
74#define WIREDATA_CTAP_CBOR_AUTHKEY \
75 0x00, 0x22, 0x00, 0x02, 0x90, 0x00, 0x51, 0x00, \
76 0xa1, 0x01, 0xa5, 0x01, 0x02, 0x03, 0x38, 0x18, \
77 0x20, 0x01, 0x21, 0x58, 0x20, 0x2a, 0xb8, 0x2d, \
78 0x36, 0x69, 0xab, 0x30, 0x9d, 0xe3, 0x5e, 0x9b, \
79 0xfb, 0x94, 0xfc, 0x1d, 0x92, 0x95, 0xaf, 0x01, \
80 0x47, 0xfe, 0x4b, 0x87, 0xe5, 0xcf, 0x3f, 0x05, \
81 0x0b, 0x39, 0xda, 0x17, 0x49, 0x22, 0x58, 0x20, \
82 0x15, 0x1b, 0xbe, 0x08, 0x78, 0x60, 0x4d, 0x3c, \
83 0x00, 0x22, 0x00, 0x03, 0x00, 0x3f, 0xf1, 0x60, \
84 0xa6, 0xd8, 0xf8, 0xed, 0xce, 0x4a, 0x30, 0x5d, \
85 0x1a, 0xaf, 0x80, 0xc4, 0x0a, 0xd2, 0x6f, 0x77, \
86 0x38, 0x12, 0x97, 0xaa, 0xbd, 0x00, 0x00, 0x00, \
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
92#define WIREDATA_CTAP_CBOR_PINTOKEN \
93 0x00, 0x22, 0x00, 0x02, 0x90, 0x00, 0x14, 0x00, \
94 0xa1, 0x02, 0x50, 0xee, 0x40, 0x4c, 0x85, 0xd7, \
95 0xa1, 0x2f, 0x56, 0xc4, 0x4e, 0xc5, 0x93, 0x41, \
96 0xd0, 0x3b, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, \
97 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
98 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
99 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
100 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
101
102#define WIREDATA_CTAP_CBOR_STATUS \
103 0x00, 0x22, 0x00, 0x02, 0x90, 0x00, 0x01, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
109 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
110 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
111
112#define WIREDATA_CTAP_CBOR_RETRIES \
113 0x00, 0x22, 0x00, 0x02, 0x90, 0x00, 0x04, 0x00, \
114 0xa1, 0x03, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, \
115 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
116 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
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
122#define WIREDATA_CTAP_CBOR_ASSERT \
123 0x00, 0x22, 0x00, 0x02, 0x90, 0x00, 0xcb, 0x00, \
124 0xa3, 0x01, 0xa2, 0x62, 0x69, 0x64, 0x58, 0x40, \
125 0x4a, 0x4c, 0x9e, 0xcc, 0x81, 0x7d, 0x42, 0x03, \
126 0x2b, 0x41, 0xd1, 0x38, 0xd3, 0x49, 0xb4, 0xfc, \
127 0xfb, 0xe4, 0x4e, 0xe4, 0xff, 0x76, 0x34, 0x16, \
128 0x68, 0x06, 0x9d, 0xa6, 0x01, 0x32, 0xb9, 0xff, \
129 0xc2, 0x35, 0x0d, 0x89, 0x43, 0x66, 0x12, 0xf8, \
130 0x8e, 0x5b, 0xde, 0xf4, 0xcc, 0xec, 0x9d, 0x03, \
131 0x00, 0x92, 0x00, 0x0e, 0x00, 0x85, 0xc2, 0xf5, \
132 0xe6, 0x8e, 0xeb, 0x3f, 0x3a, 0xec, 0xc3, 0x1d, \
133 0x04, 0x6e, 0xf3, 0x5b, 0x88, 0x64, 0x74, 0x79, \
134 0x70, 0x65, 0x6a, 0x70, 0x75, 0x62, 0x6c, 0x69, \
135 0x63, 0x2d, 0x6b, 0x65, 0x79, 0x02, 0x58, 0x25, \
136 0x49, 0x96, 0x0d, 0xe5, 0x88, 0x0e, 0x8c, 0x68, \
137 0x74, 0x34, 0x17, 0x0f, 0x64, 0x76, 0x60, 0x5b, \
138 0x8f, 0xe4, 0xae, 0xb9, 0xa2, 0x86, 0x32, 0xc7, \
139 0x00, 0x92, 0x00, 0x0e, 0x01, 0x99, 0x5c, 0xf3, \
140 0xba, 0x83, 0x1d, 0x97, 0x63, 0x04, 0x00, 0x00, \
141 0x00, 0x09, 0x03, 0x58, 0x47, 0x30, 0x45, 0x02, \
142 0x21, 0x00, 0xcf, 0x3f, 0x36, 0x0e, 0x1f, 0x6f, \
143 0xd6, 0xa0, 0x9d, 0x13, 0xcf, 0x55, 0xf7, 0x49, \
144 0x8f, 0xc8, 0xc9, 0x03, 0x12, 0x76, 0x41, 0x75, \
145 0x7b, 0xb5, 0x0a, 0x90, 0xa5, 0x82, 0x26, 0xf1, \
146 0x6b, 0x80, 0x02, 0x20, 0x34, 0x9b, 0x7a, 0x82, \
147 0x00, 0x92, 0x00, 0x0e, 0x02, 0xd3, 0xe1, 0x79, \
148 0x49, 0x55, 0x41, 0x9f, 0xa4, 0x06, 0x06, 0xbd, \
149 0xc8, 0xb9, 0x2b, 0x5f, 0xe1, 0xa7, 0x99, 0x1c, \
150 0xa1, 0xfc, 0x7e, 0x3e, 0xd5, 0x85, 0x2e, 0x11, \
151 0x75, 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
156#define WIREDATA_CTAP_CBOR_CRED \
157 0x00, 0x91, 0x00, 0x03, 0x90, 0x03, 0xe1, 0x00, \
158 0xa3, 0x01, 0x66, 0x70, 0x61, 0x63, 0x6b, 0x65, \
159 0x64, 0x02, 0x58, 0xc4, 0x49, 0x96, 0x0d, 0xe5, \
160 0x88, 0x0e, 0x8c, 0x68, 0x74, 0x34, 0x17, 0x0f, \
161 0x64, 0x76, 0x60, 0x5b, 0x8f, 0xe4, 0xae, 0xb9, \
162 0xa2, 0x86, 0x32, 0xc7, 0x99, 0x5c, 0xf3, 0xba, \
163 0x83, 0x1d, 0x97, 0x63, 0x45, 0x00, 0x00, 0x00, \
164 0x00, 0xf8, 0xa0, 0x11, 0xf3, 0x8c, 0x0a, 0x4d, \
165 0x00, 0x91, 0x00, 0x03, 0x00, 0x15, 0x80, 0x06, \
166 0x17, 0x11, 0x1f, 0x9e, 0xdc, 0x7d, 0x00, 0x40, \
167 0xed, 0x88, 0x48, 0xa1, 0xdb, 0x56, 0x4d, 0x0f, \
168 0x0d, 0xc8, 0x8f, 0x0f, 0xe9, 0x16, 0xb1, 0x78, \
169 0xa9, 0x40, 0x98, 0x71, 0xa0, 0xb3, 0xf2, 0xcf, \
170 0x05, 0x73, 0x6c, 0x12, 0xbf, 0x00, 0x96, 0xf3, \
171 0x7b, 0x93, 0xba, 0x49, 0xee, 0x23, 0xb4, 0x78, \
172 0x2e, 0xfb, 0xce, 0x27, 0xa8, 0xc2, 0x26, 0x78, \
173 0x00, 0x91, 0x00, 0x03, 0x01, 0xcc, 0x95, 0x2d, \
174 0x40, 0xdb, 0xd1, 0x40, 0x3d, 0x2b, 0xa3, 0x31, \
175 0xa0, 0x75, 0x82, 0x63, 0xf0, 0xa5, 0x01, 0x02, \
176 0x03, 0x26, 0x20, 0x01, 0x21, 0x58, 0x20, 0x9d, \
177 0x95, 0xa1, 0xb5, 0xd6, 0x11, 0xbf, 0xe2, 0x28, \
178 0xa0, 0x7f, 0xca, 0x1e, 0xd9, 0x09, 0x0f, 0x0d, \
179 0xe7, 0x8e, 0x29, 0xe8, 0x2e, 0x11, 0xdb, 0x55, \
180 0x62, 0x13, 0xd7, 0x26, 0xc2, 0x7e, 0x2b, 0x22, \
181 0x00, 0x91, 0x00, 0x03, 0x02, 0x58, 0x20, 0xbe, \
182 0x74, 0x2a, 0xac, 0xde, 0x11, 0x40, 0x76, 0x31, \
183 0x0b, 0xed, 0x55, 0xde, 0xf3, 0x03, 0xe4, 0x1c, \
184 0xac, 0x42, 0x63, 0x8f, 0xe8, 0x30, 0x63, 0xb7, \
185 0x07, 0x4e, 0x5d, 0xfb, 0x17, 0x5e, 0x9b, 0x03, \
186 0xa3, 0x63, 0x61, 0x6c, 0x67, 0x26, 0x63, 0x73, \
187 0x69, 0x67, 0x58, 0x48, 0x30, 0x46, 0x02, 0x21, \
188 0x00, 0xfb, 0xd1, 0x26, 0x76, 0x34, 0x74, 0xac, \
189 0x00, 0x91, 0x00, 0x03, 0x03, 0xf6, 0xd8, 0x5c, \
190 0x5d, 0xbc, 0xda, 0xe0, 0x43, 0xe0, 0xa5, 0x42, \
191 0x9f, 0xc7, 0xe2, 0x18, 0x3e, 0xe2, 0x2c, 0x94, \
192 0x78, 0xbf, 0x9c, 0xeb, 0x3e, 0x9d, 0x02, 0x21, \
193 0x00, 0xab, 0x21, 0x1b, 0xc4, 0x30, 0x69, 0xee, \
194 0x7f, 0x09, 0xe6, 0x6b, 0x99, 0x98, 0x34, 0x07, \
195 0x7b, 0x9a, 0x58, 0xb2, 0xe8, 0x77, 0xe0, 0xba, \
196 0x7d, 0xab, 0x65, 0xf8, 0xba, 0x2a, 0xcb, 0x9a, \
197 0x00, 0x91, 0x00, 0x03, 0x04, 0x41, 0x63, 0x78, \
198 0x35, 0x63, 0x81, 0x59, 0x02, 0xb3, 0x30, 0x82, \
199 0x02, 0xaf, 0x30, 0x82, 0x01, 0x97, 0xa0, 0x03, \
200 0x02, 0x01, 0x02, 0x02, 0x04, 0x48, 0x5b, 0x3d, \
201 0xb6, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, \
202 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, \
203 0x30, 0x21, 0x31, 0x1f, 0x30, 0x1d, 0x06, 0x03, \
204 0x55, 0x04, 0x03, 0x0c, 0x16, 0x59, 0x75, 0x62, \
205 0x00, 0x91, 0x00, 0x03, 0x05, 0x69, 0x63, 0x6f, \
206 0x20, 0x46, 0x49, 0x44, 0x4f, 0x20, 0x50, 0x72, \
207 0x65, 0x76, 0x69, 0x65, 0x77, 0x20, 0x43, 0x41, \
208 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x38, 0x30, 0x34, \
209 0x31, 0x32, 0x31, 0x30, 0x35, 0x37, 0x31, 0x30, \
210 0x5a, 0x17, 0x0d, 0x31, 0x38, 0x31, 0x32, 0x33, \
211 0x31, 0x31, 0x30, 0x35, 0x37, 0x31, 0x30, 0x5a, \
212 0x30, 0x6f, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, \
213 0x00, 0x91, 0x00, 0x03, 0x06, 0x55, 0x04, 0x06, \
214 0x13, 0x02, 0x53, 0x45, 0x31, 0x12, 0x30, 0x10, \
215 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x09, 0x59, \
216 0x75, 0x62, 0x69, 0x63, 0x6f, 0x20, 0x41, 0x42, \
217 0x31, 0x22, 0x30, 0x20, 0x06, 0x03, 0x55, 0x04, \
218 0x0b, 0x0c, 0x19, 0x41, 0x75, 0x74, 0x68, 0x65, \
219 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, \
220 0x20, 0x41, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, \
221 0x00, 0x91, 0x00, 0x03, 0x07, 0x74, 0x69, 0x6f, \
222 0x6e, 0x31, 0x28, 0x30, 0x26, 0x06, 0x03, 0x55, \
223 0x04, 0x03, 0x0c, 0x1f, 0x59, 0x75, 0x62, 0x69, \
224 0x63, 0x6f, 0x20, 0x55, 0x32, 0x46, 0x20, 0x45, \
225 0x45, 0x20, 0x53, 0x65, 0x72, 0x69, 0x61, 0x6c, \
226 0x20, 0x31, 0x32, 0x31, 0x33, 0x39, 0x33, 0x39, \
227 0x31, 0x32, 0x36, 0x30, 0x59, 0x30, 0x13, 0x06, \
228 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, \
229 0x00, 0x91, 0x00, 0x03, 0x08, 0x06, 0x08, 0x2a, \
230 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, \
231 0x42, 0x00, 0x04, 0xfb, 0x2c, 0xdd, 0x30, 0x43, \
232 0x28, 0xc5, 0x72, 0x4a, 0x50, 0xcc, 0xe6, 0xf6, \
233 0x0b, 0xad, 0x7d, 0x27, 0xa9, 0x1b, 0x59, 0xe1, \
234 0xe6, 0x6f, 0x29, 0x7b, 0x89, 0xc9, 0xd4, 0x3d, \
235 0xc2, 0xb2, 0xc7, 0x78, 0x89, 0xb4, 0xf0, 0xff, \
236 0x9d, 0x02, 0x28, 0xcb, 0x94, 0x6d, 0xfc, 0xe0, \
237 0x00, 0x91, 0x00, 0x03, 0x09, 0x1b, 0x19, 0x58, \
238 0x9b, 0x67, 0x80, 0x4a, 0xac, 0x97, 0x7f, 0x28, \
239 0x18, 0x9c, 0xcd, 0xb3, 0x25, 0x74, 0xca, 0x28, \
240 0xa3, 0x6c, 0x30, 0x6a, 0x30, 0x22, 0x06, 0x09, \
241 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xc4, 0x0a, \
242 0x02, 0x04, 0x15, 0x31, 0x2e, 0x33, 0x2e, 0x36, \
243 0x2e, 0x31, 0x2e, 0x34, 0x2e, 0x31, 0x2e, 0x34, \
244 0x31, 0x34, 0x38, 0x32, 0x2e, 0x31, 0x2e, 0x36, \
245 0x00, 0x91, 0x00, 0x03, 0x0a, 0x30, 0x13, 0x06, \
246 0x0b, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xe5, \
247 0x1c, 0x02, 0x01, 0x01, 0x04, 0x04, 0x03, 0x02, \
248 0x04, 0x30, 0x30, 0x21, 0x06, 0x0b, 0x2b, 0x06, \
249 0x01, 0x04, 0x01, 0x82, 0xe5, 0x1c, 0x01, 0x01, \
250 0x04, 0x04, 0x12, 0x04, 0x10, 0xf8, 0xa0, 0x11, \
251 0xf3, 0x8c, 0x0a, 0x4d, 0x15, 0x80, 0x06, 0x17, \
252 0x11, 0x1f, 0x9e, 0xdc, 0x7d, 0x30, 0x0c, 0x06, \
253 0x00, 0x91, 0x00, 0x03, 0x0b, 0x03, 0x55, 0x1d, \
254 0x13, 0x01, 0x01, 0xff, 0x04, 0x02, 0x30, 0x00, \
255 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, \
256 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x03, \
257 0x82, 0x01, 0x01, 0x00, 0x32, 0xf3, 0xe4, 0xbd, \
258 0x58, 0xd7, 0x42, 0x2b, 0xaf, 0x49, 0x99, 0x86, \
259 0x08, 0x1f, 0x0d, 0xa9, 0x3b, 0xc6, 0xaa, 0x1c, \
260 0x72, 0x11, 0xf9, 0x28, 0x53, 0xeb, 0xf3, 0xeb, \
261 0x00, 0x91, 0x00, 0x03, 0x0c, 0x73, 0xda, 0x69, \
262 0x3b, 0x06, 0xde, 0x31, 0x33, 0x8e, 0x5d, 0x02, \
263 0xec, 0xf6, 0x76, 0xe9, 0x5c, 0x42, 0xbe, 0xa5, \
264 0x8f, 0x25, 0xd3, 0x37, 0x3f, 0x77, 0xbb, 0x2a, \
265 0x9d, 0x7c, 0xb2, 0x3e, 0x11, 0x8c, 0x41, 0xd4, \
266 0x9a, 0x4c, 0x9a, 0xd8, 0xf3, 0xe2, 0xa4, 0xec, \
267 0x01, 0x77, 0x7a, 0x74, 0xa8, 0xc4, 0x12, 0x43, \
268 0xc3, 0x1e, 0xce, 0x20, 0x8f, 0x2d, 0x0f, 0x6e, \
269 0x00, 0x91, 0x00, 0x03, 0x0d, 0xbc, 0x61, 0x9b, \
270 0xe1, 0x84, 0xa1, 0x72, 0xf6, 0xa9, 0xac, 0xcb, \
271 0xf8, 0x73, 0x6d, 0x5b, 0xe2, 0x98, 0xb3, 0x6b, \
272 0xec, 0xe7, 0x1e, 0x77, 0x8d, 0x0a, 0x69, 0xaa, \
273 0xf9, 0x94, 0xb8, 0x63, 0x6d, 0xe8, 0xfa, 0xf6, \
274 0x2f, 0xd3, 0xce, 0x7f, 0x04, 0x4c, 0x32, 0x2c, \
275 0xf7, 0x26, 0x3e, 0x34, 0x99, 0xe6, 0xa5, 0xb2, \
276 0xb0, 0x2a, 0xbb, 0xad, 0x5b, 0xd9, 0xec, 0xe5, \
277 0x00, 0x91, 0x00, 0x03, 0x0e, 0xb0, 0x71, 0x4d, \
278 0x73, 0xbb, 0x94, 0x61, 0x49, 0x9c, 0x94, 0x2a, \
279 0x5f, 0x1d, 0xcc, 0xaf, 0x65, 0x03, 0x3b, 0x39, \
280 0x39, 0xd4, 0x47, 0xd9, 0xfc, 0xc4, 0x7b, 0x0b, \
281 0x16, 0xd8, 0xe9, 0x01, 0xfc, 0xec, 0x3f, 0x8c, \
282 0x1b, 0xc0, 0xc6, 0xac, 0x0b, 0x5d, 0x74, 0xc7, \
283 0xbb, 0x03, 0x05, 0x69, 0x17, 0xe9, 0x98, 0x1a, \
284 0x19, 0xb9, 0x09, 0x5c, 0xa1, 0xf4, 0xab, 0x9f, \
285 0x00, 0x91, 0x00, 0x03, 0x0f, 0x02, 0x7c, 0x28, \
286 0x0f, 0x8a, 0xf9, 0xed, 0x1d, 0x29, 0x3c, 0xf6, \
287 0xcc, 0x2f, 0x04, 0x6d, 0x9a, 0xd6, 0x62, 0xb4, \
288 0xa9, 0x6e, 0xb1, 0xca, 0xca, 0xac, 0x5e, 0x05, \
289 0x3e, 0x83, 0x91, 0x47, 0x7c, 0x1f, 0x8b, 0x60, \
290 0x01, 0xde, 0x65, 0x3a, 0xbf, 0xf2, 0xaa, 0xbb, \
291 0x55, 0x98, 0x86, 0x91, 0x7e, 0xad, 0x3b, 0x36, \
292 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
293
294#define WIREDATA_CTAP_CBOR_CREDMAN_META \
295 0x00, 0x12, 0x00, 0x04, 0x90, 0x00, 0x07, 0x00, \
296 0xa2, 0x01, 0x00, 0x02, 0x18, 0x19, 0x00, 0x00, \
297 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
298 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
299 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
300 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
301 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
302 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
303
304#define WIREDATA_CTAP_CBOR_CREDMAN_RPLIST \
305 0x00, 0x15, 0x00, 0x02, 0x90, 0x00, 0x37, 0x00, \
306 0xa3, 0x03, 0xa1, 0x62, 0x69, 0x64, 0x6a, 0x79, \
307 0x75, 0x62, 0x69, 0x63, 0x6f, 0x2e, 0x63, 0x6f, \
308 0x6d, 0x04, 0x58, 0x20, 0x37, 0x82, 0x09, 0xb7, \
309 0x2d, 0xef, 0xcb, 0xa9, 0x1d, 0xcb, 0xf8, 0x54, \
310 0xed, 0xb4, 0xda, 0xa6, 0x48, 0x82, 0x8a, 0x2c, \
311 0xbd, 0x18, 0x0a, 0xfc, 0x77, 0xa7, 0x44, 0x34, \
312 0x65, 0x5a, 0x1c, 0x7d, 0x05, 0x03, 0x00, 0x00, \
313 0x00, 0x15, 0x00, 0x02, 0x90, 0x00, 0x36, 0x00, \
314 0xa2, 0x03, 0xa1, 0x62, 0x69, 0x64, 0x6b, 0x79, \
315 0x75, 0x62, 0x69, 0x6b, 0x65, 0x79, 0x2e, 0x6f, \
316 0x72, 0x67, 0x04, 0x58, 0x20, 0x12, 0x6b, 0xba, \
317 0x6a, 0x2d, 0x7a, 0x81, 0x84, 0x25, 0x7b, 0x74, \
318 0xdd, 0x1d, 0xdd, 0x46, 0xb6, 0x2a, 0x8c, 0xa2, \
319 0xa7, 0x83, 0xfe, 0xdb, 0x5b, 0x19, 0x48, 0x73, \
320 0x55, 0xb7, 0xe3, 0x46, 0x09, 0x00, 0x00, 0x00, \
321 0x00, 0x15, 0x00, 0x02, 0x90, 0x00, 0x37, 0x00, \
322 0xa2, 0x03, 0xa1, 0x62, 0x69, 0x64, 0x6c, 0x77, \
323 0x65, 0x62, 0x61, 0x75, 0x74, 0x68, 0x6e, 0x2e, \
324 0x64, 0x65, 0x76, 0x04, 0x58, 0x20, 0xd6, 0x32, \
325 0x7d, 0x8c, 0x6a, 0x5d, 0xe6, 0xae, 0x0e, 0x33, \
326 0xd0, 0xa3, 0x31, 0xfb, 0x67, 0x77, 0xb9, 0x4e, \
327 0xf4, 0x73, 0x19, 0xfe, 0x7e, 0xfd, 0xfa, 0x82, \
328 0x70, 0x8e, 0x1f, 0xbb, 0xa2, 0x55, 0x00, 0x00
329
330#define WIREDATA_CTAP_CBOR_CREDMAN_RKLIST \
331 0x00, 0x15, 0x00, 0x04, 0x90, 0x00, 0xc5, 0x00, \
332 0xa5, 0x06, 0xa3, 0x62, 0x69, 0x64, 0x58, 0x20, \
333 0xe4, 0xe1, 0x06, 0x31, 0xde, 0x00, 0x0f, 0x4f, \
334 0x12, 0x6e, 0xc9, 0x68, 0x2d, 0x43, 0x3f, 0xf1, \
335 0x02, 0x2c, 0x6e, 0xe6, 0x96, 0x10, 0xbf, 0x73, \
336 0x35, 0xc9, 0x20, 0x27, 0x06, 0xba, 0x39, 0x09, \
337 0x64, 0x6e, 0x61, 0x6d, 0x65, 0x6a, 0x62, 0x6f, \
338 0x62, 0x20, 0x62, 0x61, 0x6e, 0x61, 0x6e, 0x61, \
339 0x00, 0x15, 0x00, 0x04, 0x00, 0x6b, 0x64, 0x69, \
340 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, \
341 0x65, 0x67, 0x62, 0x62, 0x61, 0x6e, 0x61, 0x6e, \
342 0x61, 0x07, 0xa2, 0x62, 0x69, 0x64, 0x50, 0x19, \
343 0xf7, 0x78, 0x0c, 0xa0, 0xbc, 0xb9, 0xa6, 0xd5, \
344 0x1e, 0xd7, 0x87, 0xfb, 0x6c, 0x80, 0x03, 0x64, \
345 0x74, 0x79, 0x70, 0x65, 0x6a, 0x70, 0x75, 0x62, \
346 0x6c, 0x69, 0x63, 0x2d, 0x6b, 0x65, 0x79, 0x08, \
347 0x00, 0x15, 0x00, 0x04, 0x01, 0xa5, 0x01, 0x02, \
348 0x03, 0x26, 0x20, 0x01, 0x21, 0x58, 0x20, 0x81, \
349 0x6c, 0xdd, 0x8c, 0x8f, 0x8c, 0xc8, 0x43, 0xa7, \
350 0xbb, 0x79, 0x51, 0x09, 0xb1, 0xdf, 0xbe, 0xc4, \
351 0xa5, 0x54, 0x16, 0x9e, 0x58, 0x56, 0xb3, 0x0b, \
352 0x34, 0x4f, 0xa5, 0x6c, 0x05, 0xa2, 0x21, 0x22, \
353 0x58, 0x20, 0xcd, 0xc2, 0x0c, 0x99, 0x83, 0x5a, \
354 0x61, 0x73, 0xd8, 0xe0, 0x74, 0x23, 0x46, 0x64, \
355 0x00, 0x15, 0x00, 0x04, 0x02, 0x39, 0x4c, 0xb0, \
356 0xf4, 0x6c, 0x0a, 0x37, 0x72, 0xaa, 0xa8, 0xea, \
357 0x58, 0xd3, 0xd4, 0xe0, 0x51, 0xb2, 0x28, 0x09, \
358 0x05, 0x0a, 0x01, 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, 0x15, 0x00, 0x04, 0x90, 0x00, 0xa0, 0x00, \
364 0xa4, 0x06, 0xa3, 0x62, 0x69, 0x64, 0x58, 0x20, \
365 0x56, 0xa1, 0x3c, 0x06, 0x2b, 0xad, 0xa2, 0x21, \
366 0x7d, 0xcd, 0x91, 0x08, 0x47, 0xa8, 0x8a, 0x06, \
367 0x06, 0xf6, 0x66, 0x91, 0xf6, 0xeb, 0x89, 0xe4, \
368 0xdf, 0x26, 0xbc, 0x46, 0x59, 0xc3, 0x7d, 0xc0, \
369 0x64, 0x6e, 0x61, 0x6d, 0x65, 0x6a, 0x62, 0x6f, \
370 0x62, 0x20, 0x62, 0x61, 0x6e, 0x61, 0x6e, 0x61, \
371 0x00, 0x15, 0x00, 0x04, 0x00, 0x6b, 0x64, 0x69, \
372 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, \
373 0x65, 0x67, 0x62, 0x62, 0x61, 0x6e, 0x61, 0x6e, \
374 0x61, 0x07, 0xa2, 0x62, 0x69, 0x64, 0x50, 0xd8, \
375 0x27, 0x4b, 0x25, 0xed, 0x19, 0xef, 0x11, 0xaf, \
376 0xa6, 0x89, 0x7b, 0x84, 0x50, 0xe7, 0x62, 0x64, \
377 0x74, 0x79, 0x70, 0x65, 0x6a, 0x70, 0x75, 0x62, \
378 0x6c, 0x69, 0x63, 0x2d, 0x6b, 0x65, 0x79, 0x08, \
379 0x00, 0x15, 0x00, 0x04, 0x01, 0xa4, 0x01, 0x01, \
380 0x03, 0x27, 0x20, 0x06, 0x21, 0x58, 0x20, 0x8d, \
381 0xfe, 0x45, 0xd5, 0x7d, 0xb6, 0x17, 0xab, 0x86, \
382 0x2d, 0x32, 0xf6, 0x85, 0xf0, 0x92, 0x76, 0xb7, \
383 0xce, 0x73, 0xca, 0x4e, 0x0e, 0xfd, 0xd5, 0xdb, \
384 0x2a, 0x1d, 0x55, 0x90, 0x96, 0x52, 0xc2, 0x0a, \
385 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
386 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
387 0x00, 0x15, 0x00, 0x04, 0x90, 0x00, 0xa0, 0x00, \
388 0xa4, 0x06, 0xa3, 0x62, 0x69, 0x64, 0x58, 0x20, \
389 0x04, 0x0e, 0x0f, 0xa0, 0xcd, 0x60, 0x35, 0x9a, \
390 0xba, 0x47, 0x0c, 0x10, 0xb6, 0x82, 0x6e, 0x2f, \
391 0x66, 0xb9, 0xa7, 0xcf, 0xd8, 0x47, 0xb4, 0x3d, \
392 0xfd, 0x77, 0x1a, 0x38, 0x22, 0xa1, 0xda, 0xa5, \
393 0x64, 0x6e, 0x61, 0x6d, 0x65, 0x6a, 0x62, 0x6f, \
394 0x62, 0x20, 0x62, 0x61, 0x6e, 0x61, 0x6e, 0x61, \
395 0x00, 0x15, 0x00, 0x04, 0x00, 0x6b, 0x64, 0x69, \
396 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, \
397 0x65, 0x67, 0x62, 0x62, 0x61, 0x6e, 0x61, 0x6e, \
398 0x61, 0x07, 0xa2, 0x62, 0x69, 0x64, 0x50, 0x00, \
399 0x5d, 0xdf, 0xef, 0xe2, 0xf3, 0x06, 0xb2, 0xa5, \
400 0x46, 0x4d, 0x98, 0xbc, 0x14, 0x65, 0xc1, 0x64, \
401 0x74, 0x79, 0x70, 0x65, 0x6a, 0x70, 0x75, 0x62, \
402 0x6c, 0x69, 0x63, 0x2d, 0x6b, 0x65, 0x79, 0x08, \
403 0x00, 0x15, 0x00, 0x04, 0x01, 0xa4, 0x01, 0x01, \
404 0x03, 0x27, 0x20, 0x06, 0x21, 0x58, 0x20, 0x72, \
405 0x79, 0x14, 0x69, 0xdf, 0xcb, 0x64, 0x75, 0xee, \
406 0xd4, 0x45, 0x94, 0xbc, 0x48, 0x4d, 0x2a, 0x9f, \
407 0xc9, 0xf4, 0xb5, 0x1b, 0x05, 0xa6, 0x5b, 0x54, \
408 0x9a, 0xac, 0x6c, 0x2e, 0xc6, 0x90, 0x62, 0x0a, \
409 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
410 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
411 0x00, 0x15, 0x00, 0x04, 0x90, 0x00, 0xc3, 0x00, \
412 0xa4, 0x06, 0xa3, 0x62, 0x69, 0x64, 0x58, 0x20, \
413 0xce, 0x32, 0xd8, 0x79, 0xdd, 0x86, 0xa2, 0x42, \
414 0x7c, 0xc3, 0xe1, 0x95, 0x12, 0x93, 0x1a, 0x03, \
415 0xe6, 0x70, 0xb8, 0xff, 0xcd, 0xa5, 0xdf, 0x15, \
416 0xfc, 0x88, 0x2a, 0xf5, 0x44, 0xf1, 0x33, 0x9c, \
417 0x64, 0x6e, 0x61, 0x6d, 0x65, 0x6a, 0x62, 0x6f, \
418 0x62, 0x20, 0x62, 0x61, 0x6e, 0x61, 0x6e, 0x61, \
419 0x00, 0x15, 0x00, 0x04, 0x00, 0x6b, 0x64, 0x69, \
420 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, \
421 0x65, 0x67, 0x62, 0x62, 0x61, 0x6e, 0x61, 0x6e, \
422 0x61, 0x07, 0xa2, 0x62, 0x69, 0x64, 0x50, 0x0a, \
423 0x26, 0x5b, 0x7e, 0x1a, 0x2a, 0xba, 0x70, 0x5f, \
424 0x18, 0x26, 0x14, 0xb2, 0x71, 0xca, 0x98, 0x64, \
425 0x74, 0x79, 0x70, 0x65, 0x6a, 0x70, 0x75, 0x62, \
426 0x6c, 0x69, 0x63, 0x2d, 0x6b, 0x65, 0x79, 0x08, \
427 0x00, 0x15, 0x00, 0x04, 0x01, 0xa5, 0x01, 0x02, \
428 0x03, 0x26, 0x20, 0x01, 0x21, 0x58, 0x20, 0x8b, \
429 0x48, 0xf0, 0x69, 0xfb, 0x22, 0xfb, 0xf3, 0x86, \
430 0x57, 0x7c, 0xdd, 0x82, 0x2c, 0x1c, 0x0c, 0xdc, \
431 0x27, 0xe2, 0x6a, 0x4c, 0x1a, 0x10, 0x04, 0x27, \
432 0x51, 0x3e, 0x2a, 0x9d, 0x3a, 0xb6, 0xb5, 0x22, \
433 0x58, 0x20, 0x70, 0xfe, 0x91, 0x67, 0x64, 0x53, \
434 0x63, 0x83, 0x72, 0x31, 0xe9, 0xe5, 0x20, 0xb7, \
435 0x00, 0x15, 0x00, 0x04, 0x02, 0xee, 0xc9, 0xfb, \
436 0x63, 0xd7, 0xe4, 0x76, 0x39, 0x80, 0x82, 0x74, \
437 0xb8, 0xfa, 0x67, 0xf5, 0x1b, 0x8f, 0xe0, 0x0a, \
438 0x01, 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, 0x15, 0x00, 0x04, 0x90, 0x00, 0xc3, 0x00, \
444 0xa4, 0x06, 0xa3, 0x62, 0x69, 0x64, 0x58, 0x20, \
445 0xf9, 0xa3, 0x67, 0xbf, 0x5e, 0x80, 0x95, 0xdb, \
446 0x4c, 0xc5, 0x8f, 0x65, 0x36, 0xc5, 0xaf, 0xdd, \
447 0x90, 0x2e, 0x62, 0x68, 0x67, 0x9c, 0xa2, 0x26, \
448 0x2f, 0x2a, 0xf9, 0x3a, 0xda, 0x15, 0xf2, 0x27, \
449 0x64, 0x6e, 0x61, 0x6d, 0x65, 0x6a, 0x62, 0x6f, \
450 0x62, 0x20, 0x62, 0x61, 0x6e, 0x61, 0x6e, 0x61, \
451 0x00, 0x15, 0x00, 0x04, 0x00, 0x6b, 0x64, 0x69, \
452 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, \
453 0x65, 0x67, 0x62, 0x62, 0x61, 0x6e, 0x61, 0x6e, \
454 0x61, 0x07, 0xa2, 0x62, 0x69, 0x64, 0x50, 0xfb, \
455 0xa6, 0xbe, 0xc1, 0x01, 0xf6, 0x7a, 0x81, 0xf9, \
456 0xcd, 0x6d, 0x20, 0x41, 0x7a, 0x1c, 0x40, 0x64, \
457 0x74, 0x79, 0x70, 0x65, 0x6a, 0x70, 0x75, 0x62, \
458 0x6c, 0x69, 0x63, 0x2d, 0x6b, 0x65, 0x79, 0x08, \
459 0x00, 0x15, 0x00, 0x04, 0x01, 0xa5, 0x01, 0x02, \
460 0x03, 0x26, 0x20, 0x01, 0x21, 0x58, 0x20, 0xda, \
461 0x2b, 0x53, 0xc3, 0xbe, 0x48, 0xf8, 0xab, 0xbd, \
462 0x06, 0x28, 0x46, 0xfa, 0x35, 0xab, 0xf9, 0xc5, \
463 0x2e, 0xfd, 0x3c, 0x38, 0x88, 0xb3, 0xe1, 0xa7, \
464 0xc5, 0xc6, 0xed, 0x72, 0x54, 0x37, 0x93, 0x22, \
465 0x58, 0x20, 0x12, 0x82, 0x32, 0x2d, 0xab, 0xbc, \
466 0x64, 0xb3, 0xed, 0xcc, 0xd5, 0x22, 0xec, 0x79, \
467 0x00, 0x15, 0x00, 0x04, 0x02, 0x4b, 0xe2, 0x4d, \
468 0x0c, 0x4b, 0x8d, 0x31, 0x4c, 0xb4, 0x0f, 0xd4, \
469 0xa9, 0xbe, 0x0c, 0xab, 0x9e, 0x0a, 0xc9, 0x0a, \
470 0x01, 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
476#define WIREDATA_CTAP_CBOR_BIO_INFO \
477 0x00, 0x10, 0x00, 0x04, 0x90, 0x00, 0x06, 0x00, \
478 0xa2, 0x02, 0x01, 0x03, 0x04, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
484 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
485
486#define WIREDATA_CTAP_CBOR_BIO_ENROLL \
487 0x00, 0x0a, 0x00, 0x05, 0xbb, 0x00, 0x01, 0x02, \
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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
492 0x00, 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, 0x0a, 0x00, 0x05, 0xbb, 0x00, 0x01, 0x02, \
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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
500 0x00, 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, 0x0a, 0x00, 0x05, 0xbb, 0x00, 0x01, 0x02, \
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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
508 0x00, 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, 0x0a, 0x00, 0x05, 0x90, 0x00, 0x0a, 0x00, \
512 0xa3, 0x04, 0x42, 0x68, 0x96, 0x05, 0x00, 0x06, \
513 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
514 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
515 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
516 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
517 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
518 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
519 0x00, 0x0a, 0x00, 0x05, 0xbb, 0x00, 0x01, 0x02, \
520 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
521 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
522 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
523 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
524 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
525 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
526 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
527 0x00, 0x0a, 0x00, 0x05, 0xbb, 0x00, 0x01, 0x02, \
528 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
529 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
530 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
531 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
532 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
533 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
534 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
535 0x00, 0x0a, 0x00, 0x05, 0x90, 0x00, 0x06, 0x00, \
536 0xa2, 0x05, 0x00, 0x06, 0x01, 0x00, 0x00, 0x00, \
537 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
538 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
539 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
540 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
541 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
542 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
543 0x00, 0x0a, 0x00, 0x05, 0xbb, 0x00, 0x01, 0x02, \
544 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
545 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
546 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
547 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
548 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
549 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
550 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
551 0x00, 0x0a, 0x00, 0x05, 0x90, 0x00, 0x06, 0x00, \
552 0xa2, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, \
553 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
554 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
555 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
556 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
557 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
558
559#define WIREDATA_CTAP_CBOR_BIO_ENUM \
560 0x00, 0x10, 0x00, 0x0f, 0x90, 0x00, 0x2e, 0x00, \
561 0xa1, 0x07, 0x83, 0xa2, 0x01, 0x42, 0xce, 0xa3, \
562 0x02, 0x67, 0x66, 0x69, 0x6e, 0x67, 0x65, 0x72, \
563 0x31, 0xa2, 0x01, 0x42, 0xbf, 0x5e, 0x02, 0x67, \
564 0x66, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x32, 0xa2, \
565 0x01, 0x42, 0x5e, 0xd2, 0x02, 0x67, 0x66, 0x69, \
566 0x6e, 0x67, 0x65, 0x72, 0x33, 0x00, 0x00, 0x00, \
567 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
568
569#endif /* _WIREDATA_FIDO2_H */
diff --git a/fuzz/wiredata_u2f.h b/fuzz/wiredata_u2f.h
new file mode 100644
index 0000000..afe418f
--- /dev/null
+++ b/fuzz/wiredata_u2f.h
@@ -0,0 +1,152 @@
1/*
2 * Copyright (c) 2020 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 _WIREDATA_U2F_H
8#define _WIREDATA_U2F_H
9
10#define WIREDATA_CTAP_U2F_6985 \
11 0x00, 0x00, 0x99, 0x01, 0x83, 0x00, 0x02, 0x69, \
12 0x85, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
13 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
14 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
15 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
16 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
17 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
18 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
19
20#define WIREDATA_CTAP_U2F_AUTH \
21 0x00, 0x00, 0x99, 0x01, 0x83, 0x00, 0x4e, 0x01, \
22 0x00, 0x00, 0x00, 0x2c, 0x30, 0x45, 0x02, 0x20, \
23 0x1c, 0xf5, 0x7c, 0xf6, 0xde, 0xbe, 0xe9, 0x86, \
24 0xee, 0x97, 0xb7, 0x64, 0xa3, 0x4e, 0x7a, 0x70, \
25 0x85, 0xd0, 0x66, 0xf9, 0xf0, 0xcd, 0x04, 0x5d, \
26 0x97, 0xf2, 0x3c, 0x22, 0xe3, 0x0e, 0x61, 0xc8, \
27 0x02, 0x21, 0x00, 0x97, 0xef, 0xae, 0x36, 0xe6, \
28 0x17, 0x9f, 0x5e, 0x2d, 0xd7, 0x8c, 0x34, 0xa7, \
29 0x00, 0x00, 0x99, 0x01, 0x00, 0xa1, 0xe9, 0xfb, \
30 0x8f, 0x86, 0x8c, 0xe3, 0x1e, 0xde, 0x3f, 0x4e, \
31 0x1b, 0xe1, 0x2f, 0x8f, 0x2f, 0xca, 0x42, 0x26, \
32 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
33 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
34 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
35 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
36 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
37
38#define WIREDATA_CTAP_U2F_REGISTER \
39 0x00, 0x00, 0x99, 0x01, 0x83, 0x03, 0x1e, 0x05, \
40 0x04, 0x9f, 0xa0, 0xf9, 0x0d, 0x4c, 0xf4, 0xae, \
41 0x96, 0x3c, 0xb7, 0x46, 0xb7, 0x5c, 0x9d, 0x8b, \
42 0x48, 0x19, 0xdf, 0xc4, 0xad, 0xea, 0xb2, 0x70, \
43 0x58, 0x72, 0xd9, 0xce, 0x75, 0xf5, 0xe6, 0x8e, \
44 0x0f, 0x9c, 0x0e, 0x2e, 0x62, 0x3e, 0x91, 0xd3, \
45 0x7b, 0x97, 0x46, 0x60, 0xb9, 0x57, 0x13, 0x97, \
46 0x26, 0xae, 0x0f, 0xb3, 0x8f, 0x2e, 0x9b, 0x3f, \
47 0x00, 0x00, 0x99, 0x01, 0x00, 0xa5, 0x55, 0xec, \
48 0x8c, 0x25, 0x7c, 0x65, 0xb7, 0x09, 0x40, 0x48, \
49 0xae, 0xa8, 0xcb, 0xa1, 0x91, 0xac, 0x40, 0x24, \
50 0xf2, 0x34, 0x6e, 0x3a, 0x8f, 0xa5, 0xb7, 0x48, \
51 0x54, 0x6e, 0xfb, 0xf4, 0x37, 0x88, 0x69, 0x79, \
52 0x6f, 0x12, 0xc1, 0x32, 0xdf, 0x15, 0x5d, 0x6e, \
53 0x82, 0x54, 0xc0, 0x6e, 0x56, 0x4f, 0x3a, 0x9c, \
54 0xc3, 0x96, 0x7a, 0xde, 0xa5, 0xfe, 0xec, 0xd1, \
55 0x00, 0x00, 0x99, 0x01, 0x01, 0x5a, 0x21, 0x85, \
56 0x0e, 0x25, 0x7b, 0x8d, 0x6e, 0x1d, 0x32, 0x29, \
57 0xdb, 0x21, 0xb0, 0xa3, 0x30, 0x82, 0x02, 0x4f, \
58 0x30, 0x82, 0x01, 0x37, 0xa0, 0x03, 0x02, 0x01, \
59 0x02, 0x02, 0x04, 0x2a, 0xd9, 0x6a, 0xf3, 0x30, \
60 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, \
61 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x30, 0x2e, \
62 0x31, 0x2c, 0x30, 0x2a, 0x06, 0x03, 0x55, 0x04, \
63 0x00, 0x00, 0x99, 0x01, 0x02, 0x03, 0x13, 0x23, \
64 0x59, 0x75, 0x62, 0x69, 0x63, 0x6f, 0x20, 0x55, \
65 0x32, 0x46, 0x20, 0x52, 0x6f, 0x6f, 0x74, 0x20, \
66 0x43, 0x41, 0x20, 0x53, 0x65, 0x72, 0x69, 0x61, \
67 0x6c, 0x20, 0x34, 0x35, 0x37, 0x32, 0x30, 0x30, \
68 0x36, 0x33, 0x31, 0x30, 0x20, 0x17, 0x0d, 0x31, \
69 0x34, 0x30, 0x38, 0x30, 0x31, 0x30, 0x30, 0x30, \
70 0x30, 0x30, 0x30, 0x5a, 0x18, 0x0f, 0x32, 0x30, \
71 0x00, 0x00, 0x99, 0x01, 0x03, 0x35, 0x30, 0x30, \
72 0x39, 0x30, 0x34, 0x30, 0x30, 0x30, 0x30, 0x30, \
73 0x30, 0x5a, 0x30, 0x31, 0x31, 0x2f, 0x30, 0x2d, \
74 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x26, 0x59, \
75 0x75, 0x62, 0x69, 0x63, 0x6f, 0x20, 0x55, 0x32, \
76 0x46, 0x20, 0x45, 0x45, 0x20, 0x53, 0x65, 0x72, \
77 0x69, 0x61, 0x6c, 0x20, 0x32, 0x33, 0x39, 0x32, \
78 0x35, 0x37, 0x33, 0x34, 0x35, 0x31, 0x36, 0x35, \
79 0x00, 0x00, 0x99, 0x01, 0x04, 0x35, 0x30, 0x33, \
80 0x38, 0x37, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, \
81 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, \
82 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, \
83 0x07, 0x03, 0x42, 0x00, 0x04, 0x2f, 0xe1, 0xa2, \
84 0x3e, 0xbf, 0xa5, 0x5b, 0x3e, 0x46, 0x1d, 0x59, \
85 0xa4, 0x35, 0x22, 0xd7, 0x97, 0x48, 0x98, 0x1c, \
86 0xba, 0x6d, 0x28, 0x9a, 0x98, 0xf1, 0xbd, 0x7d, \
87 0x00, 0x00, 0x99, 0x01, 0x05, 0xff, 0x65, 0x66, \
88 0x80, 0xdb, 0xbb, 0xed, 0xbc, 0x2b, 0xae, 0x60, \
89 0x7e, 0x6e, 0xf7, 0x72, 0xf5, 0x76, 0xb0, 0x4d, \
90 0x54, 0xc4, 0xe5, 0xf3, 0x2f, 0x59, 0x6f, 0x26, \
91 0xe6, 0x11, 0x15, 0xc7, 0x27, 0x2c, 0xf6, 0xca, \
92 0x75, 0x94, 0xa3, 0x3b, 0x30, 0x39, 0x30, 0x22, \
93 0x06, 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, \
94 0xc4, 0x0a, 0x02, 0x04, 0x15, 0x31, 0x2e, 0x33, \
95 0x00, 0x00, 0x99, 0x01, 0x06, 0x2e, 0x36, 0x2e, \
96 0x31, 0x2e, 0x34, 0x2e, 0x31, 0x2e, 0x34, 0x31, \
97 0x34, 0x38, 0x32, 0x2e, 0x31, 0x2e, 0x32, 0x30, \
98 0x13, 0x06, 0x0b, 0x2b, 0x06, 0x01, 0x04, 0x01, \
99 0x82, 0xe5, 0x1c, 0x02, 0x01, 0x01, 0x04, 0x04, \
100 0x03, 0x02, 0x04, 0x30, 0x30, 0x0d, 0x06, 0x09, \
101 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, \
102 0x0b, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, \
103 0x00, 0x00, 0x99, 0x01, 0x07, 0x85, 0x6a, 0xfa, \
104 0x8b, 0xcf, 0x4f, 0x3f, 0x62, 0x5f, 0x29, 0x1b, \
105 0xc1, 0x15, 0x8e, 0x3c, 0x7e, 0xbd, 0x25, 0x52, \
106 0xbc, 0xf7, 0x57, 0x07, 0x53, 0xf5, 0x12, 0x1d, \
107 0xa6, 0xa5, 0x4d, 0x24, 0xcc, 0xcf, 0xae, 0x27, \
108 0xce, 0xd6, 0xab, 0x31, 0x12, 0x8c, 0x29, 0x7e, \
109 0x5b, 0x5b, 0x89, 0x05, 0xdd, 0xa0, 0x20, 0x17, \
110 0x93, 0x1f, 0x1f, 0x5f, 0x59, 0x25, 0x93, 0x59, \
111 0x00, 0x00, 0x99, 0x01, 0x08, 0x51, 0xfc, 0x00, \
112 0x4b, 0xcb, 0xe2, 0x0a, 0xdd, 0x7d, 0x8d, 0x05, \
113 0x2f, 0x95, 0x43, 0xb3, 0x49, 0x6c, 0x15, 0xb8, \
114 0x31, 0x0e, 0x10, 0xcb, 0xd9, 0xbb, 0x05, 0x38, \
115 0x27, 0x4f, 0x58, 0x3e, 0xad, 0x1f, 0x45, 0x12, \
116 0x88, 0xc3, 0xea, 0x76, 0xd0, 0x70, 0xad, 0x44, \
117 0xe5, 0x3a, 0xfe, 0xa8, 0xf2, 0x2d, 0x1f, 0x73, \
118 0x62, 0x5f, 0xf2, 0xd5, 0x89, 0xfe, 0x30, 0xdf, \
119 0x00, 0x00, 0x99, 0x01, 0x09, 0x26, 0x62, 0xcb, \
120 0x7c, 0xbb, 0x7c, 0x99, 0x61, 0x80, 0xad, 0xcf, \
121 0xa9, 0x8a, 0x4d, 0x01, 0x2c, 0xf3, 0x13, 0x46, \
122 0xcd, 0x11, 0x74, 0x6a, 0x58, 0x48, 0xe8, 0xbe, \
123 0xed, 0xf3, 0xe3, 0x0c, 0xcb, 0xd9, 0xc1, 0xdd, \
124 0x22, 0x16, 0x71, 0xb2, 0x83, 0x88, 0x61, 0xf6, \
125 0x5a, 0x45, 0x36, 0x23, 0xb5, 0x18, 0xd5, 0x56, \
126 0x7f, 0xa8, 0xf0, 0xa3, 0xce, 0x10, 0x5d, 0xf4, \
127 0x00, 0x00, 0x99, 0x01, 0x0a, 0xf1, 0x39, 0x53, \
128 0xe1, 0x14, 0xea, 0x59, 0xe0, 0xa7, 0xf2, 0xfe, \
129 0x66, 0x88, 0x67, 0x43, 0x2e, 0x52, 0xfd, 0x6a, \
130 0x2f, 0x64, 0xf7, 0x3c, 0x48, 0xcd, 0x9b, 0x38, \
131 0xf2, 0xdf, 0xba, 0x2c, 0x7a, 0x4b, 0x3b, 0x11, \
132 0x28, 0xdf, 0x26, 0xd6, 0x6a, 0x24, 0xf8, 0x95, \
133 0xdd, 0xa0, 0xb6, 0x11, 0x80, 0xf4, 0x14, 0x4f, \
134 0x6b, 0x70, 0x75, 0xc3, 0x18, 0xa4, 0x9a, 0xe0, \
135 0x00, 0x00, 0x99, 0x01, 0x0b, 0x8b, 0x58, 0xd3, \
136 0x6a, 0xdb, 0x1e, 0x30, 0x53, 0x67, 0x2b, 0x17, \
137 0xc5, 0xa1, 0x9f, 0x7f, 0x0a, 0x22, 0xf1, 0x0e, \
138 0x94, 0x30, 0x44, 0x02, 0x20, 0x07, 0x5c, 0x4f, \
139 0xd2, 0x83, 0xb6, 0x9f, 0x0a, 0x4a, 0x4d, 0x4b, \
140 0x08, 0x35, 0xeb, 0xc0, 0x7e, 0x4a, 0x14, 0x2e, \
141 0xc7, 0x8c, 0xd6, 0x64, 0x2f, 0xd3, 0x1e, 0xcc, \
142 0xb5, 0xe8, 0x42, 0xea, 0xf6, 0x02, 0x20, 0x6b, \
143 0x00, 0x00, 0x99, 0x01, 0x0c, 0x5a, 0xba, 0x4a, \
144 0xc8, 0xd7, 0x89, 0xcc, 0x77, 0xe6, 0xb9, 0xa3, \
145 0x34, 0xea, 0x06, 0x85, 0x72, 0xc6, 0x28, 0xa8, \
146 0x7a, 0xaa, 0x19, 0x88, 0x34, 0xbb, 0xdc, 0x64, \
147 0x90, 0x0a, 0xdb, 0x39, 0x90, 0x00, 0x00, 0x00, \
148 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
149 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
150 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
151
152#endif /* !_WIREDATA_U2F_H */
diff --git a/fuzz/wrap.c b/fuzz/wrap.c
index 8ff7ee7..c030231 100644
--- a/fuzz/wrap.c
+++ b/fuzz/wrap.c
@@ -18,6 +18,8 @@
18 18
19#include "mutator_aux.h" 19#include "mutator_aux.h"
20 20
21extern int prng_up;
22
21/* 23/*
22 * Build wrappers around functions of interest, and have them fail 24 * Build wrappers around functions of interest, and have them fail
23 * in a pseudo-random manner. 25 * in a pseudo-random manner.
@@ -27,7 +29,7 @@
27extern type __wrap_##name args; \ 29extern type __wrap_##name args; \
28extern type __real_##name args; \ 30extern type __real_##name args; \
29type __wrap_##name args { \ 31type __wrap_##name args { \
30 if (uniform_random(400) < (prob)) { \ 32 if (prng_up && uniform_random(400) < (prob)) { \
31 return (retval); \ 33 return (retval); \
32 } \ 34 } \
33 \ 35 \
@@ -141,6 +143,22 @@ WRAP(RSA *,
141 1 143 1
142) 144)
143 145
146WRAP(EC_KEY *,
147 EVP_PKEY_get0_EC_KEY,
148 (EVP_PKEY *pkey),
149 NULL,
150 (pkey),
151 1
152)
153
154WRAP(int,
155 EVP_PKEY_get_raw_public_key,
156 (const EVP_PKEY *pkey, unsigned char *pub, size_t *len),
157 0,
158 (pkey, pub, len),
159 1
160)
161
144WRAP(EVP_MD_CTX *, 162WRAP(EVP_MD_CTX *,
145 EVP_MD_CTX_new, 163 EVP_MD_CTX_new,
146 (void), 164 (void),
@@ -166,6 +184,14 @@ WRAP(BIGNUM *,
166 1 184 1
167) 185)
168 186
187WRAP(int,
188 BN_bn2bin,
189 (const BIGNUM *a, unsigned char *to),
190 -1,
191 (a, to),
192 1
193)
194
169WRAP(BIGNUM *, 195WRAP(BIGNUM *,
170 BN_CTX_get, 196 BN_CTX_get,
171 (BN_CTX *ctx), 197 (BN_CTX *ctx),
@@ -214,6 +240,14 @@ WRAP(const EC_GROUP *,
214 1 240 1
215) 241)
216 242
243WRAP(const BIGNUM *,
244 EC_KEY_get0_private_key,
245 (const EC_KEY *key),
246 NULL,
247 (key),
248 1
249)
250
217WRAP(EC_POINT *, 251WRAP(EC_POINT *,
218 EC_POINT_new, 252 EC_POINT_new,
219 (const EC_GROUP *group), 253 (const EC_GROUP *group),
@@ -222,6 +256,14 @@ WRAP(EC_POINT *,
222 1 256 1
223) 257)
224 258
259WRAP(int,
260 EC_POINT_get_affine_coordinates_GFp,
261 (const EC_GROUP *group, const EC_POINT *p, BIGNUM *x, BIGNUM *y, BN_CTX *ctx),
262 0,
263 (group, p, x, y, ctx),
264 1
265)
266
225WRAP(EVP_PKEY *, 267WRAP(EVP_PKEY *,
226 EVP_PKEY_new, 268 EVP_PKEY_new,
227 (void), 269 (void),
@@ -238,6 +280,38 @@ WRAP(int,
238 1 280 1
239) 281)
240 282
283WRAP(int,
284 EVP_PKEY_keygen_init,
285 (EVP_PKEY_CTX *ctx),
286 0,
287 (ctx),
288 1
289)
290
291WRAP(int,
292 EVP_PKEY_keygen,
293 (EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey),
294 0,
295 (ctx, ppkey),
296 1
297)
298
299WRAP(int,
300 EVP_PKEY_paramgen_init,
301 (EVP_PKEY_CTX *ctx),
302 0,
303 (ctx),
304 1
305)
306
307WRAP(int,
308 EVP_PKEY_paramgen,
309 (EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey),
310 0,
311 (ctx, ppkey),
312 1
313)
314
241WRAP(EVP_PKEY *, 315WRAP(EVP_PKEY *,
242 EVP_PKEY_new_raw_public_key, 316 EVP_PKEY_new_raw_public_key,
243 (int type, ENGINE *e, const unsigned char *key, size_t keylen), 317 (int type, ENGINE *e, const unsigned char *key, size_t keylen),
@@ -254,6 +328,14 @@ WRAP(EVP_PKEY_CTX *,
254 1 328 1
255) 329)
256 330
331WRAP(EVP_PKEY_CTX *,
332 EVP_PKEY_CTX_new_id,
333 (int id, ENGINE *e),
334 NULL,
335 (id, e),
336 1
337)
338
257WRAP(int, 339WRAP(int,
258 EVP_PKEY_derive_init, 340 EVP_PKEY_derive_init,
259 (EVP_PKEY_CTX *ctx), 341 (EVP_PKEY_CTX *ctx),
@@ -346,6 +428,30 @@ WRAP(cbor_item_t *,
346) 428)
347 429
348WRAP(cbor_item_t *, 430WRAP(cbor_item_t *,
431 cbor_build_bool,
432 (bool value),
433 NULL,
434 (value),
435 1
436)
437
438WRAP(cbor_item_t *,
439 cbor_build_negint8,
440 (uint8_t value),
441 NULL,
442 (value),
443 1
444)
445
446WRAP(cbor_item_t *,
447 cbor_build_negint16,
448 (uint16_t value),
449 NULL,
450 (value),
451 1
452)
453
454WRAP(cbor_item_t *,
349 cbor_load, 455 cbor_load,
350 (cbor_data source, size_t source_size, struct cbor_load_result *result), 456 (cbor_data source, size_t source_size, struct cbor_load_result *result),
351 NULL, 457 NULL,
@@ -361,6 +467,14 @@ WRAP(cbor_item_t *,
361 1 467 1
362) 468)
363 469
470WRAP(cbor_item_t *,
471 cbor_build_uint32,
472 (uint32_t value),
473 NULL,
474 (value),
475 1
476)
477
364WRAP(struct cbor_pair *, 478WRAP(struct cbor_pair *,
365 cbor_map_handle, 479 cbor_map_handle,
366 (const cbor_item_t *item), 480 (const cbor_item_t *item),
@@ -378,6 +492,14 @@ WRAP(cbor_item_t **,
378) 492)
379 493
380WRAP(bool, 494WRAP(bool,
495 cbor_array_push,
496 (cbor_item_t *array, cbor_item_t *pushee),
497 false,
498 (array, pushee),
499 1
500)
501
502WRAP(bool,
381 cbor_map_add, 503 cbor_map_add,
382 (cbor_item_t *item, struct cbor_pair pair), 504 (cbor_item_t *item, struct cbor_pair pair),
383 false, 505 false,
@@ -393,6 +515,14 @@ WRAP(cbor_item_t *,
393 1 515 1
394) 516)
395 517
518WRAP(cbor_item_t *,
519 cbor_new_definite_array,
520 (size_t size),
521 NULL,
522 (size),
523 1
524)
525
396WRAP(size_t, 526WRAP(size_t,
397 cbor_serialize_alloc, 527 cbor_serialize_alloc,
398 (const cbor_item_t *item, cbor_mutable_data *buffer, 528 (const cbor_item_t *item, cbor_mutable_data *buffer,
diff --git a/fuzz/wrapped.sym b/fuzz/wrapped.sym
index 3679f91..3df4f12 100644
--- a/fuzz/wrapped.sym
+++ b/fuzz/wrapped.sym
@@ -1,19 +1,28 @@
1BN_bin2bn 1BN_bin2bn
2BN_bn2bin
2BN_CTX_get 3BN_CTX_get
3BN_CTX_new 4BN_CTX_new
4BN_new 5BN_new
5calloc 6calloc
6cbor_array_handle 7cbor_array_handle
8cbor_array_push
9cbor_build_bool
7cbor_build_bytestring 10cbor_build_bytestring
11cbor_build_negint16
12cbor_build_negint8
8cbor_build_string 13cbor_build_string
14cbor_build_uint32
9cbor_build_uint8 15cbor_build_uint8
10cbor_load 16cbor_load
11cbor_map_add 17cbor_map_add
12cbor_map_handle 18cbor_map_handle
19cbor_new_definite_array
13cbor_new_definite_map 20cbor_new_definite_map
14cbor_serialize_alloc 21cbor_serialize_alloc
15EC_KEY_get0_group 22EC_KEY_get0_group
23EC_KEY_get0_private_key
16EC_KEY_new_by_curve_name 24EC_KEY_new_by_curve_name
25EC_POINT_get_affine_coordinates_GFp
17EC_POINT_new 26EC_POINT_new
18EVP_CIPHER_CTX_new 27EVP_CIPHER_CTX_new
19EVP_CIPHER_CTX_set_padding 28EVP_CIPHER_CTX_set_padding
@@ -25,11 +34,18 @@ EVP_EncryptUpdate
25EVP_MD_CTX_new 34EVP_MD_CTX_new
26EVP_PKEY_assign 35EVP_PKEY_assign
27EVP_PKEY_CTX_new 36EVP_PKEY_CTX_new
37EVP_PKEY_CTX_new_id
28EVP_PKEY_derive_init 38EVP_PKEY_derive_init
29EVP_PKEY_derive_set_peer 39EVP_PKEY_derive_set_peer
40EVP_PKEY_get0_EC_KEY
30EVP_PKEY_get0_RSA 41EVP_PKEY_get0_RSA
42EVP_PKEY_get_raw_public_key
43EVP_PKEY_keygen
44EVP_PKEY_keygen_init
31EVP_PKEY_new 45EVP_PKEY_new
32EVP_PKEY_new_raw_public_key 46EVP_PKEY_new_raw_public_key
47EVP_PKEY_paramgen
48EVP_PKEY_paramgen_init
33EVP_sha256 49EVP_sha256
34fido_tx 50fido_tx
35HMAC 51HMAC