diff options
author | Colin Watson <cjwatson@debian.org> | 2020-04-17 20:57:34 +0100 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2020-04-18 09:48:21 +0100 |
commit | df7226c4b684fd229dc046388225c69ded877721 (patch) | |
tree | e69014e1ee868c4ec178b8a36baae7de31786beb | |
parent | f794345c2d734f593da8ed7754e5dbb5809c688d (diff) | |
parent | 75073d0a8478441cc97a6efa10b566c5fb1dac81 (diff) |
Update upstream source from tag 'upstream/1.4.0'
Update to upstream version '1.4.0'
with Debian dir 64889867df57bd13ea0cb964223697d378d391ce
123 files changed, 3656 insertions, 3120 deletions
diff --git a/.github/workflows/cifuzz_oss.yml b/.github/workflows/cifuzz_oss.yml new file mode 100644 index 0000000..cbb334c --- /dev/null +++ b/.github/workflows/cifuzz_oss.yml | |||
@@ -0,0 +1,23 @@ | |||
1 | name: CIFuzz | ||
2 | on: [pull_request] | ||
3 | jobs: | ||
4 | Fuzzing: | ||
5 | runs-on: ubuntu-latest | ||
6 | steps: | ||
7 | - name: Build Fuzzers | ||
8 | uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master | ||
9 | with: | ||
10 | oss-fuzz-project-name: 'libfido2' | ||
11 | dry-run: false | ||
12 | - name: Run Fuzzers | ||
13 | uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master | ||
14 | with: | ||
15 | oss-fuzz-project-name: 'libfido2' | ||
16 | fuzz-seconds: 600 | ||
17 | dry-run: false | ||
18 | - name: Upload Crash | ||
19 | uses: actions/upload-artifact@v1 | ||
20 | if: failure() | ||
21 | with: | ||
22 | name: artifacts | ||
23 | path: ./out/artifacts | ||
diff --git a/.github/workflows/scan.yml b/.github/workflows/scan.yml new file mode 100644 index 0000000..008961b --- /dev/null +++ b/.github/workflows/scan.yml | |||
@@ -0,0 +1,36 @@ | |||
1 | name: static code analysis | ||
2 | |||
3 | on: | ||
4 | push: | ||
5 | schedule: | ||
6 | - cron: '0 0 * * 1' | ||
7 | |||
8 | env: | ||
9 | SCAN_IMG: | ||
10 | yes-docker-local.artifactory.in.yubico.org/static-code-analysis/c:v1 | ||
11 | SECRET: ${{ secrets.ARTIFACTORY_READER_TOKEN }} | ||
12 | |||
13 | jobs: | ||
14 | build: | ||
15 | runs-on: ubuntu-latest | ||
16 | |||
17 | steps: | ||
18 | - uses: actions/checkout@master | ||
19 | |||
20 | - name: Scan but do not fail on warnings | ||
21 | run: | | ||
22 | if [ "${SECRET}" != "" ]; then | ||
23 | docker login yes-docker-local.artifactory.in.yubico.org/ \ | ||
24 | -u svc-static-code-analysis-reader \ | ||
25 | -p ${{ secrets.ARTIFACTORY_READER_TOKEN }} | ||
26 | docker pull ${SCAN_IMG} | ||
27 | docker run -v${PWD}:/k -e COMPILE_DEPS="${COMPILE_DEPS}" \ | ||
28 | -e PROJECT_NAME=${GITHUB_REPOSITORY#Yubico/} -t ${SCAN_IMG} | ||
29 | fi | ||
30 | continue-on-error: true | ||
31 | |||
32 | - uses: actions/upload-artifact@master | ||
33 | if: failure() | ||
34 | with: | ||
35 | name: suppression_files | ||
36 | path: suppression_files | ||
@@ -1,6 +1,9 @@ | |||
1 | build/ | 1 | build/ |
2 | cscope.out | 2 | cscope.out |
3 | fuzz/build/ | 3 | fuzz/build/ |
4 | fuzz/corpus.tgz- | ||
5 | fuzz/fuzz_*/ | ||
4 | fuzz/obj/ | 6 | fuzz/obj/ |
7 | fuzz/report | ||
5 | fuzz/*.so | 8 | fuzz/*.so |
6 | output/ | 9 | output/ |
diff --git a/.travis.yml b/.travis.yml index 5ddf36f..c2bff78 100644 --- a/.travis.yml +++ b/.travis.yml | |||
@@ -53,7 +53,7 @@ matrix: | |||
53 | script: /bin/sh -eux .travis/build-osx-clang | 53 | script: /bin/sh -eux .travis/build-osx-clang |
54 | - os: linux | 54 | - os: linux |
55 | compiler: clang-7 | 55 | compiler: clang-7 |
56 | dist: xenial | 56 | dist: bionic |
57 | sudo: required | 57 | sudo: required |
58 | addons: | 58 | addons: |
59 | apt: | 59 | apt: |
@@ -68,7 +68,7 @@ matrix: | |||
68 | script: /bin/sh -eux .travis/fuzz-linux-asan | 68 | script: /bin/sh -eux .travis/fuzz-linux-asan |
69 | - os: linux | 69 | - os: linux |
70 | compiler: clang-7 | 70 | compiler: clang-7 |
71 | dist: xenial | 71 | dist: bionic |
72 | sudo: required | 72 | sudo: required |
73 | addons: | 73 | addons: |
74 | apt: | 74 | apt: |
diff --git a/.travis/fuzz-linux-asan b/.travis/fuzz-linux-asan index 0a0aebb..af8a08c 100644 --- a/.travis/fuzz-linux-asan +++ b/.travis/fuzz-linux-asan | |||
@@ -45,14 +45,15 @@ make | |||
45 | 45 | ||
46 | # Fuzz with ASAN. | 46 | # Fuzz with ASAN. |
47 | mkdir corpus | 47 | mkdir corpus |
48 | curl -s https://ambientworks.net/tmp/corpus.tgz > ../fuzz/corpus.tgz | ||
48 | tar -C corpus -zxf ../fuzz/corpus.tgz | 49 | tar -C corpus -zxf ../fuzz/corpus.tgz |
49 | fuzz/fuzz_cred -use_value_profile=1 -reload=30 -print_pcs=1 \ | 50 | fuzz/fuzz_cred -use_value_profile=1 -reload=30 -print_pcs=1 \ |
50 | -print_funcs=30 -timeout=10 -max_len=17408 -runs=1 corpus/fuzz_cred | 51 | -print_funcs=30 -timeout=10 -runs=1 corpus/fuzz_cred |
51 | fuzz/fuzz_assert -use_value_profile=1 -reload=30 -print_pcs=1 \ | 52 | fuzz/fuzz_assert -use_value_profile=1 -reload=30 -print_pcs=1 \ |
52 | -print_funcs=30 -timeout=10 -max_len=17408 -runs=1 corpus/fuzz_assert | 53 | -print_funcs=30 -timeout=10 -runs=1 corpus/fuzz_assert |
53 | fuzz/fuzz_credman -use_value_profile=1 -reload=30 -print_pcs=1 \ | 54 | fuzz/fuzz_credman -use_value_profile=1 -reload=30 -print_pcs=1 \ |
54 | -print_funcs=30 -timeout=10 -max_len=17408 -runs=1 corpus/fuzz_credman | 55 | -print_funcs=30 -timeout=10 -runs=1 corpus/fuzz_credman |
55 | fuzz/fuzz_mgmt -use_value_profile=1 -reload=30 -print_pcs=1 \ | 56 | fuzz/fuzz_mgmt -use_value_profile=1 -reload=30 -print_pcs=1 \ |
56 | -print_funcs=30 -timeout=10 -max_len=17408 -runs=1 corpus/fuzz_mgmt | 57 | -print_funcs=30 -timeout=10 -runs=1 corpus/fuzz_mgmt |
57 | fuzz/fuzz_bio -use_value_profile=1 -reload=30 -print_pcs=1 \ | 58 | fuzz/fuzz_bio -use_value_profile=1 -reload=30 -print_pcs=1 \ |
58 | -print_funcs=30 -timeout=10 -max_len=17408 -runs=1 corpus/fuzz_bio | 59 | -print_funcs=30 -timeout=10 -runs=1 corpus/fuzz_bio |
diff --git a/.travis/fuzz-linux-msan b/.travis/fuzz-linux-msan index fd7b2ac..e67ab22 100644 --- a/.travis/fuzz-linux-msan +++ b/.travis/fuzz-linux-msan | |||
@@ -45,14 +45,15 @@ make | |||
45 | 45 | ||
46 | # Fuzz with MSAN. | 46 | # Fuzz with MSAN. |
47 | mkdir corpus | 47 | mkdir corpus |
48 | curl -s https://ambientworks.net/tmp/corpus.tgz > ../fuzz/corpus.tgz | ||
48 | tar -C corpus -zxf ../fuzz/corpus.tgz | 49 | tar -C corpus -zxf ../fuzz/corpus.tgz |
49 | fuzz/fuzz_cred -use_value_profile=1 -reload=30 -print_pcs=1 \ | 50 | fuzz/fuzz_cred -use_value_profile=1 -reload=30 -print_pcs=1 \ |
50 | -print_funcs=30 -timeout=10 -max_len=17408 -runs=1 corpus/fuzz_cred | 51 | -print_funcs=30 -timeout=10 -runs=1 corpus/fuzz_cred |
51 | fuzz/fuzz_assert -use_value_profile=1 -reload=30 -print_pcs=1 \ | 52 | fuzz/fuzz_assert -use_value_profile=1 -reload=30 -print_pcs=1 \ |
52 | -print_funcs=30 -timeout=10 -max_len=17408 -runs=1 corpus/fuzz_assert | 53 | -print_funcs=30 -timeout=10 -runs=1 corpus/fuzz_assert |
53 | fuzz/fuzz_credman -use_value_profile=1 -reload=30 -print_pcs=1 \ | 54 | fuzz/fuzz_credman -use_value_profile=1 -reload=30 -print_pcs=1 \ |
54 | -print_funcs=30 -timeout=10 -max_len=17408 -runs=1 corpus/fuzz_credman | 55 | -print_funcs=30 -timeout=10 -runs=1 corpus/fuzz_credman |
55 | fuzz/fuzz_mgmt -use_value_profile=1 -reload=30 -print_pcs=1 \ | 56 | fuzz/fuzz_mgmt -use_value_profile=1 -reload=30 -print_pcs=1 \ |
56 | -print_funcs=30 -timeout=10 -max_len=17408 -runs=1 corpus/fuzz_mgmt | 57 | -print_funcs=30 -timeout=10 -runs=1 corpus/fuzz_mgmt |
57 | fuzz/fuzz_bio -use_value_profile=1 -reload=30 -print_pcs=1 \ | 58 | fuzz/fuzz_bio -use_value_profile=1 -reload=30 -print_pcs=1 \ |
58 | -print_funcs=30 -timeout=10 -max_len=17408 -runs=1 corpus/fuzz_bio | 59 | -print_funcs=30 -timeout=10 -runs=1 corpus/fuzz_bio |
diff --git a/CMakeLists.txt b/CMakeLists.txt index 9481c46..0bb2e87 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -19,14 +19,19 @@ set(CMAKE_VERBOSE_MAKEFILE on) | |||
19 | set(CMAKE_POSITION_INDEPENDENT_CODE ON) | 19 | set(CMAKE_POSITION_INDEPENDENT_CODE ON) |
20 | 20 | ||
21 | set(FIDO_MAJOR "1") | 21 | set(FIDO_MAJOR "1") |
22 | set(FIDO_MINOR "3") | 22 | set(FIDO_MINOR "4") |
23 | set(FIDO_PATCH "1") | 23 | set(FIDO_PATCH "0") |
24 | set(FIDO_VERSION ${FIDO_MAJOR}.${FIDO_MINOR}.${FIDO_PATCH}) | 24 | set(FIDO_VERSION ${FIDO_MAJOR}.${FIDO_MINOR}.${FIDO_PATCH}) |
25 | 25 | ||
26 | add_definitions(-D_FIDO_MAJOR=${FIDO_MAJOR}) | 26 | add_definitions(-D_FIDO_MAJOR=${FIDO_MAJOR}) |
27 | add_definitions(-D_FIDO_MINOR=${FIDO_MINOR}) | 27 | add_definitions(-D_FIDO_MINOR=${FIDO_MINOR}) |
28 | add_definitions(-D_FIDO_PATCH=${FIDO_PATCH}) | 28 | add_definitions(-D_FIDO_PATCH=${FIDO_PATCH}) |
29 | 29 | ||
30 | if(CYGWIN OR MSYS) | ||
31 | set(WIN32 1) | ||
32 | add_definitions(-DWINVER=0x0a00) | ||
33 | endif() | ||
34 | |||
30 | if(WIN32) | 35 | if(WIN32) |
31 | add_definitions(-DWIN32_LEAN_AND_MEAN) | 36 | add_definitions(-DWIN32_LEAN_AND_MEAN) |
32 | endif() | 37 | endif() |
@@ -36,11 +41,6 @@ if(APPLE) | |||
36 | "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") | 41 | "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") |
37 | endif() | 42 | endif() |
38 | 43 | ||
39 | # /dev/urandom | ||
40 | if(UNIX) | ||
41 | add_definitions(-DHAS_DEV_URANDOM) | ||
42 | endif() | ||
43 | |||
44 | # Observe OpenBSD's library versioning scheme. | 44 | # Observe OpenBSD's library versioning scheme. |
45 | if(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") | 45 | if(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") |
46 | set(LIB_VERSION ${FIDO_MAJOR}.${FIDO_MINOR}) | 46 | set(LIB_VERSION ${FIDO_MAJOR}.${FIDO_MINOR}) |
@@ -79,7 +79,7 @@ if(MSVC) | |||
79 | else() | 79 | else() |
80 | include(FindPkgConfig) | 80 | include(FindPkgConfig) |
81 | pkg_search_module(CBOR libcbor) | 81 | pkg_search_module(CBOR libcbor) |
82 | pkg_search_module(CRYPTO libcrypto REQUIRED) | 82 | pkg_search_module(CRYPTO libcrypto) |
83 | 83 | ||
84 | # XXX workaround libcbor's missing .pc file | 84 | # XXX workaround libcbor's missing .pc file |
85 | if(NOT CBOR_FOUND) | 85 | if(NOT CBOR_FOUND) |
@@ -90,12 +90,24 @@ else() | |||
90 | set(CBOR_LIBRARIES "cbor") | 90 | set(CBOR_LIBRARIES "cbor") |
91 | endif() | 91 | endif() |
92 | 92 | ||
93 | # XXX workaround libcrypto's missing .pc file | ||
94 | if(NOT CRYPTO_FOUND) | ||
95 | check_include_files(openssl/opensslv.h HAVE_OPENSSLV_H) | ||
96 | if(NOT HAVE_OPENSSLV_H) | ||
97 | message(FATAL_ERROR "could not find crypto header files") | ||
98 | endif() | ||
99 | set(CRYPTO_LIBRARIES "crypto") | ||
100 | endif() | ||
101 | |||
93 | if(CMAKE_SYSTEM_NAME STREQUAL "Linux") | 102 | if(CMAKE_SYSTEM_NAME STREQUAL "Linux") |
94 | pkg_search_module(UDEV libudev REQUIRED) | 103 | pkg_search_module(UDEV libudev REQUIRED) |
95 | set(UDEV_NAME "udev") | 104 | set(UDEV_NAME "udev") |
96 | # Define be32toh(). | 105 | # Define be32toh(). |
97 | add_definitions(-D_GNU_SOURCE) | 106 | add_definitions(-D_GNU_SOURCE) |
98 | elseif(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") | 107 | # If using hidapi, use hidapi-hidraw. |
108 | set(HIDAPI_SUFFIX -hidraw) | ||
109 | elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR | ||
110 | CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") | ||
99 | set(BASE_LIBRARIES usbhid) | 111 | set(BASE_LIBRARIES usbhid) |
100 | endif() | 112 | endif() |
101 | 113 | ||
@@ -103,6 +115,15 @@ else() | |||
103 | # MinGW is stuck with a flavour of C89. | 115 | # MinGW is stuck with a flavour of C89. |
104 | add_definitions(-DFIDO_NO_DIAGNOSTIC) | 116 | add_definitions(-DFIDO_NO_DIAGNOSTIC) |
105 | add_definitions(-DWC_ERR_INVALID_CHARS=0x80) | 117 | add_definitions(-DWC_ERR_INVALID_CHARS=0x80) |
118 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-parameter") | ||
119 | endif() | ||
120 | |||
121 | if(USE_HIDAPI) | ||
122 | add_definitions(-DUSE_HIDAPI) | ||
123 | pkg_search_module(HIDAPI hidapi${HIDAPI_SUFFIX} REQUIRED) | ||
124 | if(HIDAPI_FOUND) | ||
125 | set(HIDAPI_LIBRARIES hidapi${HIDAPI_SUFFIX}) | ||
126 | endif() | ||
106 | endif() | 127 | endif() |
107 | 128 | ||
108 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") | 129 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") |
@@ -114,7 +135,12 @@ else() | |||
114 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wbad-function-cast") | 135 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wbad-function-cast") |
115 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic") | 136 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic") |
116 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic-errors") | 137 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic-errors") |
117 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector-all") | 138 | check_c_compiler_flag("-fstack-protector-all" HAVE_STACK_PROTECTOR_ALL) |
139 | if(HAVE_STACK_PROTECTOR_ALL) | ||
140 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector-all") | ||
141 | endif() | ||
142 | |||
143 | add_definitions(-D_DEFAULT_SOURCE) | ||
118 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99") | 144 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99") |
119 | 145 | ||
120 | set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g2") | 146 | set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g2") |
@@ -123,6 +149,7 @@ else() | |||
123 | if(FUZZ) | 149 | if(FUZZ) |
124 | if(LIBFUZZER) | 150 | if(LIBFUZZER) |
125 | set(FUZZ_LDFLAGS "-fsanitize=fuzzer") | 151 | set(FUZZ_LDFLAGS "-fsanitize=fuzzer") |
152 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=fuzzer-no-link") | ||
126 | endif() | 153 | endif() |
127 | add_definitions(-DFIDO_FUZZ) | 154 | add_definitions(-DFIDO_FUZZ) |
128 | endif() | 155 | endif() |
@@ -192,6 +219,12 @@ if(HAVE_SIGNAL_H) | |||
192 | add_definitions(-DHAVE_SIGNAL_H) | 219 | add_definitions(-DHAVE_SIGNAL_H) |
193 | endif() | 220 | endif() |
194 | 221 | ||
222 | # sys/random.h | ||
223 | check_include_files(sys/random.h HAVE_SYS_RANDOM_H) | ||
224 | if(HAVE_SYS_RANDOM_H) | ||
225 | add_definitions(-DHAVE_SYS_RANDOM_H) | ||
226 | endif() | ||
227 | |||
195 | # strlcpy | 228 | # strlcpy |
196 | check_function_exists(strlcpy HAVE_STRLCPY) | 229 | check_function_exists(strlcpy HAVE_STRLCPY) |
197 | if(HAVE_STRLCPY) | 230 | if(HAVE_STRLCPY) |
@@ -289,21 +322,32 @@ if(HAVE_ARC4RANDOM_BUF) | |||
289 | add_definitions(-DHAVE_ARC4RANDOM_BUF) | 322 | add_definitions(-DHAVE_ARC4RANDOM_BUF) |
290 | endif() | 323 | endif() |
291 | 324 | ||
292 | # getentropy | 325 | # getrandom |
293 | check_function_exists(getentropy HAVE_GETENTROPY) | 326 | check_function_exists(getrandom HAVE_GETRANDOM) |
294 | if(HAVE_GETENTROPY) | 327 | if(HAVE_GETRANDOM) |
295 | add_definitions(-DHAVE_GETENTROPY) | 328 | add_definitions(-DHAVE_GETRANDOM) |
329 | endif() | ||
330 | |||
331 | # /dev/urandom | ||
332 | if(UNIX) | ||
333 | add_definitions(-DHAVE_DEV_URANDOM) | ||
296 | endif() | 334 | endif() |
297 | 335 | ||
298 | # export list | 336 | # export list |
299 | if(CMAKE_C_COMPILER_ID STREQUAL "AppleClang") | 337 | if(APPLE AND (CMAKE_C_COMPILER_ID STREQUAL "Clang" OR |
338 | CMAKE_C_COMPILER_ID STREQUAL "AppleClang")) | ||
300 | # clang + lld | 339 | # clang + lld |
301 | string(CONCAT CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} | 340 | string(CONCAT CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} |
302 | " -exported_symbols_list ${CMAKE_CURRENT_SOURCE_DIR}/src/export.llvm") | 341 | " -exported_symbols_list ${CMAKE_CURRENT_SOURCE_DIR}/src/export.llvm") |
303 | elseif(NOT MSVC) | 342 | elseif(NOT MSVC) |
304 | # clang/gcc + gnu ld | 343 | # clang/gcc + gnu ld |
305 | string(CONCAT CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} | 344 | if(FUZZ) |
306 | " -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/src/export.gnu") | 345 | string(CONCAT CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} |
346 | " -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/fuzz/export.gnu") | ||
347 | else() | ||
348 | string(CONCAT CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} | ||
349 | " -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/src/export.gnu") | ||
350 | endif() | ||
307 | if(NOT WIN32) | 351 | if(NOT WIN32) |
308 | string(CONCAT CMAKE_SHARED_LINKER_FLAGS | 352 | string(CONCAT CMAKE_SHARED_LINKER_FLAGS |
309 | ${CMAKE_SHARED_LINKER_FLAGS} | 353 | ${CMAKE_SHARED_LINKER_FLAGS} |
@@ -344,6 +388,7 @@ message(STATUS "CRYPTO_INCLUDE_DIRS: ${CRYPTO_INCLUDE_DIRS}") | |||
344 | message(STATUS "CRYPTO_LIBRARY_DIRS: ${CRYPTO_LIBRARY_DIRS}") | 388 | message(STATUS "CRYPTO_LIBRARY_DIRS: ${CRYPTO_LIBRARY_DIRS}") |
345 | message(STATUS "CRYPTO_LIBRARIES: ${CRYPTO_LIBRARIES}") | 389 | message(STATUS "CRYPTO_LIBRARIES: ${CRYPTO_LIBRARIES}") |
346 | message(STATUS "BASE_LIBRARIES: ${BASE_LIBRARIES}") | 390 | message(STATUS "BASE_LIBRARIES: ${BASE_LIBRARIES}") |
391 | message(STATUS "HIDAPI_LIBRARIES: ${HIDAPI_LIBRARIES}") | ||
347 | message(STATUS "VERSION: ${FIDO_VERSION}") | 392 | message(STATUS "VERSION: ${FIDO_VERSION}") |
348 | message(STATUS "LIB_VERSION: ${LIB_VERSION}") | 393 | message(STATUS "LIB_VERSION: ${LIB_VERSION}") |
349 | message(STATUS "LIB_SOVERSION: ${LIB_SOVERSION}") | 394 | message(STATUS "LIB_SOVERSION: ${LIB_SOVERSION}") |
@@ -354,6 +399,7 @@ message(STATUS "ASAN: ${ASAN}") | |||
354 | message(STATUS "MSAN: ${MSAN}") | 399 | message(STATUS "MSAN: ${MSAN}") |
355 | message(STATUS "COVERAGE: ${COVERAGE}") | 400 | message(STATUS "COVERAGE: ${COVERAGE}") |
356 | message(STATUS "TLS: ${TLS}") | 401 | message(STATUS "TLS: ${TLS}") |
402 | message(STATUS "USE_HIDAPI: ${USE_HIDAPI}") | ||
357 | 403 | ||
358 | if(CMAKE_SYSTEM_NAME STREQUAL "Linux") | 404 | if(CMAKE_SYSTEM_NAME STREQUAL "Linux") |
359 | message(STATUS "UDEV_INCLUDE_DIRS: ${UDEV_INCLUDE_DIRS}") | 405 | message(STATUS "UDEV_INCLUDE_DIRS: ${UDEV_INCLUDE_DIRS}") |
@@ -1,3 +1,18 @@ | |||
1 | * Version 1.4.0 (2020-04-15) | ||
2 | ** hid_hidapi: hidapi backend; enable with -DUSE_HIDAPI=1. | ||
3 | ** Fall back to U2F if the key claims to, but does not support FIDO2. | ||
4 | ** FIDO2 credential protection (credprot) support. | ||
5 | ** New API calls: | ||
6 | - fido_cbor_info_fwversion; | ||
7 | - fido_cred_prot; | ||
8 | - fido_cred_set_prot; | ||
9 | - fido_dev_set_transport_functions; | ||
10 | - fido_set_log_handler. | ||
11 | ** Support for FreeBSD. | ||
12 | ** Support for C++. | ||
13 | ** Support for MSYS. | ||
14 | ** Fixed EdDSA and RSA self-attestation. | ||
15 | |||
1 | * Version 1.3.1 (2020-02-19) | 16 | * Version 1.3.1 (2020-02-19) |
2 | ** fix zero-ing of le1 and le2 when talking to a U2F device. | 17 | ** fix zero-ing of le1 and le2 when talking to a U2F device. |
3 | ** dropping sk-libfido2 middleware, please find it in the openssh tree. | 18 | ** dropping sk-libfido2 middleware, please find it in the openssh tree. |
diff --git a/README.adoc b/README.adoc index ce8ac1e..f389a83 100644 --- a/README.adoc +++ b/README.adoc | |||
@@ -31,16 +31,21 @@ is also available. | |||
31 | 31 | ||
32 | ==== Releases | 32 | ==== Releases |
33 | 33 | ||
34 | The current release of *libfido2* is 1.3.1. Please consult Yubico's | 34 | The current release of *libfido2* is 1.4.0. Please consult Yubico's |
35 | https://developers.yubico.com/libfido2/Releases[release page] for source | 35 | https://developers.yubico.com/libfido2/Releases[release page] for source |
36 | and binary releases. | 36 | and binary releases. |
37 | 37 | ||
38 | ==== Ubuntu | 38 | ==== Ubuntu |
39 | 39 | ||
40 | $ sudo apt install software-properties-common | ||
40 | $ sudo apt-add-repository ppa:yubico/stable | 41 | $ sudo apt-add-repository ppa:yubico/stable |
41 | $ sudo apt update | 42 | $ sudo apt update |
42 | $ sudo apt install libfido2-dev | 43 | $ sudo apt install libfido2-dev |
43 | 44 | ||
45 | ==== MacOS | ||
46 | |||
47 | $ brew install libfido2 | ||
48 | |||
44 | Or from source, on UNIX-like systems: | 49 | Or from source, on UNIX-like systems: |
45 | 50 | ||
46 | $ (rm -rf build && mkdir build && cd build && cmake ..) | 51 | $ (rm -rf build && mkdir build && cd build && cmake ..) |
@@ -51,8 +56,7 @@ Depending on the platform, the PKG_CONFIG_PATH environment variable may need to | |||
51 | be set. | 56 | be set. |
52 | 57 | ||
53 | *libfido2* depends on https://github.com/pjk/libcbor[libcbor] and | 58 | *libfido2* depends on https://github.com/pjk/libcbor[libcbor] and |
54 | https://github.com/libressl-portable/portable[LibreSSL] (alternatively, | 59 | https://www.openssl.org[OpenSSL]. On Linux, libudev (part of |
55 | https://www.openssl.org[OpenSSL] may be used). On Linux, libudev (part of | ||
56 | https://www.freedesktop.org/wiki/Software/systemd[systemd]) is also required. | 60 | https://www.freedesktop.org/wiki/Software/systemd[systemd]) is also required. |
57 | 61 | ||
58 | For complete, OS-specific installation instructions, please refer to the | 62 | For complete, OS-specific installation instructions, please refer to the |
diff --git a/debian/changelog b/debian/changelog index d3ef6dd..147db09 100644 --- a/debian/changelog +++ b/debian/changelog | |||
@@ -1,3 +1,9 @@ | |||
1 | libfido2 (1.4.0-1) UNRELEASED; urgency=medium | ||
2 | |||
3 | * New upstream release. | ||
4 | |||
5 | -- Colin Watson <cjwatson@debian.org> Fri, 17 Apr 2020 21:01:30 +0100 | ||
6 | |||
1 | libfido2 (1.3.1-1) unstable; urgency=medium | 7 | libfido2 (1.3.1-1) unstable; urgency=medium |
2 | 8 | ||
3 | [ nicoo ] | 9 | [ nicoo ] |
diff --git a/debian/libfido2-1.symbols b/debian/libfido2-1.symbols index e293e63..810a8fb 100644 --- a/debian/libfido2-1.symbols +++ b/debian/libfido2-1.symbols | |||
@@ -75,6 +75,7 @@ libfido2.so.1 libfido2-1 #MINVER# | |||
75 | fido_cbor_info_extensions_len@Base 1.1.0 | 75 | fido_cbor_info_extensions_len@Base 1.1.0 |
76 | fido_cbor_info_extensions_ptr@Base 1.1.0 | 76 | fido_cbor_info_extensions_ptr@Base 1.1.0 |
77 | fido_cbor_info_free@Base 1.1.0 | 77 | fido_cbor_info_free@Base 1.1.0 |
78 | fido_cbor_info_fwversion@Base 1.4.0 | ||
78 | fido_cbor_info_maxmsgsiz@Base 1.1.0 | 79 | fido_cbor_info_maxmsgsiz@Base 1.1.0 |
79 | fido_cbor_info_new@Base 1.1.0 | 80 | fido_cbor_info_new@Base 1.1.0 |
80 | fido_cbor_info_options_len@Base 1.1.0 | 81 | fido_cbor_info_options_len@Base 1.1.0 |
@@ -96,6 +97,7 @@ libfido2.so.1 libfido2-1 #MINVER# | |||
96 | fido_cred_id_len@Base 1.1.0 | 97 | fido_cred_id_len@Base 1.1.0 |
97 | fido_cred_id_ptr@Base 1.1.0 | 98 | fido_cred_id_ptr@Base 1.1.0 |
98 | fido_cred_new@Base 1.1.0 | 99 | fido_cred_new@Base 1.1.0 |
100 | fido_cred_prot@Base 1.4.0 | ||
99 | fido_cred_pubkey_len@Base 1.1.0 | 101 | fido_cred_pubkey_len@Base 1.1.0 |
100 | fido_cred_pubkey_ptr@Base 1.1.0 | 102 | fido_cred_pubkey_ptr@Base 1.1.0 |
101 | fido_cred_rp_id@Base 1.1.0 | 103 | fido_cred_rp_id@Base 1.1.0 |
@@ -106,6 +108,7 @@ libfido2.so.1 libfido2-1 #MINVER# | |||
106 | fido_cred_set_extensions@Base 1.1.0 | 108 | fido_cred_set_extensions@Base 1.1.0 |
107 | fido_cred_set_fmt@Base 1.1.0 | 109 | fido_cred_set_fmt@Base 1.1.0 |
108 | fido_cred_set_options@Base 1.1.0 | 110 | fido_cred_set_options@Base 1.1.0 |
111 | fido_cred_set_prot@Base 1.4.0 | ||
109 | fido_cred_set_rk@Base 1.2.0 | 112 | fido_cred_set_rk@Base 1.2.0 |
110 | fido_cred_set_rp@Base 1.1.0 | 113 | fido_cred_set_rp@Base 1.1.0 |
111 | fido_cred_set_sig@Base 1.1.0 | 114 | fido_cred_set_sig@Base 1.1.0 |
@@ -171,7 +174,9 @@ libfido2.so.1 libfido2-1 #MINVER# | |||
171 | fido_dev_reset@Base 1.1.0 | 174 | fido_dev_reset@Base 1.1.0 |
172 | fido_dev_set_io_functions@Base 1.1.0 | 175 | fido_dev_set_io_functions@Base 1.1.0 |
173 | fido_dev_set_pin@Base 1.1.0 | 176 | fido_dev_set_pin@Base 1.1.0 |
177 | fido_dev_set_transport_functions@Base 1.4.0 | ||
174 | fido_init@Base 1.1.0 | 178 | fido_init@Base 1.1.0 |
179 | fido_set_log_handler@Base 1.4.0 | ||
175 | fido_strerr@Base 1.1.0 | 180 | fido_strerr@Base 1.1.0 |
176 | rs256_pk_free@Base 1.1.0 | 181 | rs256_pk_free@Base 1.1.0 |
177 | rs256_pk_from_RSA@Base 1.1.0 | 182 | rs256_pk_from_RSA@Base 1.1.0 |
diff --git a/debian/libfido2-doc.doc-base b/debian/libfido2-doc.doc-base index 9081b92..f3536a4 100644 --- a/debian/libfido2-doc.doc-base +++ b/debian/libfido2-doc.doc-base | |||
@@ -5,5 +5,5 @@ Abstract: The development documentation for libfido2. | |||
5 | Section: Programming/C | 5 | Section: Programming/C |
6 | 6 | ||
7 | Format: HTML | 7 | Format: HTML |
8 | Index: /usr/share/doc/libfido2/ | 8 | Index: /usr/share/doc/libfido2/html/ |
9 | Files: /usr/share/doc/libfido2/*.html | 9 | Files: /usr/share/doc/libfido2/html/*.html |
diff --git a/debian/libfido2-doc.install b/debian/libfido2-doc.install index b14e220..57149d7 100644 --- a/debian/libfido2-doc.install +++ b/debian/libfido2-doc.install | |||
@@ -1,3 +1,3 @@ | |||
1 | usr/share/man/man3/* | 1 | usr/share/man/man3/* |
2 | usr/share/doc/libfido2/*.html | 2 | usr/share/doc/libfido2/html/*.html |
3 | usr/share/doc/libfido2/style.css | 3 | usr/share/doc/libfido2/html/style.css |
diff --git a/debian/libfido2-doc.links b/debian/libfido2-doc.links index b23b8a0..d6a52ca 100644 --- a/debian/libfido2-doc.links +++ b/debian/libfido2-doc.links | |||
@@ -56,6 +56,7 @@ | |||
56 | /usr/share/man/man3/fido_cbor_info_new.3 /usr/share/man/man3/fido_cbor_info_extensions_len.3 | 56 | /usr/share/man/man3/fido_cbor_info_new.3 /usr/share/man/man3/fido_cbor_info_extensions_len.3 |
57 | /usr/share/man/man3/fido_cbor_info_new.3 /usr/share/man/man3/fido_cbor_info_extensions_ptr.3 | 57 | /usr/share/man/man3/fido_cbor_info_new.3 /usr/share/man/man3/fido_cbor_info_extensions_ptr.3 |
58 | /usr/share/man/man3/fido_cbor_info_new.3 /usr/share/man/man3/fido_cbor_info_free.3 | 58 | /usr/share/man/man3/fido_cbor_info_new.3 /usr/share/man/man3/fido_cbor_info_free.3 |
59 | /usr/share/man/man3/fido_cbor_info_new.3 /usr/share/man/man3/fido_cbor_info_fwversion.3 | ||
59 | /usr/share/man/man3/fido_cbor_info_new.3 /usr/share/man/man3/fido_cbor_info_maxmsgsiz.3 | 60 | /usr/share/man/man3/fido_cbor_info_new.3 /usr/share/man/man3/fido_cbor_info_maxmsgsiz.3 |
60 | /usr/share/man/man3/fido_cbor_info_new.3 /usr/share/man/man3/fido_cbor_info_options_len.3 | 61 | /usr/share/man/man3/fido_cbor_info_new.3 /usr/share/man/man3/fido_cbor_info_options_len.3 |
61 | /usr/share/man/man3/fido_cbor_info_new.3 /usr/share/man/man3/fido_cbor_info_options_name_ptr.3 | 62 | /usr/share/man/man3/fido_cbor_info_new.3 /usr/share/man/man3/fido_cbor_info_options_name_ptr.3 |
@@ -136,141 +137,141 @@ | |||
136 | /usr/share/man/man3/rs256_pk_new.3 /usr/share/man/man3/rs256_pk_from_ptr.3 | 137 | /usr/share/man/man3/rs256_pk_new.3 /usr/share/man/man3/rs256_pk_from_ptr.3 |
137 | /usr/share/man/man3/rs256_pk_new.3 /usr/share/man/man3/rs256_pk_from_RSA.3 | 138 | /usr/share/man/man3/rs256_pk_new.3 /usr/share/man/man3/rs256_pk_from_RSA.3 |
138 | /usr/share/man/man3/rs256_pk_new.3 /usr/share/man/man3/rs256_pk_to_EVP_PKEY.3 | 139 | /usr/share/man/man3/rs256_pk_new.3 /usr/share/man/man3/rs256_pk_to_EVP_PKEY.3 |
139 | /usr/share/doc/libfido2/eddsa_pk_new.html /usr/share/doc/libfido2/eddsa_pk_free.html | 140 | /usr/share/doc/libfido2/html/eddsa_pk_new.html /usr/share/doc/libfido2/html/eddsa_pk_free.html |
140 | /usr/share/doc/libfido2/eddsa_pk_new.html /usr/share/doc/libfido2/eddsa_pk_from_ptr.html | 141 | /usr/share/doc/libfido2/html/eddsa_pk_new.html /usr/share/doc/libfido2/html/eddsa_pk_from_ptr.html |
141 | /usr/share/doc/libfido2/eddsa_pk_new.html /usr/share/doc/libfido2/eddsa_pk_to_EVP_PKEY.html | 142 | /usr/share/doc/libfido2/html/eddsa_pk_new.html /usr/share/doc/libfido2/html/eddsa_pk_to_EVP_PKEY.html |
142 | /usr/share/doc/libfido2/es256_pk_new.html /usr/share/doc/libfido2/es256_pk_free.html | 143 | /usr/share/doc/libfido2/html/es256_pk_new.html /usr/share/doc/libfido2/html/es256_pk_free.html |
143 | /usr/share/doc/libfido2/es256_pk_new.html /usr/share/doc/libfido2/es256_pk_from_EC_KEY.html | 144 | /usr/share/doc/libfido2/html/es256_pk_new.html /usr/share/doc/libfido2/html/es256_pk_from_EC_KEY.html |
144 | /usr/share/doc/libfido2/es256_pk_new.html /usr/share/doc/libfido2/es256_pk_from_ptr.html | 145 | /usr/share/doc/libfido2/html/es256_pk_new.html /usr/share/doc/libfido2/html/es256_pk_from_ptr.html |
145 | /usr/share/doc/libfido2/es256_pk_new.html /usr/share/doc/libfido2/es256_pk_to_EVP_PKEY.html | 146 | /usr/share/doc/libfido2/html/es256_pk_new.html /usr/share/doc/libfido2/html/es256_pk_to_EVP_PKEY.html |
146 | /usr/share/doc/libfido2/fido_assert_new.html /usr/share/doc/libfido2/fido_assert_authdata_len.html | 147 | /usr/share/doc/libfido2/html/fido_assert_new.html /usr/share/doc/libfido2/html/fido_assert_authdata_len.html |
147 | /usr/share/doc/libfido2/fido_assert_new.html /usr/share/doc/libfido2/fido_assert_authdata_ptr.html | 148 | /usr/share/doc/libfido2/html/fido_assert_new.html /usr/share/doc/libfido2/html/fido_assert_authdata_ptr.html |
148 | /usr/share/doc/libfido2/fido_assert_new.html /usr/share/doc/libfido2/fido_assert_clientdata_hash_len.html | 149 | /usr/share/doc/libfido2/html/fido_assert_new.html /usr/share/doc/libfido2/html/fido_assert_clientdata_hash_len.html |
149 | /usr/share/doc/libfido2/fido_assert_new.html /usr/share/doc/libfido2/fido_assert_clientdata_hash_ptr.html | 150 | /usr/share/doc/libfido2/html/fido_assert_new.html /usr/share/doc/libfido2/html/fido_assert_clientdata_hash_ptr.html |
150 | /usr/share/doc/libfido2/fido_assert_new.html /usr/share/doc/libfido2/fido_assert_count.html | 151 | /usr/share/doc/libfido2/html/fido_assert_new.html /usr/share/doc/libfido2/html/fido_assert_count.html |
151 | /usr/share/doc/libfido2/fido_assert_new.html /usr/share/doc/libfido2/fido_assert_free.html | 152 | /usr/share/doc/libfido2/html/fido_assert_new.html /usr/share/doc/libfido2/html/fido_assert_free.html |
152 | /usr/share/doc/libfido2/fido_assert_new.html /usr/share/doc/libfido2/fido_assert_hmac_secret_len.html | 153 | /usr/share/doc/libfido2/html/fido_assert_new.html /usr/share/doc/libfido2/html/fido_assert_hmac_secret_len.html |
153 | /usr/share/doc/libfido2/fido_assert_new.html /usr/share/doc/libfido2/fido_assert_hmac_secret_ptr.html | 154 | /usr/share/doc/libfido2/html/fido_assert_new.html /usr/share/doc/libfido2/html/fido_assert_hmac_secret_ptr.html |
154 | /usr/share/doc/libfido2/fido_assert_new.html /usr/share/doc/libfido2/fido_assert_sigcount.html | 155 | /usr/share/doc/libfido2/html/fido_assert_new.html /usr/share/doc/libfido2/html/fido_assert_sigcount.html |
155 | /usr/share/doc/libfido2/fido_assert_new.html /usr/share/doc/libfido2/fido_assert_sig_len.html | 156 | /usr/share/doc/libfido2/html/fido_assert_new.html /usr/share/doc/libfido2/html/fido_assert_sig_len.html |
156 | /usr/share/doc/libfido2/fido_assert_new.html /usr/share/doc/libfido2/fido_assert_sig_ptr.html | 157 | /usr/share/doc/libfido2/html/fido_assert_new.html /usr/share/doc/libfido2/html/fido_assert_sig_ptr.html |
157 | /usr/share/doc/libfido2/fido_assert_new.html /usr/share/doc/libfido2/fido_assert_user_display_name.html | 158 | /usr/share/doc/libfido2/html/fido_assert_new.html /usr/share/doc/libfido2/html/fido_assert_user_display_name.html |
158 | /usr/share/doc/libfido2/fido_assert_new.html /usr/share/doc/libfido2/fido_assert_user_icon.html | 159 | /usr/share/doc/libfido2/html/fido_assert_new.html /usr/share/doc/libfido2/html/fido_assert_user_icon.html |
159 | /usr/share/doc/libfido2/fido_assert_new.html /usr/share/doc/libfido2/fido_assert_user_id_len.html | 160 | /usr/share/doc/libfido2/html/fido_assert_new.html /usr/share/doc/libfido2/html/fido_assert_user_id_len.html |
160 | /usr/share/doc/libfido2/fido_assert_new.html /usr/share/doc/libfido2/fido_assert_user_id_ptr.html | 161 | /usr/share/doc/libfido2/html/fido_assert_new.html /usr/share/doc/libfido2/html/fido_assert_user_id_ptr.html |
161 | /usr/share/doc/libfido2/fido_assert_new.html /usr/share/doc/libfido2/fido_assert_user_name.html | 162 | /usr/share/doc/libfido2/html/fido_assert_new.html /usr/share/doc/libfido2/html/fido_assert_user_name.html |
162 | /usr/share/doc/libfido2/fido_assert_set_authdata.html /usr/share/doc/libfido2/fido_assert_set_clientdata_hash.html | 163 | /usr/share/doc/libfido2/html/fido_assert_set_authdata.html /usr/share/doc/libfido2/html/fido_assert_set_clientdata_hash.html |
163 | /usr/share/doc/libfido2/fido_assert_set_authdata.html /usr/share/doc/libfido2/fido_assert_set_count.html | 164 | /usr/share/doc/libfido2/html/fido_assert_set_authdata.html /usr/share/doc/libfido2/html/fido_assert_set_count.html |
164 | /usr/share/doc/libfido2/fido_assert_set_authdata.html /usr/share/doc/libfido2/fido_assert_set_extensions.html | 165 | /usr/share/doc/libfido2/html/fido_assert_set_authdata.html /usr/share/doc/libfido2/html/fido_assert_set_extensions.html |
165 | /usr/share/doc/libfido2/fido_assert_set_authdata.html /usr/share/doc/libfido2/fido_assert_set_hmac_salt.html | 166 | /usr/share/doc/libfido2/html/fido_assert_set_authdata.html /usr/share/doc/libfido2/html/fido_assert_set_hmac_salt.html |
166 | /usr/share/doc/libfido2/fido_assert_set_authdata.html /usr/share/doc/libfido2/fido_assert_set_rp.html | 167 | /usr/share/doc/libfido2/html/fido_assert_set_authdata.html /usr/share/doc/libfido2/html/fido_assert_set_rp.html |
167 | /usr/share/doc/libfido2/fido_assert_set_authdata.html /usr/share/doc/libfido2/fido_assert_set_sig.html | 168 | /usr/share/doc/libfido2/html/fido_assert_set_authdata.html /usr/share/doc/libfido2/html/fido_assert_set_sig.html |
168 | /usr/share/doc/libfido2/fido_assert_set_authdata.html /usr/share/doc/libfido2/fido_assert_set_up.html | 169 | /usr/share/doc/libfido2/html/fido_assert_set_authdata.html /usr/share/doc/libfido2/html/fido_assert_set_up.html |
169 | /usr/share/doc/libfido2/fido_assert_set_authdata.html /usr/share/doc/libfido2/fido_assert_set_uv.html | 170 | /usr/share/doc/libfido2/html/fido_assert_set_authdata.html /usr/share/doc/libfido2/html/fido_assert_set_uv.html |
170 | /usr/share/doc/libfido2/fido_bio_dev_get_info.html /usr/share/doc/libfido2/fido_bio_dev_enroll_begin.html | 171 | /usr/share/doc/libfido2/html/fido_bio_dev_get_info.html /usr/share/doc/libfido2/html/fido_bio_dev_enroll_begin.html |
171 | /usr/share/doc/libfido2/fido_bio_dev_get_info.html /usr/share/doc/libfido2/fido_bio_dev_enroll_cancel.html | 172 | /usr/share/doc/libfido2/html/fido_bio_dev_get_info.html /usr/share/doc/libfido2/html/fido_bio_dev_enroll_cancel.html |
172 | /usr/share/doc/libfido2/fido_bio_dev_get_info.html /usr/share/doc/libfido2/fido_bio_dev_enroll_continue.html | 173 | /usr/share/doc/libfido2/html/fido_bio_dev_get_info.html /usr/share/doc/libfido2/html/fido_bio_dev_enroll_continue.html |
173 | /usr/share/doc/libfido2/fido_bio_dev_get_info.html /usr/share/doc/libfido2/fido_bio_dev_enroll_remove.html | 174 | /usr/share/doc/libfido2/html/fido_bio_dev_get_info.html /usr/share/doc/libfido2/html/fido_bio_dev_enroll_remove.html |
174 | /usr/share/doc/libfido2/fido_bio_dev_get_info.html /usr/share/doc/libfido2/fido_bio_dev_get_template_array.html | 175 | /usr/share/doc/libfido2/html/fido_bio_dev_get_info.html /usr/share/doc/libfido2/html/fido_bio_dev_get_template_array.html |
175 | /usr/share/doc/libfido2/fido_bio_dev_get_info.html /usr/share/doc/libfido2/fido_bio_dev_set_template_name.html | 176 | /usr/share/doc/libfido2/html/fido_bio_dev_get_info.html /usr/share/doc/libfido2/html/fido_bio_dev_set_template_name.html |
176 | /usr/share/doc/libfido2/fido_bio_enroll_new.html /usr/share/doc/libfido2/fido_bio_enroll_free.html | 177 | /usr/share/doc/libfido2/html/fido_bio_enroll_new.html /usr/share/doc/libfido2/html/fido_bio_enroll_free.html |
177 | /usr/share/doc/libfido2/fido_bio_enroll_new.html /usr/share/doc/libfido2/fido_bio_enroll_last_status.html | 178 | /usr/share/doc/libfido2/html/fido_bio_enroll_new.html /usr/share/doc/libfido2/html/fido_bio_enroll_last_status.html |
178 | /usr/share/doc/libfido2/fido_bio_enroll_new.html /usr/share/doc/libfido2/fido_bio_enroll_remaining_samples.html | 179 | /usr/share/doc/libfido2/html/fido_bio_enroll_new.html /usr/share/doc/libfido2/html/fido_bio_enroll_remaining_samples.html |
179 | /usr/share/doc/libfido2/fido_bio_info_new.html /usr/share/doc/libfido2/fido_bio_info_free.html | 180 | /usr/share/doc/libfido2/html/fido_bio_info_new.html /usr/share/doc/libfido2/html/fido_bio_info_free.html |
180 | /usr/share/doc/libfido2/fido_bio_info_new.html /usr/share/doc/libfido2/fido_bio_info_max_samples.html | 181 | /usr/share/doc/libfido2/html/fido_bio_info_new.html /usr/share/doc/libfido2/html/fido_bio_info_max_samples.html |
181 | /usr/share/doc/libfido2/fido_bio_info_new.html /usr/share/doc/libfido2/fido_bio_info_type.html | 182 | /usr/share/doc/libfido2/html/fido_bio_info_new.html /usr/share/doc/libfido2/html/fido_bio_info_type.html |
182 | /usr/share/doc/libfido2/fido_bio_template.html /usr/share/doc/libfido2/fido_bio_template_array_count.html | 183 | /usr/share/doc/libfido2/html/fido_bio_template.html /usr/share/doc/libfido2/html/fido_bio_template_array_count.html |
183 | /usr/share/doc/libfido2/fido_bio_template.html /usr/share/doc/libfido2/fido_bio_template_array_free.html | 184 | /usr/share/doc/libfido2/html/fido_bio_template.html /usr/share/doc/libfido2/html/fido_bio_template_array_free.html |
184 | /usr/share/doc/libfido2/fido_bio_template.html /usr/share/doc/libfido2/fido_bio_template_array_new.html | 185 | /usr/share/doc/libfido2/html/fido_bio_template.html /usr/share/doc/libfido2/html/fido_bio_template_array_new.html |
185 | /usr/share/doc/libfido2/fido_bio_template.html /usr/share/doc/libfido2/fido_bio_template_free.html | 186 | /usr/share/doc/libfido2/html/fido_bio_template.html /usr/share/doc/libfido2/html/fido_bio_template_free.html |
186 | /usr/share/doc/libfido2/fido_bio_template.html /usr/share/doc/libfido2/fido_bio_template_id_len.html | 187 | /usr/share/doc/libfido2/html/fido_bio_template.html /usr/share/doc/libfido2/html/fido_bio_template_id_len.html |
187 | /usr/share/doc/libfido2/fido_bio_template.html /usr/share/doc/libfido2/fido_bio_template_id_ptr.html | 188 | /usr/share/doc/libfido2/html/fido_bio_template.html /usr/share/doc/libfido2/html/fido_bio_template_id_ptr.html |
188 | /usr/share/doc/libfido2/fido_bio_template.html /usr/share/doc/libfido2/fido_bio_template_name.html | 189 | /usr/share/doc/libfido2/html/fido_bio_template.html /usr/share/doc/libfido2/html/fido_bio_template_name.html |
189 | /usr/share/doc/libfido2/fido_bio_template.html /usr/share/doc/libfido2/fido_bio_template_new.html | 190 | /usr/share/doc/libfido2/html/fido_bio_template.html /usr/share/doc/libfido2/html/fido_bio_template_new.html |
190 | /usr/share/doc/libfido2/fido_bio_template.html /usr/share/doc/libfido2/fido_bio_template_set_id.html | 191 | /usr/share/doc/libfido2/html/fido_bio_template.html /usr/share/doc/libfido2/html/fido_bio_template_set_id.html |
191 | /usr/share/doc/libfido2/fido_bio_template.html /usr/share/doc/libfido2/fido_bio_template_set_name.html | 192 | /usr/share/doc/libfido2/html/fido_bio_template.html /usr/share/doc/libfido2/html/fido_bio_template_set_name.html |
192 | /usr/share/doc/libfido2/fido_cbor_info_new.html /usr/share/doc/libfido2/fido_cbor_info_aaguid_len.html | 193 | /usr/share/doc/libfido2/html/fido_cbor_info_new.html /usr/share/doc/libfido2/html/fido_cbor_info_aaguid_len.html |
193 | /usr/share/doc/libfido2/fido_cbor_info_new.html /usr/share/doc/libfido2/fido_cbor_info_aaguid_ptr.html | 194 | /usr/share/doc/libfido2/html/fido_cbor_info_new.html /usr/share/doc/libfido2/html/fido_cbor_info_aaguid_ptr.html |
194 | /usr/share/doc/libfido2/fido_cbor_info_new.html /usr/share/doc/libfido2/fido_cbor_info_extensions_len.html | 195 | /usr/share/doc/libfido2/html/fido_cbor_info_new.html /usr/share/doc/libfido2/html/fido_cbor_info_extensions_len.html |
195 | /usr/share/doc/libfido2/fido_cbor_info_new.html /usr/share/doc/libfido2/fido_cbor_info_extensions_ptr.html | 196 | /usr/share/doc/libfido2/html/fido_cbor_info_new.html /usr/share/doc/libfido2/html/fido_cbor_info_extensions_ptr.html |
196 | /usr/share/doc/libfido2/fido_cbor_info_new.html /usr/share/doc/libfido2/fido_cbor_info_free.html | 197 | /usr/share/doc/libfido2/html/fido_cbor_info_new.html /usr/share/doc/libfido2/html/fido_cbor_info_free.html |
197 | /usr/share/doc/libfido2/fido_cbor_info_new.html /usr/share/doc/libfido2/fido_cbor_info_maxmsgsiz.html | 198 | /usr/share/doc/libfido2/html/fido_cbor_info_new.html /usr/share/doc/libfido2/html/fido_cbor_info_maxmsgsiz.html |
198 | /usr/share/doc/libfido2/fido_cbor_info_new.html /usr/share/doc/libfido2/fido_cbor_info_options_len.html | 199 | /usr/share/doc/libfido2/html/fido_cbor_info_new.html /usr/share/doc/libfido2/html/fido_cbor_info_options_len.html |
199 | /usr/share/doc/libfido2/fido_cbor_info_new.html /usr/share/doc/libfido2/fido_cbor_info_options_name_ptr.html | 200 | /usr/share/doc/libfido2/html/fido_cbor_info_new.html /usr/share/doc/libfido2/html/fido_cbor_info_options_name_ptr.html |
200 | /usr/share/doc/libfido2/fido_cbor_info_new.html /usr/share/doc/libfido2/fido_cbor_info_options_value_ptr.html | 201 | /usr/share/doc/libfido2/html/fido_cbor_info_new.html /usr/share/doc/libfido2/html/fido_cbor_info_options_value_ptr.html |
201 | /usr/share/doc/libfido2/fido_cbor_info_new.html /usr/share/doc/libfido2/fido_cbor_info_protocols_len.html | 202 | /usr/share/doc/libfido2/html/fido_cbor_info_new.html /usr/share/doc/libfido2/html/fido_cbor_info_protocols_len.html |
202 | /usr/share/doc/libfido2/fido_cbor_info_new.html /usr/share/doc/libfido2/fido_cbor_info_protocols_ptr.html | 203 | /usr/share/doc/libfido2/html/fido_cbor_info_new.html /usr/share/doc/libfido2/html/fido_cbor_info_protocols_ptr.html |
203 | /usr/share/doc/libfido2/fido_cbor_info_new.html /usr/share/doc/libfido2/fido_cbor_info_versions_len.html | 204 | /usr/share/doc/libfido2/html/fido_cbor_info_new.html /usr/share/doc/libfido2/html/fido_cbor_info_versions_len.html |
204 | /usr/share/doc/libfido2/fido_cbor_info_new.html /usr/share/doc/libfido2/fido_cbor_info_versions_ptr.html | 205 | /usr/share/doc/libfido2/html/fido_cbor_info_new.html /usr/share/doc/libfido2/html/fido_cbor_info_versions_ptr.html |
205 | /usr/share/doc/libfido2/fido_cbor_info_new.html /usr/share/doc/libfido2/fido_dev_get_cbor_info.html | 206 | /usr/share/doc/libfido2/html/fido_cbor_info_new.html /usr/share/doc/libfido2/html/fido_dev_get_cbor_info.html |
206 | /usr/share/doc/libfido2/fido_cred_new.html /usr/share/doc/libfido2/fido_cred_authdata_len.html | 207 | /usr/share/doc/libfido2/html/fido_cred_new.html /usr/share/doc/libfido2/html/fido_cred_authdata_len.html |
207 | /usr/share/doc/libfido2/fido_cred_new.html /usr/share/doc/libfido2/fido_cred_authdata_ptr.html | 208 | /usr/share/doc/libfido2/html/fido_cred_new.html /usr/share/doc/libfido2/html/fido_cred_authdata_ptr.html |
208 | /usr/share/doc/libfido2/fido_cred_new.html /usr/share/doc/libfido2/fido_cred_clientdata_hash_len.html | 209 | /usr/share/doc/libfido2/html/fido_cred_new.html /usr/share/doc/libfido2/html/fido_cred_clientdata_hash_len.html |
209 | /usr/share/doc/libfido2/fido_cred_new.html /usr/share/doc/libfido2/fido_cred_clientdata_hash_ptr.html | 210 | /usr/share/doc/libfido2/html/fido_cred_new.html /usr/share/doc/libfido2/html/fido_cred_clientdata_hash_ptr.html |
210 | /usr/share/doc/libfido2/fido_cred_new.html /usr/share/doc/libfido2/fido_cred_fmt.html | 211 | /usr/share/doc/libfido2/html/fido_cred_new.html /usr/share/doc/libfido2/html/fido_cred_fmt.html |
211 | /usr/share/doc/libfido2/fido_cred_new.html /usr/share/doc/libfido2/fido_cred_free.html | 212 | /usr/share/doc/libfido2/html/fido_cred_new.html /usr/share/doc/libfido2/html/fido_cred_free.html |
212 | /usr/share/doc/libfido2/fido_cred_new.html /usr/share/doc/libfido2/fido_cred_id_len.html | 213 | /usr/share/doc/libfido2/html/fido_cred_new.html /usr/share/doc/libfido2/html/fido_cred_id_len.html |
213 | /usr/share/doc/libfido2/fido_cred_new.html /usr/share/doc/libfido2/fido_cred_id_ptr.html | 214 | /usr/share/doc/libfido2/html/fido_cred_new.html /usr/share/doc/libfido2/html/fido_cred_id_ptr.html |
214 | /usr/share/doc/libfido2/fido_cred_new.html /usr/share/doc/libfido2/fido_cred_prot.html | 215 | /usr/share/doc/libfido2/html/fido_cred_new.html /usr/share/doc/libfido2/html/fido_cred_prot.html |
215 | /usr/share/doc/libfido2/fido_cred_new.html /usr/share/doc/libfido2/fido_cred_pubkey_len.html | 216 | /usr/share/doc/libfido2/html/fido_cred_new.html /usr/share/doc/libfido2/html/fido_cred_pubkey_len.html |
216 | /usr/share/doc/libfido2/fido_cred_new.html /usr/share/doc/libfido2/fido_cred_pubkey_ptr.html | 217 | /usr/share/doc/libfido2/html/fido_cred_new.html /usr/share/doc/libfido2/html/fido_cred_pubkey_ptr.html |
217 | /usr/share/doc/libfido2/fido_cred_new.html /usr/share/doc/libfido2/fido_cred_sig_len.html | 218 | /usr/share/doc/libfido2/html/fido_cred_new.html /usr/share/doc/libfido2/html/fido_cred_sig_len.html |
218 | /usr/share/doc/libfido2/fido_cred_new.html /usr/share/doc/libfido2/fido_cred_sig_ptr.html | 219 | /usr/share/doc/libfido2/html/fido_cred_new.html /usr/share/doc/libfido2/html/fido_cred_sig_ptr.html |
219 | /usr/share/doc/libfido2/fido_cred_new.html /usr/share/doc/libfido2/fido_cred_x5c_len.html | 220 | /usr/share/doc/libfido2/html/fido_cred_new.html /usr/share/doc/libfido2/html/fido_cred_x5c_len.html |
220 | /usr/share/doc/libfido2/fido_cred_new.html /usr/share/doc/libfido2/fido_cred_x5c_ptr.html | 221 | /usr/share/doc/libfido2/html/fido_cred_new.html /usr/share/doc/libfido2/html/fido_cred_x5c_ptr.html |
221 | /usr/share/doc/libfido2/fido_credman_metadata_new.html /usr/share/doc/libfido2/fido_credman_del_dev_rk.html | 222 | /usr/share/doc/libfido2/html/fido_credman_metadata_new.html /usr/share/doc/libfido2/html/fido_credman_del_dev_rk.html |
222 | /usr/share/doc/libfido2/fido_credman_metadata_new.html /usr/share/doc/libfido2/fido_credman_get_dev_metadata.html | 223 | /usr/share/doc/libfido2/html/fido_credman_metadata_new.html /usr/share/doc/libfido2/html/fido_credman_get_dev_metadata.html |
223 | /usr/share/doc/libfido2/fido_credman_metadata_new.html /usr/share/doc/libfido2/fido_credman_get_dev_rk.html | 224 | /usr/share/doc/libfido2/html/fido_credman_metadata_new.html /usr/share/doc/libfido2/html/fido_credman_get_dev_rk.html |
224 | /usr/share/doc/libfido2/fido_credman_metadata_new.html /usr/share/doc/libfido2/fido_credman_get_dev_rp.html | 225 | /usr/share/doc/libfido2/html/fido_credman_metadata_new.html /usr/share/doc/libfido2/html/fido_credman_get_dev_rp.html |
225 | /usr/share/doc/libfido2/fido_credman_metadata_new.html /usr/share/doc/libfido2/fido_credman_metadata_free.html | 226 | /usr/share/doc/libfido2/html/fido_credman_metadata_new.html /usr/share/doc/libfido2/html/fido_credman_metadata_free.html |
226 | /usr/share/doc/libfido2/fido_credman_metadata_new.html /usr/share/doc/libfido2/fido_credman_rk.html | 227 | /usr/share/doc/libfido2/html/fido_credman_metadata_new.html /usr/share/doc/libfido2/html/fido_credman_rk.html |
227 | /usr/share/doc/libfido2/fido_credman_metadata_new.html /usr/share/doc/libfido2/fido_credman_rk_count.html | 228 | /usr/share/doc/libfido2/html/fido_credman_metadata_new.html /usr/share/doc/libfido2/html/fido_credman_rk_count.html |
228 | /usr/share/doc/libfido2/fido_credman_metadata_new.html /usr/share/doc/libfido2/fido_credman_rk_existing.html | 229 | /usr/share/doc/libfido2/html/fido_credman_metadata_new.html /usr/share/doc/libfido2/html/fido_credman_rk_existing.html |
229 | /usr/share/doc/libfido2/fido_credman_metadata_new.html /usr/share/doc/libfido2/fido_credman_rk_free.html | 230 | /usr/share/doc/libfido2/html/fido_credman_metadata_new.html /usr/share/doc/libfido2/html/fido_credman_rk_free.html |
230 | /usr/share/doc/libfido2/fido_credman_metadata_new.html /usr/share/doc/libfido2/fido_credman_rk_new.html | 231 | /usr/share/doc/libfido2/html/fido_credman_metadata_new.html /usr/share/doc/libfido2/html/fido_credman_rk_new.html |
231 | /usr/share/doc/libfido2/fido_credman_metadata_new.html /usr/share/doc/libfido2/fido_credman_rk_remaining.html | 232 | /usr/share/doc/libfido2/html/fido_credman_metadata_new.html /usr/share/doc/libfido2/html/fido_credman_rk_remaining.html |
232 | /usr/share/doc/libfido2/fido_credman_metadata_new.html /usr/share/doc/libfido2/fido_credman_rp_count.html | 233 | /usr/share/doc/libfido2/html/fido_credman_metadata_new.html /usr/share/doc/libfido2/html/fido_credman_rp_count.html |
233 | /usr/share/doc/libfido2/fido_credman_metadata_new.html /usr/share/doc/libfido2/fido_credman_rp_free.html | 234 | /usr/share/doc/libfido2/html/fido_credman_metadata_new.html /usr/share/doc/libfido2/html/fido_credman_rp_free.html |
234 | /usr/share/doc/libfido2/fido_credman_metadata_new.html /usr/share/doc/libfido2/fido_credman_rp_id.html | 235 | /usr/share/doc/libfido2/html/fido_credman_metadata_new.html /usr/share/doc/libfido2/html/fido_credman_rp_id.html |
235 | /usr/share/doc/libfido2/fido_credman_metadata_new.html /usr/share/doc/libfido2/fido_credman_rp_id_hash_len.html | 236 | /usr/share/doc/libfido2/html/fido_credman_metadata_new.html /usr/share/doc/libfido2/html/fido_credman_rp_id_hash_len.html |
236 | /usr/share/doc/libfido2/fido_credman_metadata_new.html /usr/share/doc/libfido2/fido_credman_rp_id_hash_ptr.html | 237 | /usr/share/doc/libfido2/html/fido_credman_metadata_new.html /usr/share/doc/libfido2/html/fido_credman_rp_id_hash_ptr.html |
237 | /usr/share/doc/libfido2/fido_credman_metadata_new.html /usr/share/doc/libfido2/fido_credman_rp_name.html | 238 | /usr/share/doc/libfido2/html/fido_credman_metadata_new.html /usr/share/doc/libfido2/html/fido_credman_rp_name.html |
238 | /usr/share/doc/libfido2/fido_credman_metadata_new.html /usr/share/doc/libfido2/fido_credman_rp_new.html | 239 | /usr/share/doc/libfido2/html/fido_credman_metadata_new.html /usr/share/doc/libfido2/html/fido_credman_rp_new.html |
239 | /usr/share/doc/libfido2/fido_cred_set_authdata.html /usr/share/doc/libfido2/fido_cred_set_authdata_raw.html | 240 | /usr/share/doc/libfido2/html/fido_cred_set_authdata.html /usr/share/doc/libfido2/html/fido_cred_set_authdata_raw.html |
240 | /usr/share/doc/libfido2/fido_cred_set_authdata.html /usr/share/doc/libfido2/fido_cred_set_clientdata_hash.html | 241 | /usr/share/doc/libfido2/html/fido_cred_set_authdata.html /usr/share/doc/libfido2/html/fido_cred_set_clientdata_hash.html |
241 | /usr/share/doc/libfido2/fido_cred_set_authdata.html /usr/share/doc/libfido2/fido_cred_set_extensions.html | 242 | /usr/share/doc/libfido2/html/fido_cred_set_authdata.html /usr/share/doc/libfido2/html/fido_cred_set_extensions.html |
242 | /usr/share/doc/libfido2/fido_cred_set_authdata.html /usr/share/doc/libfido2/fido_cred_set_fmt.html | 243 | /usr/share/doc/libfido2/html/fido_cred_set_authdata.html /usr/share/doc/libfido2/html/fido_cred_set_fmt.html |
243 | /usr/share/doc/libfido2/fido_cred_set_authdata.html /usr/share/doc/libfido2/fido_cred_set_prot.html | 244 | /usr/share/doc/libfido2/html/fido_cred_set_authdata.html /usr/share/doc/libfido2/html/fido_cred_set_prot.html |
244 | /usr/share/doc/libfido2/fido_cred_set_authdata.html /usr/share/doc/libfido2/fido_cred_set_rk.html | 245 | /usr/share/doc/libfido2/html/fido_cred_set_authdata.html /usr/share/doc/libfido2/html/fido_cred_set_rk.html |
245 | /usr/share/doc/libfido2/fido_cred_set_authdata.html /usr/share/doc/libfido2/fido_cred_set_rp.html | 246 | /usr/share/doc/libfido2/html/fido_cred_set_authdata.html /usr/share/doc/libfido2/html/fido_cred_set_rp.html |
246 | /usr/share/doc/libfido2/fido_cred_set_authdata.html /usr/share/doc/libfido2/fido_cred_set_sig.html | 247 | /usr/share/doc/libfido2/html/fido_cred_set_authdata.html /usr/share/doc/libfido2/html/fido_cred_set_sig.html |
247 | /usr/share/doc/libfido2/fido_cred_set_authdata.html /usr/share/doc/libfido2/fido_cred_set_type.html | 248 | /usr/share/doc/libfido2/html/fido_cred_set_authdata.html /usr/share/doc/libfido2/html/fido_cred_set_type.html |
248 | /usr/share/doc/libfido2/fido_cred_set_authdata.html /usr/share/doc/libfido2/fido_cred_set_user.html | 249 | /usr/share/doc/libfido2/html/fido_cred_set_authdata.html /usr/share/doc/libfido2/html/fido_cred_set_user.html |
249 | /usr/share/doc/libfido2/fido_cred_set_authdata.html /usr/share/doc/libfido2/fido_cred_set_uv.html | 250 | /usr/share/doc/libfido2/html/fido_cred_set_authdata.html /usr/share/doc/libfido2/html/fido_cred_set_uv.html |
250 | /usr/share/doc/libfido2/fido_cred_set_authdata.html /usr/share/doc/libfido2/fido_cred_set_x509.html | 251 | /usr/share/doc/libfido2/html/fido_cred_set_authdata.html /usr/share/doc/libfido2/html/fido_cred_set_x509.html |
251 | /usr/share/doc/libfido2/fido_dev_info_manifest.html /usr/share/doc/libfido2/fido_dev_info_free.html | 252 | /usr/share/doc/libfido2/html/fido_dev_info_manifest.html /usr/share/doc/libfido2/html/fido_dev_info_free.html |
252 | /usr/share/doc/libfido2/fido_dev_info_manifest.html /usr/share/doc/libfido2/fido_dev_info_manufacturer_string.html | 253 | /usr/share/doc/libfido2/html/fido_dev_info_manifest.html /usr/share/doc/libfido2/html/fido_dev_info_manufacturer_string.html |
253 | /usr/share/doc/libfido2/fido_dev_info_manifest.html /usr/share/doc/libfido2/fido_dev_info_new.html | 254 | /usr/share/doc/libfido2/html/fido_dev_info_manifest.html /usr/share/doc/libfido2/html/fido_dev_info_new.html |
254 | /usr/share/doc/libfido2/fido_dev_info_manifest.html /usr/share/doc/libfido2/fido_dev_info_path.html | 255 | /usr/share/doc/libfido2/html/fido_dev_info_manifest.html /usr/share/doc/libfido2/html/fido_dev_info_path.html |
255 | /usr/share/doc/libfido2/fido_dev_info_manifest.html /usr/share/doc/libfido2/fido_dev_info_product.html | 256 | /usr/share/doc/libfido2/html/fido_dev_info_manifest.html /usr/share/doc/libfido2/html/fido_dev_info_product.html |
256 | /usr/share/doc/libfido2/fido_dev_info_manifest.html /usr/share/doc/libfido2/fido_dev_info_product_string.html | 257 | /usr/share/doc/libfido2/html/fido_dev_info_manifest.html /usr/share/doc/libfido2/html/fido_dev_info_product_string.html |
257 | /usr/share/doc/libfido2/fido_dev_info_manifest.html /usr/share/doc/libfido2/fido_dev_info_ptr.html | 258 | /usr/share/doc/libfido2/html/fido_dev_info_manifest.html /usr/share/doc/libfido2/html/fido_dev_info_ptr.html |
258 | /usr/share/doc/libfido2/fido_dev_info_manifest.html /usr/share/doc/libfido2/fido_dev_info_vendor.html | 259 | /usr/share/doc/libfido2/html/fido_dev_info_manifest.html /usr/share/doc/libfido2/html/fido_dev_info_vendor.html |
259 | /usr/share/doc/libfido2/fido_dev_open.html /usr/share/doc/libfido2/fido_dev_build.html | 260 | /usr/share/doc/libfido2/html/fido_dev_open.html /usr/share/doc/libfido2/html/fido_dev_build.html |
260 | /usr/share/doc/libfido2/fido_dev_open.html /usr/share/doc/libfido2/fido_dev_cancel.html | 261 | /usr/share/doc/libfido2/html/fido_dev_open.html /usr/share/doc/libfido2/html/fido_dev_cancel.html |
261 | /usr/share/doc/libfido2/fido_dev_open.html /usr/share/doc/libfido2/fido_dev_close.html | 262 | /usr/share/doc/libfido2/html/fido_dev_open.html /usr/share/doc/libfido2/html/fido_dev_close.html |
262 | /usr/share/doc/libfido2/fido_dev_open.html /usr/share/doc/libfido2/fido_dev_flags.html | 263 | /usr/share/doc/libfido2/html/fido_dev_open.html /usr/share/doc/libfido2/html/fido_dev_flags.html |
263 | /usr/share/doc/libfido2/fido_dev_open.html /usr/share/doc/libfido2/fido_dev_force_fido2.html | 264 | /usr/share/doc/libfido2/html/fido_dev_open.html /usr/share/doc/libfido2/html/fido_dev_force_fido2.html |
264 | /usr/share/doc/libfido2/fido_dev_open.html /usr/share/doc/libfido2/fido_dev_force_u2f.html | 265 | /usr/share/doc/libfido2/html/fido_dev_open.html /usr/share/doc/libfido2/html/fido_dev_force_u2f.html |
265 | /usr/share/doc/libfido2/fido_dev_open.html /usr/share/doc/libfido2/fido_dev_free.html | 266 | /usr/share/doc/libfido2/html/fido_dev_open.html /usr/share/doc/libfido2/html/fido_dev_free.html |
266 | /usr/share/doc/libfido2/fido_dev_open.html /usr/share/doc/libfido2/fido_dev_is_fido2.html | 267 | /usr/share/doc/libfido2/html/fido_dev_open.html /usr/share/doc/libfido2/html/fido_dev_is_fido2.html |
267 | /usr/share/doc/libfido2/fido_dev_open.html /usr/share/doc/libfido2/fido_dev_major.html | 268 | /usr/share/doc/libfido2/html/fido_dev_open.html /usr/share/doc/libfido2/html/fido_dev_major.html |
268 | /usr/share/doc/libfido2/fido_dev_open.html /usr/share/doc/libfido2/fido_dev_minor.html | 269 | /usr/share/doc/libfido2/html/fido_dev_open.html /usr/share/doc/libfido2/html/fido_dev_minor.html |
269 | /usr/share/doc/libfido2/fido_dev_open.html /usr/share/doc/libfido2/fido_dev_new.html | 270 | /usr/share/doc/libfido2/html/fido_dev_open.html /usr/share/doc/libfido2/html/fido_dev_new.html |
270 | /usr/share/doc/libfido2/fido_dev_open.html /usr/share/doc/libfido2/fido_dev_protocol.html | 271 | /usr/share/doc/libfido2/html/fido_dev_open.html /usr/share/doc/libfido2/html/fido_dev_protocol.html |
271 | /usr/share/doc/libfido2/fido_dev_set_pin.html /usr/share/doc/libfido2/fido_dev_get_retry_count.html | 272 | /usr/share/doc/libfido2/html/fido_dev_set_pin.html /usr/share/doc/libfido2/html/fido_dev_get_retry_count.html |
272 | /usr/share/doc/libfido2/fido_dev_set_pin.html /usr/share/doc/libfido2/fido_dev_reset.html | 273 | /usr/share/doc/libfido2/html/fido_dev_set_pin.html /usr/share/doc/libfido2/html/fido_dev_reset.html |
273 | /usr/share/doc/libfido2/rs256_pk_new.html /usr/share/doc/libfido2/rs256_pk_free.html | 274 | /usr/share/doc/libfido2/html/rs256_pk_new.html /usr/share/doc/libfido2/html/rs256_pk_free.html |
274 | /usr/share/doc/libfido2/rs256_pk_new.html /usr/share/doc/libfido2/rs256_pk_from_ptr.html | 275 | /usr/share/doc/libfido2/html/rs256_pk_new.html /usr/share/doc/libfido2/html/rs256_pk_from_ptr.html |
275 | /usr/share/doc/libfido2/rs256_pk_new.html /usr/share/doc/libfido2/rs256_pk_from_RSA.html | 276 | /usr/share/doc/libfido2/html/rs256_pk_new.html /usr/share/doc/libfido2/html/rs256_pk_from_RSA.html |
276 | /usr/share/doc/libfido2/rs256_pk_new.html /usr/share/doc/libfido2/rs256_pk_to_EVP_PKEY.html | 277 | /usr/share/doc/libfido2/html/rs256_pk_new.html /usr/share/doc/libfido2/html/rs256_pk_to_EVP_PKEY.html |
diff --git a/debian/patches/conditional-stack-protector-all.patch b/debian/patches/conditional-stack-protector-all.patch deleted file mode 100644 index 99fa85e..0000000 --- a/debian/patches/conditional-stack-protector-all.patch +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | Subject: Only use -fstack-protector-all if it is supported | ||
2 | |||
3 | This flag isn't available on all Debian ports. | ||
4 | |||
5 | Origin: vendor | ||
6 | From: Colin Watson <cjwatson@debian.org> | ||
7 | Reviewed-by: nicoo <nicoo@debian.org> | ||
8 | Forwarded: https://github.com/Yubico/libfido2/pull/130 | ||
9 | Applied-Upstream: not-yet | ||
10 | Last-Update: 2020-02-23 | ||
11 | |||
12 | --- | ||
13 | CMakeLists.txt | 5 ++++- | ||
14 | 1 file changed, 4 insertions(+), 1 deletion(-) | ||
15 | |||
16 | diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
17 | index c7c5991..07ca5e1 100644 | ||
18 | --- a/CMakeLists.txt | ||
19 | +++ b/CMakeLists.txt | ||
20 | @@ -114,7 +114,10 @@ else() | ||
21 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wbad-function-cast") | ||
22 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic") | ||
23 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic-errors") | ||
24 | - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector-all") | ||
25 | + check_c_compiler_flag("-fstack-protector-all" HAVE_STACK_PROTECTOR_ALL) | ||
26 | + if(HAVE_STACK_PROTECTOR_ALL) | ||
27 | + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector-all") | ||
28 | + endif() | ||
29 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99") | ||
30 | |||
31 | set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g2") | ||
diff --git a/debian/patches/series b/debian/patches/series deleted file mode 100644 index d5d2276..0000000 --- a/debian/patches/series +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | conditional-stack-protector-all.patch | ||
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 957311e..1203592 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt | |||
@@ -8,7 +8,7 @@ list(APPEND COMPAT_SOURCES | |||
8 | ../openbsd-compat/strlcpy.c | 8 | ../openbsd-compat/strlcpy.c |
9 | ) | 9 | ) |
10 | 10 | ||
11 | if(WIN32) | 11 | if(WIN32 AND NOT CYGWIN AND NOT MSYS) |
12 | list(APPEND COMPAT_SOURCES ../openbsd-compat/posix_win.c) | 12 | list(APPEND COMPAT_SOURCES ../openbsd-compat/posix_win.c) |
13 | endif() | 13 | endif() |
14 | 14 | ||
diff --git a/examples/cred.c b/examples/cred.c index e471f7e..3e0a30f 100644 --- a/examples/cred.c +++ b/examples/cred.c | |||
@@ -139,6 +139,27 @@ verify_cred(int type, const char *fmt, const unsigned char *authdata_ptr, | |||
139 | fido_cred_free(&cred); | 139 | fido_cred_free(&cred); |
140 | } | 140 | } |
141 | 141 | ||
142 | static fido_dev_t * | ||
143 | open_from_manifest(const fido_dev_info_t *dev_infos, size_t len, | ||
144 | const char *path) | ||
145 | { | ||
146 | size_t i; | ||
147 | fido_dev_t *dev; | ||
148 | |||
149 | for (i = 0; i < len; i++) { | ||
150 | const fido_dev_info_t *curr = fido_dev_info_ptr(dev_infos, i); | ||
151 | if (path == NULL || | ||
152 | strcmp(path, fido_dev_info_path(curr)) == 0) { | ||
153 | dev = fido_dev_new_with_info(curr); | ||
154 | if (fido_dev_open_with_info(dev) == FIDO_OK) | ||
155 | return (dev); | ||
156 | fido_dev_free(&dev); | ||
157 | } | ||
158 | } | ||
159 | |||
160 | return (NULL); | ||
161 | } | ||
162 | |||
142 | int | 163 | int |
143 | main(int argc, char **argv) | 164 | main(int argc, char **argv) |
144 | { | 165 | { |
@@ -150,6 +171,7 @@ main(int argc, char **argv) | |||
150 | const char *pin = NULL; | 171 | const char *pin = NULL; |
151 | const char *key_out = NULL; | 172 | const char *key_out = NULL; |
152 | const char *id_out = NULL; | 173 | const char *id_out = NULL; |
174 | const char *path = NULL; | ||
153 | unsigned char *body = NULL; | 175 | unsigned char *body = NULL; |
154 | long long seconds = 0; | 176 | long long seconds = 0; |
155 | size_t len; | 177 | size_t len; |
@@ -157,6 +179,8 @@ main(int argc, char **argv) | |||
157 | int ext = 0; | 179 | int ext = 0; |
158 | int ch; | 180 | int ch; |
159 | int r; | 181 | int r; |
182 | fido_dev_info_t *dev_infos = NULL; | ||
183 | size_t dev_infos_len = 0; | ||
160 | 184 | ||
161 | if ((cred = fido_cred_new()) == NULL) | 185 | if ((cred = fido_cred_new()) == NULL) |
162 | errx(1, "fido_cred_new"); | 186 | errx(1, "fido_cred_new"); |
@@ -218,19 +242,21 @@ main(int argc, char **argv) | |||
218 | } | 242 | } |
219 | } | 243 | } |
220 | 244 | ||
245 | fido_init(0); | ||
246 | |||
221 | argc -= optind; | 247 | argc -= optind; |
222 | argv += optind; | 248 | argv += optind; |
223 | 249 | ||
224 | if (argc != 1) | 250 | if (argc > 1) |
225 | usage(); | 251 | usage(); |
252 | dev_infos = fido_dev_info_new(16); | ||
253 | fido_dev_info_manifest(dev_infos, 16, &dev_infos_len); | ||
254 | if (argc == 1) | ||
255 | path = argv[0]; | ||
226 | 256 | ||
227 | fido_init(0); | 257 | if ((dev = open_from_manifest(dev_infos, dev_infos_len, path)) == NULL) |
228 | 258 | errx(1, "open_from_manifest"); | |
229 | if ((dev = fido_dev_new()) == NULL) | ||
230 | errx(1, "fido_dev_new"); | ||
231 | 259 | ||
232 | if ((r = fido_dev_open(dev, argv[0])) != FIDO_OK) | ||
233 | errx(1, "fido_dev_open: %s (0x%x)", fido_strerr(r), r); | ||
234 | if (u2f) | 260 | if (u2f) |
235 | fido_dev_force_u2f(dev); | 261 | fido_dev_force_u2f(dev); |
236 | 262 | ||
diff --git a/examples/info.c b/examples/info.c index e79729c..ef0d97e 100644 --- a/examples/info.c +++ b/examples/info.c | |||
@@ -131,6 +131,15 @@ print_maxmsgsiz(uint64_t maxmsgsiz) | |||
131 | } | 131 | } |
132 | 132 | ||
133 | /* | 133 | /* |
134 | * Auxiliary function to print an authenticator's firmware version on stdout. | ||
135 | */ | ||
136 | static void | ||
137 | print_fwversion(uint64_t fwversion) | ||
138 | { | ||
139 | printf("fwversion: 0x%x\n", (int)fwversion); | ||
140 | } | ||
141 | |||
142 | /* | ||
134 | * Auxiliary function to print an array of bytes on stdout. | 143 | * Auxiliary function to print an array of bytes on stdout. |
135 | */ | 144 | */ |
136 | static void | 145 | static void |
@@ -190,6 +199,9 @@ getinfo(const char *path) | |||
190 | /* print maximum message size */ | 199 | /* print maximum message size */ |
191 | print_maxmsgsiz(fido_cbor_info_maxmsgsiz(ci)); | 200 | print_maxmsgsiz(fido_cbor_info_maxmsgsiz(ci)); |
192 | 201 | ||
202 | /* print firmware version */ | ||
203 | print_fwversion(fido_cbor_info_fwversion(ci)); | ||
204 | |||
193 | /* print supported pin protocols */ | 205 | /* print supported pin protocols */ |
194 | print_byte_array("pin protocols", fido_cbor_info_protocols_ptr(ci), | 206 | print_byte_array("pin protocols", fido_cbor_info_protocols_ptr(ci), |
195 | fido_cbor_info_protocols_len(ci)); | 207 | fido_cbor_info_protocols_len(ci)); |
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 | ||
10 | list(APPEND COMMON_SOURCES | 10 | list(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 |
17 | add_executable(fuzz_cred fuzz_cred.c ${COMMON_SOURCES} ${COMPAT_SOURCES}) | 15 | add_executable(fuzz_cred fuzz_cred.c ${COMMON_SOURCES} ${COMPAT_SOURCES}) |
18 | target_compile_options(fuzz_cred PRIVATE ${FUZZ_LDFLAGS}) | 16 | target_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 | |||
5 | FROM ubuntu:bionic | ||
6 | RUN apt-get update | ||
7 | RUN apt-get install -y clang-9 cmake git libssl-dev libudev-dev make pkg-config | ||
8 | RUN git clone --branch v0.5.0 https://github.com/PJK/libcbor | ||
9 | RUN git clone https://github.com/yubico/libfido2 | ||
10 | RUN 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 | |||
5 | IMAGE := libfido2-coverage:1.3.0 | ||
6 | RUNNER := libfido2-runner | ||
7 | PROFDATA := llvm-profdata-9 | ||
8 | COV := llvm-cov-9 | ||
9 | TARGETS := fuzz_assert fuzz_bio fuzz_cred fuzz_credman fuzz_mgmt | ||
10 | CORPORA := $(foreach f,${TARGETS},${f}/corpus) | ||
11 | MINIFY := $(foreach f,${TARGETS},/minify/${f}/corpus) | ||
12 | REMOTE := gs://libfido2-corpus.clusterfuzz-external.appspot.com | ||
13 | .DEFAULT_GOAL := all | ||
14 | |||
15 | all: ${TARGETS} | ||
16 | |||
17 | build: | ||
18 | docker build -t ${IMAGE} - < Dockerfile | ||
19 | |||
20 | run: build | ||
21 | -docker run -it -d --name ${RUNNER} ${IMAGE} | ||
22 | docker start ${RUNNER} | ||
23 | |||
24 | sync: run | ||
25 | tar Ccf .. - src fuzz | docker exec -i ${RUNNER} tar Cxf /libfido2 - | ||
26 | docker exec ${RUNNER} make -C libfido2/build | ||
27 | |||
28 | corpus: 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 | |||
42 | corpus.tgz-: ${MINIFY} | ||
43 | docker exec -i ${RUNNER} tar Czcf /minify - ${TARGETS} > $@ | ||
44 | |||
45 | profdata: run | ||
46 | docker exec ${RUNNER} /bin/bash -c 'rm -f /$@ && ${PROFDATA} \ | ||
47 | merge -sparse profraw/* -o $@' | ||
48 | |||
49 | report.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 | |||
55 | summary.txt: profdata | ||
56 | docker exec ${RUNNER} ${COV} report -use-color=false \ | ||
57 | /libfido2/build/src/libfido2.so -instr-profile=/$< > $@ | ||
58 | |||
59 | functions.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 | |||
64 | clean: 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 | |||
74 | corpus.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 | |||
129 | The recommended way to run the harnesses is: | 129 | The 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 | ||
134 | You may want to use -jobs or -workers depending on the number of logical | 134 | You may want to use -jobs or -workers depending on the number of logical |
135 | cores available for fuzzing. | 135 | cores 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 | |||
7 | LIBCBOR=$1 | ||
8 | LIBFIDO2=$2 | ||
9 | |||
10 | CC=${CC:-clang} | ||
11 | PKG_CONFIG_PATH=${PKG_CONFIG_PATH:-${LIBCBOR}/install/lib/pkgconfig} | ||
12 | export CC PKG_CONFIG_PATH | ||
13 | |||
14 | # Clean up. | ||
15 | rm -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 | ||
19 | mkdir ${LIBCBOR}/build ${LIBCBOR}/install | ||
20 | (cd ${LIBCBOR}/build && cmake -DCMAKE_INSTALL_PREFIX=${LIBCBOR}/install ..) | ||
21 | make -C ${LIBCBOR}/build all install | ||
22 | |||
23 | # Build libfido2. | ||
24 | mkdir -p ${LIBFIDO2}/build | ||
25 | (cd ${LIBFIDO2}/build && cmake -DFUZZ=1 -DLIBFUZZER=1 -DCOVERAGE=1 \ | ||
26 | -DCMAKE_BUILD_TYPE=Debug ..) | ||
27 | make -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 | |||
12 | const char dummy_name[] = "finger1"; | ||
13 | const char dummy_pin[] = "9}4gT:8d=A37Dh}U"; | ||
14 | const char dummy_rp_id[] = "localhost"; | ||
15 | const char dummy_rp_name[] = "sweet home localhost"; | ||
16 | const char dummy_user_icon[] = "an icon"; | ||
17 | const char dummy_user_name[] = "john smith"; | ||
18 | const char dummy_user_nick[] = "jsmith"; | ||
19 | const uint8_t dummy_id[] = { 0x5e, 0xd2 }; | ||
20 | const char dummy_pin1[] = "skepp cg0u3;Y.."; | ||
21 | const char dummy_pin2[] = "bastilha 6rJrfQZI."; | ||
22 | |||
23 | const 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 | |||
30 | const 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 | |||
35 | const 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 | |||
42 | const 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 | |||
53 | const 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 | |||
89 | const 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 @@ | |||
1 | File '/home/pedro/projects/libfido2/src/aes256.c': | 1 | File '/libfido2/src/aes256.c': |
2 | Name Regions Miss Cover Lines Miss Cover | 2 | Name Regions Miss Cover Lines Miss Cover |
3 | ----------------------------------------------------------------------------- | 3 | ----------------------------------------------------------------------------- |
4 | aes256_cbc_enc 28 0 100.00% 41 0 100.00% | 4 | aes256_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 | ----------------------------------------------------------------------------- |
7 | TOTAL 56 0 100.00% 82 0 100.00% | 7 | TOTAL 56 0 100.00% 82 0 100.00% |
8 | 8 | ||
9 | File '/home/pedro/projects/libfido2/src/assert.c': | 9 | File '/libfido2/src/assert.c': |
10 | Name Regions Miss Cover Lines Miss Cover | 10 | Name Regions Miss Cover Lines Miss Cover |
11 | --------------------------------------------------------------------------------------- | 11 | --------------------------------------------------------------------------------------- |
12 | fido_dev_get_assert 35 3 91.43% 38 4 89.47% | 12 | fido_dev_get_assert 35 3 91.43% 38 4 89.47% |
13 | fido_check_flags 13 0 100.00% 18 0 100.00% | 13 | fido_check_flags 13 0 100.00% 18 0 100.00% |
14 | fido_get_signed_hash 32 0 100.00% 46 0 100.00% | ||
14 | fido_verify_sig_es256 17 2 88.24% 31 7 77.42% | 15 | fido_verify_sig_es256 17 2 88.24% 31 7 77.42% |
15 | fido_verify_sig_rs256 17 2 88.24% 31 7 77.42% | 16 | fido_verify_sig_rs256 17 2 88.24% 31 7 77.42% |
16 | fido_verify_sig_eddsa 23 2 91.30% 43 7 83.72% | 17 | fido_verify_sig_eddsa 23 4 82.61% 43 13 69.77% |
17 | fido_assert_verify 48 4 91.67% 79 4 94.94% | 18 | fido_assert_verify 48 4 91.67% 79 4 94.94% |
18 | fido_assert_set_clientdata_hash 6 0 100.00% 6 0 100.00% | 19 | fido_assert_set_clientdata_hash 6 0 100.00% 6 0 100.00% |
19 | fido_assert_set_hmac_salt 10 0 100.00% 7 0 100.00% | 20 | fido_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 | |||
27 | fido_assert_clientdata_hash_len 1 0 100.00% 3 0 100.00% | 28 | fido_assert_clientdata_hash_len 1 0 100.00% 3 0 100.00% |
28 | fido_assert_new 1 0 100.00% 3 0 100.00% | 29 | fido_assert_new 1 0 100.00% 3 0 100.00% |
29 | fido_assert_reset_tx 1 0 100.00% 15 0 100.00% | 30 | fido_assert_reset_tx 1 0 100.00% 15 0 100.00% |
30 | fido_assert_reset_rx 6 0 100.00% 24 0 100.00% | 31 | fido_assert_reset_rx 6 1 83.33% 24 3 87.50% |
31 | fido_assert_free 6 0 100.00% 13 0 100.00% | 32 | fido_assert_free 6 0 100.00% 13 0 100.00% |
32 | fido_assert_count 1 0 100.00% 3 0 100.00% | 33 | fido_assert_count 1 0 100.00% 3 0 100.00% |
33 | fido_assert_rp_id 1 0 100.00% 3 0 100.00% | 34 | fido_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 | |||
47 | fido_assert_hmac_secret_ptr 4 0 100.00% 6 0 100.00% | 48 | fido_assert_hmac_secret_ptr 4 0 100.00% 6 0 100.00% |
48 | fido_assert_hmac_secret_len 4 0 100.00% 6 0 100.00% | 49 | fido_assert_hmac_secret_len 4 0 100.00% 6 0 100.00% |
49 | fido_assert_set_authdata 24 0 100.00% 35 0 100.00% | 50 | fido_assert_set_authdata 24 0 100.00% 35 0 100.00% |
50 | fido_assert_set_authdata_raw 24 0 100.00% 34 0 100.00% | 51 | fido_assert_set_authdata_raw 24 4 83.33% 34 7 79.41% |
51 | fido_assert_set_sig 14 0 100.00% 17 0 100.00% | 52 | fido_assert_set_sig 14 0 100.00% 17 0 100.00% |
52 | fido_assert_set_count 10 0 100.00% 21 0 100.00% | 53 | fido_assert_set_count 10 0 100.00% 21 0 100.00% |
53 | assert.c:fido_dev_get_assert_wait 21 0 100.00% 16 0 100.00% | 54 | assert.c:fido_dev_get_assert_wait 21 1 95.24% 16 2 87.50% |
54 | assert.c:fido_dev_get_assert_tx 58 4 93.10% 84 11 86.90% | 55 | assert.c:fido_dev_get_assert_tx 58 4 93.10% 84 11 86.90% |
55 | assert.c:fido_dev_get_assert_rx 20 0 100.00% 38 0 100.00% | 56 | assert.c:fido_dev_get_assert_rx 19 0 100.00% 38 0 100.00% |
56 | assert.c:adjust_assert_count 24 0 100.00% 33 0 100.00% | 57 | assert.c:adjust_assert_count 24 0 100.00% 33 0 100.00% |
57 | assert.c:parse_assert_reply 11 0 100.00% 25 0 100.00% | 58 | assert.c:parse_assert_reply 11 0 100.00% 25 0 100.00% |
58 | assert.c:fido_get_next_assert_tx 9 0 100.00% 11 0 100.00% | 59 | assert.c:fido_get_next_assert_tx 8 2 75.00% 10 3 70.00% |
59 | assert.c:fido_get_next_assert_rx 16 2 87.50% 26 4 84.62% | 60 | assert.c:fido_get_next_assert_rx 15 4 73.33% 26 7 73.08% |
60 | assert.c:decrypt_hmac_secrets 9 1 88.89% 15 4 73.33% | 61 | assert.c:decrypt_hmac_secrets 9 3 66.67% 15 7 53.33% |
61 | assert.c:check_extensions 4 0 100.00% 9 0 100.00% | 62 | assert.c:check_extensions 4 0 100.00% 9 0 100.00% |
62 | assert.c:get_signed_hash 32 0 100.00% 46 0 100.00% | ||
63 | assert.c:fido_assert_clean_authdata 1 0 100.00% 9 0 100.00% | 63 | assert.c:fido_assert_clean_authdata 1 0 100.00% 9 0 100.00% |
64 | assert.c:fido_assert_clean_sig 1 0 100.00% 5 0 100.00% | 64 | assert.c:fido_assert_clean_sig 1 0 100.00% 5 0 100.00% |
65 | --------------------------------------------------------------------------------------- | 65 | --------------------------------------------------------------------------------------- |
66 | TOTAL 569 29 94.90% 901 60 93.34% | 66 | TOTAL 566 43 92.40% 900 87 90.33% |
67 | 67 | ||
68 | File '/home/pedro/projects/libfido2/src/authkey.c': | 68 | File '/libfido2/src/authkey.c': |
69 | Name Regions Miss Cover Lines Miss Cover | 69 | Name Regions Miss Cover Lines Miss Cover |
70 | --------------------------------------------------------------------------------------- | 70 | --------------------------------------------------------------------------------------- |
71 | fido_dev_authkey 1 0 100.00% 3 0 100.00% | 71 | fido_dev_authkey 1 0 100.00% 3 0 100.00% |
72 | authkey.c:fido_dev_authkey_wait 10 0 100.00% 9 0 100.00% | 72 | authkey.c:fido_dev_authkey_wait 10 0 100.00% 9 0 100.00% |
73 | authkey.c:fido_dev_authkey_tx 19 0 100.00% 33 0 100.00% | 73 | authkey.c:fido_dev_authkey_tx 19 0 100.00% 33 0 100.00% |
74 | authkey.c:fido_dev_authkey_rx 7 0 100.00% 18 0 100.00% | 74 | authkey.c:fido_dev_authkey_rx 6 0 100.00% 18 0 100.00% |
75 | authkey.c:parse_authkey 8 0 100.00% 12 0 100.00% | 75 | authkey.c:parse_authkey 8 0 100.00% 12 0 100.00% |
76 | --------------------------------------------------------------------------------------- | 76 | --------------------------------------------------------------------------------------- |
77 | TOTAL 45 0 100.00% 75 0 100.00% | 77 | TOTAL 44 0 100.00% 75 0 100.00% |
78 | 78 | ||
79 | File '/home/pedro/projects/libfido2/src/bio.c': | 79 | File '/libfido2/src/bio.c': |
80 | Name Regions Miss Cover Lines Miss Cover | 80 | Name Regions Miss Cover Lines Miss Cover |
81 | --------------------------------------------------------------------------------------- | 81 | --------------------------------------------------------------------------------------- |
82 | fido_bio_dev_get_template_array 5 2 60.00% 6 0 100.00% | 82 | fido_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 | |||
108 | bio.c:bio_get_template_array_wait 11 0 100.00% 9 0 100.00% | 108 | bio.c:bio_get_template_array_wait 11 0 100.00% 9 0 100.00% |
109 | bio.c:bio_tx 43 0 100.00% 65 0 100.00% | 109 | bio.c:bio_tx 43 0 100.00% 65 0 100.00% |
110 | bio.c:bio_prepare_hmac 18 0 100.00% 36 0 100.00% | 110 | bio.c:bio_prepare_hmac 18 0 100.00% 36 0 100.00% |
111 | bio.c:bio_rx_template_array 12 0 100.00% 21 0 100.00% | 111 | bio.c:bio_rx_template_array 11 0 100.00% 21 0 100.00% |
112 | bio.c:bio_parse_template_array 26 1 96.15% 34 4 88.24% | 112 | bio.c:bio_parse_template_array 26 1 96.15% 34 4 88.24% |
113 | bio.c:decode_template_array 12 1 91.67% 23 3 86.96% | 113 | bio.c:decode_template_array 12 1 91.67% 23 3 86.96% |
114 | bio.c:decode_template 9 0 100.00% 18 0 100.00% | 114 | bio.c:decode_template 9 0 100.00% 18 0 100.00% |
115 | bio.c:bio_set_template_name_wait 19 0 100.00% 24 0 100.00% | 115 | bio.c:bio_set_template_name_wait 19 0 100.00% 24 0 100.00% |
116 | bio.c:bio_enroll_begin_wait 17 1 94.12% 24 3 87.50% | 116 | bio.c:bio_enroll_begin_wait 17 0 100.00% 24 0 100.00% |
117 | bio.c:bio_rx_enroll_begin 16 0 100.00% 29 0 100.00% | 117 | bio.c:bio_rx_enroll_begin 15 0 100.00% 29 0 100.00% |
118 | bio.c:bio_parse_enroll_status 20 0 100.00% 31 0 100.00% | 118 | bio.c:bio_parse_enroll_status 20 0 100.00% 31 0 100.00% |
119 | bio.c:bio_parse_template_id 8 0 100.00% 12 0 100.00% | 119 | bio.c:bio_parse_template_id 8 0 100.00% 12 0 100.00% |
120 | bio.c:bio_enroll_continue_wait 19 0 100.00% 25 0 100.00% | 120 | bio.c:bio_enroll_continue_wait 19 0 100.00% 25 0 100.00% |
121 | bio.c:bio_rx_enroll_continue 12 0 100.00% 22 0 100.00% | 121 | bio.c:bio_rx_enroll_continue 11 0 100.00% 22 0 100.00% |
122 | bio.c:bio_enroll_cancel_wait 11 11 0.00% 12 12 0.00% | 122 | bio.c:bio_enroll_cancel_wait 11 11 0.00% 12 12 0.00% |
123 | bio.c:bio_enroll_remove_wait 17 0 100.00% 24 0 100.00% | 123 | bio.c:bio_enroll_remove_wait 17 0 100.00% 24 0 100.00% |
124 | bio.c:bio_get_info_wait 11 0 100.00% 11 0 100.00% | 124 | bio.c:bio_get_info_wait 11 0 100.00% 11 0 100.00% |
125 | bio.c:bio_rx_info 12 0 100.00% 21 0 100.00% | 125 | bio.c:bio_rx_info 11 0 100.00% 21 0 100.00% |
126 | bio.c:bio_reset_info 1 0 100.00% 4 0 100.00% | 126 | bio.c:bio_reset_info 1 0 100.00% 4 0 100.00% |
127 | bio.c:bio_parse_info 20 0 100.00% 31 0 100.00% | 127 | bio.c:bio_parse_info 20 0 100.00% 31 0 100.00% |
128 | bio.c:bio_reset_template_array 4 0 100.00% 8 0 100.00% | 128 | bio.c:bio_reset_template_array 4 0 100.00% 8 0 100.00% |
129 | bio.c:bio_reset_template 1 0 100.00% 6 0 100.00% | 129 | bio.c:bio_reset_template 1 0 100.00% 6 0 100.00% |
130 | bio.c:bio_reset_enroll 3 0 100.00% 7 0 100.00% | 130 | bio.c:bio_reset_enroll 3 0 100.00% 7 0 100.00% |
131 | --------------------------------------------------------------------------------------- | 131 | --------------------------------------------------------------------------------------- |
132 | TOTAL 422 21 95.02% 661 25 96.22% | 132 | TOTAL 418 20 95.22% 661 22 96.67% |
133 | 133 | ||
134 | File '/home/pedro/projects/libfido2/src/blob.c': | 134 | File '/libfido2/src/blob.c': |
135 | Name Regions Miss Cover Lines Miss Cover | 135 | Name Regions Miss Cover Lines Miss Cover |
136 | --------------------------------------------------------------------------------------- | 136 | --------------------------------------------------------------------------------------- |
137 | fido_blob_new 1 0 100.00% 3 0 100.00% | 137 | fido_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 | --------------------------------------------------------------------------------------- |
145 | TOTAL 39 1 97.44% 73 4 94.52% | 145 | TOTAL 39 1 97.44% 73 4 94.52% |
146 | 146 | ||
147 | File '/home/pedro/projects/libfido2/src/buf.c': | 147 | File '/libfido2/src/buf.c': |
148 | Name Regions Miss Cover Lines Miss Cover | 148 | Name Regions Miss Cover Lines Miss Cover |
149 | --------------------------------------------------------------------------------------- | 149 | --------------------------------------------------------------------------------------- |
150 | fido_buf_read 4 0 100.00% 10 0 100.00% | 150 | fido_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 | --------------------------------------------------------------------------------------- |
153 | TOTAL 8 1 87.50% 20 1 95.00% | 153 | TOTAL 8 1 87.50% 20 1 95.00% |
154 | 154 | ||
155 | File '/home/pedro/projects/libfido2/src/cbor.c': | 155 | File '/libfido2/src/cbor.c': |
156 | Name Regions Miss Cover Lines Miss Cover | 156 | Name Regions Miss Cover Lines Miss Cover |
157 | --------------------------------------------------------------------------------------- | 157 | --------------------------------------------------------------------------------------- |
158 | cbor_map_iter 20 1 95.00% 30 4 86.67% | 158 | cbor_map_iter 20 0 100.00% 30 0 100.00% |
159 | cbor_array_iter 12 0 100.00% 20 0 100.00% | 159 | cbor_array_iter 12 0 100.00% 20 0 100.00% |
160 | cbor_parse_reply 27 0 100.00% 43 0 100.00% | 160 | cbor_parse_reply 27 0 100.00% 43 0 100.00% |
161 | cbor_vector_free 6 0 100.00% 5 0 100.00% | 161 | cbor_vector_free 6 0 100.00% 5 0 100.00% |
@@ -168,10 +168,10 @@ cbor_flatten_vector 14 1 92.86% 21 1 | |||
168 | cbor_build_frame 15 0 100.00% 32 0 100.00% | 168 | cbor_build_frame 15 0 100.00% 32 0 100.00% |
169 | cbor_encode_rp_entity 13 0 100.00% 14 0 100.00% | 169 | cbor_encode_rp_entity 13 0 100.00% 14 0 100.00% |
170 | cbor_encode_user_entity 21 0 100.00% 18 0 100.00% | 170 | cbor_encode_user_entity 21 0 100.00% 18 0 100.00% |
171 | cbor_encode_pubkey_param 36 0 100.00% 48 0 100.00% | 171 | cbor_encode_pubkey_param 36 1 97.22% 48 0 100.00% |
172 | cbor_encode_pubkey 10 0 100.00% 13 0 100.00% | 172 | cbor_encode_pubkey 10 0 100.00% 13 0 100.00% |
173 | cbor_encode_pubkey_list 18 2 88.89% 23 0 100.00% | 173 | cbor_encode_pubkey_list 18 1 94.44% 23 0 100.00% |
174 | cbor_encode_extensions 13 1 92.31% 16 0 100.00% | 174 | cbor_encode_extensions 24 2 91.67% 26 3 88.46% |
175 | cbor_encode_options 13 0 100.00% 14 0 100.00% | 175 | cbor_encode_options 13 0 100.00% 14 0 100.00% |
176 | cbor_encode_assert_options 13 0 100.00% 14 0 100.00% | 176 | cbor_encode_assert_options 13 0 100.00% 14 0 100.00% |
177 | cbor_encode_pin_auth 8 0 100.00% 12 0 100.00% | 177 | cbor_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 | |||
180 | cbor_encode_change_pin_auth 44 1 97.73% 69 3 95.65% | 180 | cbor_encode_change_pin_auth 44 1 97.73% 69 3 95.65% |
181 | cbor_encode_set_pin_auth 17 0 100.00% 28 0 100.00% | 181 | cbor_encode_set_pin_auth 17 0 100.00% 28 0 100.00% |
182 | cbor_encode_pin_hash_enc 15 0 100.00% 27 0 100.00% | 182 | cbor_encode_pin_hash_enc 15 0 100.00% 27 0 100.00% |
183 | cbor_encode_hmac_secret_param 41 1 97.56% 66 4 93.94% | 183 | cbor_encode_hmac_secret_param 41 2 95.12% 66 9 86.36% |
184 | cbor_decode_fmt 9 0 100.00% 18 0 100.00% | 184 | cbor_decode_fmt 9 0 100.00% 18 0 100.00% |
185 | cbor_decode_pubkey 21 1 95.24% 32 2 93.75% | 185 | cbor_decode_pubkey 21 6 71.43% 32 7 78.12% |
186 | cbor_decode_cred_authdata 31 0 100.00% 46 0 100.00% | 186 | cbor_decode_cred_authdata 31 0 100.00% 47 0 100.00% |
187 | cbor_decode_assert_authdata 23 0 100.00% 44 0 100.00% | 187 | cbor_decode_assert_authdata 23 2 91.30% 44 2 95.45% |
188 | cbor_decode_attstmt 8 0 100.00% 10 0 100.00% | 188 | cbor_decode_attstmt 8 0 100.00% 10 0 100.00% |
189 | cbor_decode_uint64 4 0 100.00% 10 0 100.00% | 189 | cbor_decode_uint64 4 0 100.00% 10 0 100.00% |
190 | cbor_decode_cred_id 8 0 100.00% 10 0 100.00% | 190 | cbor_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 | |||
193 | cbor.c:ctap_check_cbor 28 0 100.00% 32 0 100.00% | 193 | cbor.c:ctap_check_cbor 28 0 100.00% 32 0 100.00% |
194 | cbor.c:check_key_type 8 0 100.00% 9 0 100.00% | 194 | cbor.c:check_key_type 8 0 100.00% 9 0 100.00% |
195 | cbor.c:cbor_add_arg 13 0 100.00% 28 0 100.00% | 195 | cbor.c:cbor_add_arg 13 0 100.00% 28 0 100.00% |
196 | cbor.c:cbor_add_uint8 14 1 92.86% 26 3 88.46% | ||
196 | cbor.c:sha256 7 0 100.00% 15 0 100.00% | 197 | cbor.c:sha256 7 0 100.00% 15 0 100.00% |
197 | cbor.c:get_cose_alg 36 0 100.00% 48 0 100.00% | 198 | cbor.c:get_cose_alg 36 6 83.33% 48 6 87.50% |
198 | cbor.c:find_cose_alg 35 0 100.00% 40 0 100.00% | 199 | cbor.c:find_cose_alg 35 0 100.00% 40 0 100.00% |
199 | cbor.c:decode_attcred 25 0 100.00% 58 0 100.00% | 200 | cbor.c:decode_attcred 25 0 100.00% 58 0 100.00% |
200 | cbor.c:decode_extensions 16 4 75.00% 34 6 82.35% | 201 | cbor.c:decode_extensions 14 9 35.71% 34 13 61.76% |
201 | cbor.c:decode_extension 19 19 0.00% 27 27 0.00% | 202 | cbor.c:decode_extension 27 27 0.00% 36 36 0.00% |
202 | cbor.c:decode_hmac_secret 16 0 100.00% 32 0 100.00% | 203 | cbor.c:decode_hmac_secret 16 4 75.00% 32 6 81.25% |
203 | cbor.c:decode_hmac_secret_aux 7 0 100.00% 17 0 100.00% | 204 | cbor.c:decode_hmac_secret_aux 7 7 0.00% 17 17 0.00% |
204 | cbor.c:decode_attstmt_entry 29 0 100.00% 39 0 100.00% | 205 | cbor.c:decode_attstmt_entry 38 0 100.00% 45 0 100.00% |
205 | cbor.c:decode_x5c 4 0 100.00% 8 0 100.00% | 206 | cbor.c:decode_x5c 4 0 100.00% 8 0 100.00% |
206 | cbor.c:decode_cred_id_entry 10 0 100.00% 23 0 100.00% | 207 | cbor.c:decode_cred_id_entry 10 0 100.00% 23 0 100.00% |
207 | cbor.c:decode_user_entry 25 0 100.00% 39 0 100.00% | 208 | cbor.c:decode_user_entry 25 0 100.00% 39 0 100.00% |
208 | cbor.c:decode_rp_entity_entry 15 0 100.00% 29 0 100.00% | 209 | cbor.c:decode_rp_entity_entry 15 0 100.00% 29 0 100.00% |
209 | --------------------------------------------------------------------------------------- | 210 | --------------------------------------------------------------------------------------- |
210 | TOTAL 844 31 96.33% 1319 47 96.44% | 211 | TOTAL 884 70 92.08% 1371 106 92.27% |
211 | 212 | ||
212 | File '/home/pedro/projects/libfido2/src/cred.c': | 213 | File '/libfido2/src/cred.c': |
213 | Name Regions Miss Cover Lines Miss Cover | 214 | Name Regions Miss Cover Lines Miss Cover |
214 | --------------------------------------------------------------------------------------- | 215 | --------------------------------------------------------------------------------------- |
215 | fido_dev_make_cred 12 0 100.00% 9 0 100.00% | 216 | fido_dev_make_cred 12 0 100.00% 10 0 100.00% |
216 | fido_check_rp_id 4 0 100.00% 14 0 100.00% | 217 | fido_check_rp_id 4 0 100.00% 14 0 100.00% |
217 | fido_cred_verify 45 0 100.00% 71 0 100.00% | 218 | fido_cred_verify 46 6 86.96% 71 11 84.51% |
218 | fido_cred_verify_self 54 10 81.48% 90 14 84.44% | 219 | fido_cred_verify_self 54 14 74.07% 90 22 75.56% |
219 | fido_cred_new 1 0 100.00% 3 0 100.00% | 220 | fido_cred_new 1 0 100.00% 3 0 100.00% |
220 | fido_cred_reset_tx 1 0 100.00% 20 0 100.00% | 221 | fido_cred_reset_tx 1 0 100.00% 20 0 100.00% |
221 | fido_cred_reset_rx 1 0 100.00% 8 0 100.00% | 222 | fido_cred_reset_rx 1 0 100.00% 8 0 100.00% |
@@ -228,10 +229,11 @@ fido_cred_exclude 14 2 85.71% 25 3 | |||
228 | fido_cred_set_clientdata_hash 6 0 100.00% 6 0 100.00% | 229 | fido_cred_set_clientdata_hash 6 0 100.00% 6 0 100.00% |
229 | fido_cred_set_rp 18 2 88.89% 26 6 76.92% | 230 | fido_cred_set_rp 18 2 88.89% 26 6 76.92% |
230 | fido_cred_set_user 33 4 87.88% 50 13 74.00% | 231 | fido_cred_set_user 33 4 87.88% 50 13 74.00% |
231 | fido_cred_set_extensions 9 0 100.00% 8 0 100.00% | 232 | fido_cred_set_extensions 15 0 100.00% 12 0 100.00% |
232 | fido_cred_set_options 6 6 0.00% 6 6 0.00% | 233 | fido_cred_set_options 6 6 0.00% 6 6 0.00% |
233 | fido_cred_set_rk 2 0 100.00% 5 0 100.00% | 234 | fido_cred_set_rk 2 0 100.00% 5 0 100.00% |
234 | fido_cred_set_uv 2 0 100.00% 5 0 100.00% | 235 | fido_cred_set_uv 2 0 100.00% 5 0 100.00% |
236 | fido_cred_set_prot 21 2 90.48% 16 0 100.00% | ||
235 | fido_cred_set_fmt 16 4 75.00% 15 1 93.33% | 237 | fido_cred_set_fmt 16 4 75.00% 15 1 93.33% |
236 | fido_cred_set_type 17 2 88.24% 9 1 88.89% | 238 | fido_cred_set_type 17 2 88.24% 9 1 88.89% |
237 | fido_cred_type 1 0 100.00% 3 0 100.00% | 239 | fido_cred_type 1 0 100.00% 3 0 100.00% |
@@ -244,10 +246,11 @@ fido_cred_sig_ptr 1 0 100.00% 3 0 | |||
244 | fido_cred_sig_len 1 0 100.00% 3 0 100.00% | 246 | fido_cred_sig_len 1 0 100.00% 3 0 100.00% |
245 | fido_cred_authdata_ptr 1 0 100.00% 3 0 100.00% | 247 | fido_cred_authdata_ptr 1 0 100.00% 3 0 100.00% |
246 | fido_cred_authdata_len 1 0 100.00% 3 0 100.00% | 248 | fido_cred_authdata_len 1 0 100.00% 3 0 100.00% |
247 | fido_cred_pubkey_ptr 9 0 100.00% 20 0 100.00% | 249 | fido_cred_pubkey_ptr 9 2 77.78% 20 2 90.00% |
248 | fido_cred_pubkey_len 9 0 100.00% 20 0 100.00% | 250 | fido_cred_pubkey_len 9 2 77.78% 20 2 90.00% |
249 | fido_cred_id_ptr 1 0 100.00% 3 0 100.00% | 251 | fido_cred_id_ptr 1 0 100.00% 3 0 100.00% |
250 | fido_cred_id_len 1 0 100.00% 3 0 100.00% | 252 | fido_cred_id_len 1 0 100.00% 3 0 100.00% |
253 | fido_cred_prot 1 0 100.00% 3 0 100.00% | ||
251 | fido_cred_fmt 1 0 100.00% 3 0 100.00% | 254 | fido_cred_fmt 1 0 100.00% 3 0 100.00% |
252 | fido_cred_rp_id 1 0 100.00% 3 0 100.00% | 255 | fido_cred_rp_id 1 0 100.00% 3 0 100.00% |
253 | fido_cred_rp_name 1 0 100.00% 3 0 100.00% | 256 | fido_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 | |||
257 | fido_cred_user_id_len 1 0 100.00% 3 0 100.00% | 260 | fido_cred_user_id_len 1 0 100.00% 3 0 100.00% |
258 | cred.c:fido_dev_make_cred_wait 10 0 100.00% 9 0 100.00% | 261 | cred.c:fido_dev_make_cred_wait 10 0 100.00% 9 0 100.00% |
259 | cred.c:fido_dev_make_cred_tx 59 0 100.00% 81 0 100.00% | 262 | cred.c:fido_dev_make_cred_tx 59 0 100.00% 81 0 100.00% |
260 | cred.c:fido_dev_make_cred_rx 22 0 100.00% 28 0 100.00% | 263 | cred.c:fido_dev_make_cred_rx 21 0 100.00% 28 0 100.00% |
261 | cred.c:parse_makecred_reply 10 0 100.00% 23 0 100.00% | 264 | cred.c:parse_makecred_reply 10 0 100.00% 23 0 100.00% |
262 | cred.c:check_extensions 4 0 100.00% 9 0 100.00% | 265 | cred.c:check_extensions 1 0 100.00% 3 0 100.00% |
263 | cred.c:get_signed_hash_packed 23 1 95.65% 38 3 92.11% | ||
264 | cred.c:get_signed_hash_u2f 22 0 100.00% 20 0 100.00% | 266 | cred.c:get_signed_hash_u2f 22 0 100.00% 20 0 100.00% |
265 | cred.c:verify_sig 27 1 96.30% 40 4 90.00% | 267 | cred.c:verify_sig 27 2 92.59% 40 7 82.50% |
266 | cred.c:fido_cred_clean_authdata 1 0 100.00% 9 0 100.00% | 268 | cred.c:fido_cred_clean_authdata 1 0 100.00% 9 0 100.00% |
267 | cred.c:fido_cred_clean_x509 1 0 100.00% 5 0 100.00% | 269 | cred.c:fido_cred_clean_x509 1 0 100.00% 5 0 100.00% |
268 | cred.c:fido_cred_clean_sig 1 0 100.00% 5 0 100.00% | 270 | cred.c:fido_cred_clean_sig 1 0 100.00% 5 0 100.00% |
269 | --------------------------------------------------------------------------------------- | 271 | --------------------------------------------------------------------------------------- |
270 | TOTAL 532 35 93.42% 850 55 93.53% | 272 | TOTAL 534 51 90.45% 830 78 90.60% |
271 | 273 | ||
272 | File '/home/pedro/projects/libfido2/src/credman.c': | 274 | File '/libfido2/src/credman.c': |
273 | Name Regions Miss Cover Lines Miss Cover | 275 | Name Regions Miss Cover Lines Miss Cover |
274 | --------------------------------------------------------------------------------------- | 276 | --------------------------------------------------------------------------------------- |
275 | fido_credman_get_dev_metadata 9 2 77.78% 8 0 100.00% | 277 | fido_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 | |||
294 | credman.c:credman_get_metadata_wait 11 0 100.00% 9 0 100.00% | 296 | credman.c:credman_get_metadata_wait 11 0 100.00% 9 0 100.00% |
295 | credman.c:credman_tx 30 0 100.00% 53 0 100.00% | 297 | credman.c:credman_tx 30 0 100.00% 53 0 100.00% |
296 | credman.c:credman_prepare_hmac 21 1 95.24% 43 2 95.35% | 298 | credman.c:credman_prepare_hmac 21 1 95.24% 43 2 95.35% |
297 | credman.c:credman_rx_metadata 12 0 100.00% 21 0 100.00% | 299 | credman.c:credman_rx_metadata 11 0 100.00% 21 0 100.00% |
298 | credman.c:credman_parse_metadata 9 0 100.00% 19 0 100.00% | 300 | credman.c:credman_parse_metadata 9 0 100.00% 19 0 100.00% |
299 | credman.c:credman_get_rk_wait 27 0 100.00% 26 0 100.00% | 301 | credman.c:credman_get_rk_wait 27 0 100.00% 26 0 100.00% |
300 | credman.c:credman_rx_rk 20 0 100.00% 36 0 100.00% | 302 | credman.c:credman_rx_rk 19 0 100.00% 36 0 100.00% |
301 | credman.c:credman_parse_rk_count 16 0 100.00% 25 0 100.00% | 303 | credman.c:credman_parse_rk_count 16 0 100.00% 25 0 100.00% |
302 | credman.c:credman_grow_array 17 2 88.24% 28 5 82.14% | 304 | credman.c:credman_grow_array 17 2 88.24% 28 5 82.14% |
303 | credman.c:credman_parse_rk 13 0 100.00% 25 0 100.00% | 305 | credman.c:credman_parse_rk 13 0 100.00% 25 0 100.00% |
304 | credman.c:credman_rx_next_rk 16 2 87.50% 26 4 84.62% | 306 | credman.c:credman_rx_next_rk 15 2 86.67% 26 4 84.62% |
305 | credman.c:credman_del_rk_wait 16 0 100.00% 19 0 100.00% | 307 | credman.c:credman_del_rk_wait 16 0 100.00% 19 0 100.00% |
306 | credman.c:credman_get_rp_wait 23 0 100.00% 16 0 100.00% | 308 | credman.c:credman_get_rp_wait 23 0 100.00% 16 0 100.00% |
307 | credman.c:credman_rx_rp 20 0 100.00% 36 0 100.00% | 309 | credman.c:credman_rx_rp 19 0 100.00% 36 0 100.00% |
308 | credman.c:credman_parse_rp_count 16 0 100.00% 25 0 100.00% | 310 | credman.c:credman_parse_rp_count 16 0 100.00% 25 0 100.00% |
309 | credman.c:credman_parse_rp 9 0 100.00% 19 0 100.00% | 311 | credman.c:credman_parse_rp 9 0 100.00% 19 0 100.00% |
310 | credman.c:credman_rx_next_rp 16 2 87.50% 26 4 84.62% | 312 | credman.c:credman_rx_next_rp 15 2 86.67% 26 4 84.62% |
311 | credman.c:credman_reset_rk 4 0 100.00% 10 0 100.00% | 313 | credman.c:credman_reset_rk 4 0 100.00% 10 0 100.00% |
312 | credman.c:credman_reset_rp 4 0 100.00% 15 0 100.00% | 314 | credman.c:credman_reset_rp 4 0 100.00% 15 0 100.00% |
313 | --------------------------------------------------------------------------------------- | 315 | --------------------------------------------------------------------------------------- |
314 | TOTAL 381 18 95.28% 589 15 97.45% | 316 | TOTAL 376 18 95.21% 589 15 97.45% |
315 | 317 | ||
316 | File '/home/pedro/projects/libfido2/src/dev.c': | 318 | File '/libfido2/src/dev.c': |
317 | Name Regions Miss Cover Lines Miss Cover | 319 | Name Regions Miss Cover Lines Miss Cover |
318 | --------------------------------------------------------------------------------------- | 320 | --------------------------------------------------------------------------------------- |
321 | fido_dev_register_manifest_func 10 10 0.00% 18 18 0.00% | ||
322 | fido_dev_unregister_manifest_func 7 7 0.00% 13 13 0.00% | ||
323 | fido_dev_info_manifest 17 17 0.00% 24 24 0.00% | ||
324 | fido_dev_open_with_info 5 5 0.00% 6 6 0.00% | ||
319 | fido_dev_open 1 0 100.00% 3 0 100.00% | 325 | fido_dev_open 1 0 100.00% 3 0 100.00% |
320 | fido_dev_close 8 2 75.00% 9 0 100.00% | 326 | fido_dev_close 8 2 75.00% 9 0 100.00% |
321 | fido_dev_cancel 8 2 75.00% 6 3 50.00% | 327 | fido_dev_cancel 7 0 100.00% 6 0 100.00% |
322 | fido_dev_set_io_functions 18 4 77.78% 19 6 68.42% | 328 | fido_dev_set_io_functions 18 4 77.78% 16 6 62.50% |
329 | fido_dev_set_transport_functions 6 6 0.00% 10 10 0.00% | ||
323 | fido_init 7 1 85.71% 4 0 100.00% | 330 | fido_init 7 1 85.71% 4 0 100.00% |
324 | fido_dev_new 9 1 88.89% 22 4 81.82% | 331 | fido_dev_new 5 0 100.00% 16 0 100.00% |
325 | fido_dev_free 6 0 100.00% 10 0 100.00% | 332 | fido_dev_new_with_info 17 17 0.00% 26 26 0.00% |
333 | fido_dev_free 6 0 100.00% 11 0 100.00% | ||
326 | fido_dev_protocol 1 0 100.00% 3 0 100.00% | 334 | fido_dev_protocol 1 0 100.00% 3 0 100.00% |
327 | fido_dev_major 1 0 100.00% 3 0 100.00% | 335 | fido_dev_major 1 0 100.00% 3 0 100.00% |
328 | fido_dev_minor 1 0 100.00% 3 0 100.00% | 336 | fido_dev_minor 1 0 100.00% 3 0 100.00% |
@@ -331,14 +339,15 @@ fido_dev_flags 1 0 100.00% 3 0 | |||
331 | fido_dev_is_fido2 2 0 100.00% 3 0 100.00% | 339 | fido_dev_is_fido2 2 0 100.00% 3 0 100.00% |
332 | fido_dev_force_u2f 2 0 100.00% 3 0 100.00% | 340 | fido_dev_force_u2f 2 0 100.00% 3 0 100.00% |
333 | fido_dev_force_fido2 2 2 0.00% 3 3 0.00% | 341 | fido_dev_force_fido2 2 2 0.00% 3 3 0.00% |
342 | dev.c:find_manifest_func_node 5 5 0.00% 9 9 0.00% | ||
334 | dev.c:fido_dev_open_wait 10 0 100.00% 9 0 100.00% | 343 | dev.c:fido_dev_open_wait 10 0 100.00% 9 0 100.00% |
335 | dev.c:fido_dev_open_tx 26 8 69.23% 32 12 62.50% | 344 | dev.c:fido_dev_open_tx 25 8 68.00% 32 12 62.50% |
336 | dev.c:obtain_nonce 13 2 84.62% 18 2 88.89% | 345 | dev.c:obtain_nonce 4 1 75.00% 5 1 80.00% |
337 | dev.c:fido_dev_open_rx 14 0 100.00% 27 0 100.00% | 346 | dev.c:fido_dev_open_rx 32 0 100.00% 53 0 100.00% |
338 | --------------------------------------------------------------------------------------- | 347 | --------------------------------------------------------------------------------------- |
339 | TOTAL 131 22 83.21% 183 30 83.61% | 348 | TOTAL 201 85 57.71% 294 128 56.46% |
340 | 349 | ||
341 | File '/home/pedro/projects/libfido2/src/ecdh.c': | 350 | File '/libfido2/src/ecdh.c': |
342 | Name Regions Miss Cover Lines Miss Cover | 351 | Name Regions Miss Cover Lines Miss Cover |
343 | --------------------------------------------------------------------------------------- | 352 | --------------------------------------------------------------------------------------- |
344 | fido_do_ecdh 29 0 100.00% 44 0 100.00% | 353 | fido_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 | --------------------------------------------------------------------------------------- |
347 | TOTAL 68 0 100.00% 104 0 100.00% | 356 | TOTAL 68 0 100.00% 104 0 100.00% |
348 | 357 | ||
349 | File '/home/pedro/projects/libfido2/src/eddsa.c': | 358 | File '/libfido2/src/eddsa.c': |
350 | Name Regions Miss Cover Lines Miss Cover | 359 | Name Regions Miss Cover Lines Miss Cover |
351 | --------------------------------------------------------------------------------------- | 360 | --------------------------------------------------------------------------------------- |
352 | eddsa_pk_decode 8 0 100.00% 10 0 100.00% | 361 | eddsa_pk_decode 8 0 100.00% 10 0 100.00% |
@@ -354,20 +363,20 @@ eddsa_pk_new 1 0 100.00% 3 0 | |||
354 | eddsa_pk_free 6 0 100.00% 11 0 100.00% | 363 | eddsa_pk_free 6 0 100.00% 11 0 100.00% |
355 | eddsa_pk_from_ptr 6 0 100.00% 8 0 100.00% | 364 | eddsa_pk_from_ptr 6 0 100.00% 8 0 100.00% |
356 | eddsa_pk_to_EVP_PKEY 3 0 100.00% 9 0 100.00% | 365 | eddsa_pk_to_EVP_PKEY 3 0 100.00% 9 0 100.00% |
357 | eddsa_pk_from_EVP_PKEY 14 4 71.43% 12 2 83.33% | 366 | eddsa_pk_from_EVP_PKEY 14 0 100.00% 12 0 100.00% |
358 | eddsa.c:decode_pubkey_point 8 0 100.00% 14 0 100.00% | 367 | eddsa.c:decode_pubkey_point 8 0 100.00% 14 0 100.00% |
359 | eddsa.c:decode_coord 8 0 100.00% 12 0 100.00% | 368 | eddsa.c:decode_coord 8 0 100.00% 12 0 100.00% |
360 | --------------------------------------------------------------------------------------- | 369 | --------------------------------------------------------------------------------------- |
361 | TOTAL 54 4 92.59% 79 2 97.47% | 370 | TOTAL 54 0 100.00% 79 0 100.00% |
362 | 371 | ||
363 | File '/home/pedro/projects/libfido2/src/err.c': | 372 | File '/libfido2/src/err.c': |
364 | Name Regions Miss Cover Lines Miss Cover | 373 | Name Regions Miss Cover Lines Miss Cover |
365 | --------------------------------------------------------------------------------------- | 374 | --------------------------------------------------------------------------------------- |
366 | fido_strerr 108 108 0.00% 112 112 0.00% | 375 | fido_strerr 108 108 0.00% 112 112 0.00% |
367 | --------------------------------------------------------------------------------------- | 376 | --------------------------------------------------------------------------------------- |
368 | TOTAL 108 108 0.00% 112 112 0.00% | 377 | TOTAL 108 108 0.00% 112 112 0.00% |
369 | 378 | ||
370 | File '/home/pedro/projects/libfido2/src/es256.c': | 379 | File '/libfido2/src/es256.c': |
371 | Name Regions Miss Cover Lines Miss Cover | 380 | Name Regions Miss Cover Lines Miss Cover |
372 | --------------------------------------------------------------------------------------- | 381 | --------------------------------------------------------------------------------------- |
373 | es256_pk_decode 8 0 100.00% 10 0 100.00% | 382 | es256_pk_decode 8 0 100.00% 10 0 100.00% |
@@ -376,28 +385,28 @@ es256_sk_new 1 0 100.00% 3 0 | |||
376 | es256_sk_free 6 0 100.00% 11 0 100.00% | 385 | es256_sk_free 6 0 100.00% 11 0 100.00% |
377 | es256_pk_new 1 0 100.00% 3 0 100.00% | 386 | es256_pk_new 1 0 100.00% 3 0 100.00% |
378 | es256_pk_free 6 0 100.00% 11 0 100.00% | 387 | es256_pk_free 6 0 100.00% 11 0 100.00% |
379 | es256_pk_from_ptr 6 0 100.00% 8 0 100.00% | 388 | es256_pk_from_ptr 11 0 100.00% 13 0 100.00% |
380 | es256_pk_set_x 1 0 100.00% 5 0 100.00% | 389 | es256_pk_set_x 1 0 100.00% 5 0 100.00% |
381 | es256_pk_set_y 1 0 100.00% 5 0 100.00% | 390 | es256_pk_set_y 1 0 100.00% 5 0 100.00% |
382 | es256_sk_create 39 2 94.87% 46 6 86.96% | 391 | es256_sk_create 39 0 100.00% 46 0 100.00% |
383 | es256_pk_to_EVP_PKEY 41 0 100.00% 58 0 100.00% | 392 | es256_pk_to_EVP_PKEY 41 0 100.00% 58 0 100.00% |
384 | es256_pk_from_EC_KEY 38 2 94.74% 39 7 82.05% | 393 | es256_pk_from_EC_KEY 38 0 100.00% 39 0 100.00% |
385 | es256_sk_to_EVP_PKEY 27 0 100.00% 41 0 100.00% | 394 | es256_sk_to_EVP_PKEY 27 0 100.00% 41 0 100.00% |
386 | es256_derive_pk 25 0 100.00% 34 0 100.00% | 395 | es256_derive_pk 25 0 100.00% 34 0 100.00% |
387 | es256.c:decode_pubkey_point 9 0 100.00% 16 0 100.00% | 396 | es256.c:decode_pubkey_point 9 0 100.00% 16 0 100.00% |
388 | es256.c:decode_coord 8 0 100.00% 12 0 100.00% | 397 | es256.c:decode_coord 8 0 100.00% 12 0 100.00% |
389 | --------------------------------------------------------------------------------------- | 398 | --------------------------------------------------------------------------------------- |
390 | TOTAL 273 4 98.53% 372 13 96.51% | 399 | TOTAL 278 0 100.00% 377 0 100.00% |
391 | 400 | ||
392 | File '/home/pedro/projects/libfido2/src/extern.h': | 401 | File '/libfido2/src/extern.h': |
393 | Name Regions Miss Cover Lines Miss Cover | 402 | Name Regions Miss Cover Lines Miss Cover |
394 | --------------------------------------------------------------------------------------- | 403 | --------------------------------------------------------------------------------------- |
395 | 404 | ||
396 | File '/home/pedro/projects/libfido2/src/fido.h': | 405 | File '/libfido2/src/fido.h': |
397 | Name Regions Miss Cover Lines Miss Cover | 406 | Name Regions Miss Cover Lines Miss Cover |
398 | --------------------------------------------------------------------------------------- | 407 | --------------------------------------------------------------------------------------- |
399 | 408 | ||
400 | File '/home/pedro/projects/libfido2/src/hid.c': | 409 | File '/libfido2/src/hid.c': |
401 | Name Regions Miss Cover Lines Miss Cover | 410 | Name Regions Miss Cover Lines Miss Cover |
402 | --------------------------------------------------------------------------------------- | 411 | --------------------------------------------------------------------------------------- |
403 | fido_dev_info_new 1 1 0.00% 3 3 0.00% | 412 | fido_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 | --------------------------------------------------------------------------------------- |
412 | TOTAL 16 16 0.00% 38 38 0.00% | 421 | TOTAL 16 16 0.00% 38 38 0.00% |
413 | 422 | ||
414 | File '/home/pedro/projects/libfido2/src/hid_linux.c': | 423 | File '/libfido2/src/hid_linux.c': |
415 | Name Regions Miss Cover Lines Miss Cover | 424 | Name Regions Miss Cover Lines Miss Cover |
416 | --------------------------------------------------------------------------------------- | 425 | --------------------------------------------------------------------------------------- |
417 | fido_dev_info_manifest 33 33 0.00% 40 40 0.00% | 426 | fido_hid_manifest 33 33 0.00% 46 46 0.00% |
418 | fido_hid_open 6 6 0.00% 11 11 0.00% | 427 | fido_hid_open 6 6 0.00% 11 11 0.00% |
419 | fido_hid_close 1 1 0.00% 6 6 0.00% | 428 | fido_hid_close 1 1 0.00% 6 6 0.00% |
420 | fido_hid_read 12 12 0.00% 16 16 0.00% | 429 | fido_hid_read 12 12 0.00% 16 16 0.00% |
421 | fido_hid_write 12 12 0.00% 16 16 0.00% | 430 | fido_hid_write 12 12 0.00% 16 16 0.00% |
422 | hid_linux.c:copy_info 35 35 0.00% 56 56 0.00% | 431 | hid_linux.c:copy_info 35 35 0.00% 56 56 0.00% |
423 | hid_linux.c:is_fido 6 6 0.00% 14 14 0.00% | 432 | hid_linux.c:is_fido 6 6 0.00% 14 14 0.00% |
424 | hid_linux.c:get_report_descriptor 17 17 0.00% 31 31 0.00% | 433 | hid_linux.c:get_report_descriptor 17 17 0.00% 30 30 0.00% |
425 | hid_linux.c:get_usage_info 16 16 0.00% 33 33 0.00% | 434 | hid_linux.c:get_usage_info 16 16 0.00% 33 33 0.00% |
426 | hid_linux.c:get_key_len 6 6 0.00% 14 14 0.00% | 435 | hid_linux.c:get_key_len 6 6 0.00% 14 14 0.00% |
427 | hid_linux.c:get_key_val 6 6 0.00% 20 20 0.00% | 436 | hid_linux.c:get_key_val 6 6 0.00% 20 20 0.00% |
428 | hid_linux.c:parse_uevent 16 16 0.00% 30 30 0.00% | 437 | hid_linux.c:parse_uevent 16 16 0.00% 30 30 0.00% |
429 | --------------------------------------------------------------------------------------- | 438 | --------------------------------------------------------------------------------------- |
430 | TOTAL 166 166 0.00% 287 287 0.00% | 439 | TOTAL 166 166 0.00% 292 292 0.00% |
431 | 440 | ||
432 | File '/home/pedro/projects/libfido2/src/info.c': | 441 | File '/libfido2/src/info.c': |
433 | Name Regions Miss Cover Lines Miss Cover | 442 | Name Regions Miss Cover Lines Miss Cover |
434 | --------------------------------------------------------------------------------------- | 443 | --------------------------------------------------------------------------------------- |
444 | fido_dev_get_cbor_info_wait 10 0 100.00% 9 0 100.00% | ||
435 | fido_dev_get_cbor_info 1 0 100.00% 3 0 100.00% | 445 | fido_dev_get_cbor_info 1 0 100.00% 3 0 100.00% |
436 | fido_cbor_info_new 1 0 100.00% 3 0 100.00% | 446 | fido_cbor_info_new 1 0 100.00% 3 0 100.00% |
437 | fido_cbor_info_free 6 1 83.33% 14 0 100.00% | 447 | fido_cbor_info_free 6 0 100.00% 14 0 100.00% |
438 | fido_cbor_info_versions_ptr 1 0 100.00% 3 0 100.00% | 448 | fido_cbor_info_versions_ptr 1 0 100.00% 3 0 100.00% |
439 | fido_cbor_info_versions_len 1 0 100.00% 3 0 100.00% | 449 | fido_cbor_info_versions_len 1 0 100.00% 3 0 100.00% |
440 | fido_cbor_info_extensions_ptr 1 0 100.00% 3 0 100.00% | 450 | fido_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 | |||
447 | fido_cbor_info_maxmsgsiz 1 0 100.00% 3 0 100.00% | 457 | fido_cbor_info_maxmsgsiz 1 0 100.00% 3 0 100.00% |
448 | fido_cbor_info_protocols_ptr 1 0 100.00% 3 0 100.00% | 458 | fido_cbor_info_protocols_ptr 1 0 100.00% 3 0 100.00% |
449 | fido_cbor_info_protocols_len 1 0 100.00% 3 0 100.00% | 459 | fido_cbor_info_protocols_len 1 0 100.00% 3 0 100.00% |
450 | info.c:fido_dev_get_cbor_info_wait 10 0 100.00% 9 0 100.00% | 460 | info.c:fido_dev_get_cbor_info_tx 8 0 100.00% 12 0 100.00% |
451 | info.c:fido_dev_get_cbor_info_tx 9 0 100.00% 13 0 100.00% | 461 | info.c:fido_dev_get_cbor_info_rx 6 0 100.00% 18 0 100.00% |
452 | info.c:fido_dev_get_cbor_info_rx 7 0 100.00% 18 0 100.00% | ||
453 | info.c:parse_reply_element 13 0 100.00% 27 0 100.00% | 462 | info.c:parse_reply_element 13 0 100.00% 27 0 100.00% |
454 | info.c:decode_versions 12 0 100.00% 21 0 100.00% | 463 | info.c:decode_versions 12 0 100.00% 21 0 100.00% |
455 | info.c:decode_version 4 0 100.00% 14 0 100.00% | 464 | info.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 | |||
464 | info.c:free_opt_array 4 0 100.00% 9 0 100.00% | 473 | info.c:free_opt_array 4 0 100.00% 9 0 100.00% |
465 | info.c:free_byte_array 1 0 100.00% 6 0 100.00% | 474 | info.c:free_byte_array 1 0 100.00% 6 0 100.00% |
466 | --------------------------------------------------------------------------------------- | 475 | --------------------------------------------------------------------------------------- |
467 | TOTAL 148 1 99.32% 305 0 100.00% | 476 | TOTAL 146 0 100.00% 304 0 100.00% |
468 | 477 | ||
469 | File '/home/pedro/projects/libfido2/src/io.c': | 478 | File '/libfido2/src/io.c': |
470 | Name Regions Miss Cover Lines Miss Cover | 479 | Name Regions Miss Cover Lines Miss Cover |
471 | --------------------------------------------------------------------------------------- | 480 | --------------------------------------------------------------------------------------- |
472 | fido_tx 18 0 100.00% 35 0 100.00% | 481 | fido_tx 14 1 92.86% 18 0 100.00% |
473 | fido_rx 34 3 91.18% 84 12 85.71% | 482 | fido_rx 13 2 84.62% 21 3 85.71% |
474 | fido_rx_cbor_status 9 0 100.00% 13 0 100.00% | 483 | fido_rx_cbor_status 8 0 100.00% 12 0 100.00% |
475 | io.c:tx_preamble 16 1 93.75% 24 1 95.83% | 484 | io.c:tx_empty 7 0 100.00% 16 0 100.00% |
476 | io.c:tx_frame 16 1 93.75% 21 0 100.00% | 485 | io.c:tx 13 0 100.00% 21 0 100.00% |
477 | io.c:rx_preamble 11 0 100.00% 12 0 100.00% | 486 | io.c:tx_preamble 10 0 100.00% 20 0 100.00% |
478 | io.c:rx_frame 9 1 88.89% 12 0 100.00% | 487 | io.c:tx_frame 9 0 100.00% 18 0 100.00% |
479 | --------------------------------------------------------------------------------------- | 488 | io.c:rx 25 1 96.00% 58 4 93.10% |
480 | TOTAL 113 6 94.69% 201 13 93.53% | 489 | io.c:rx_preamble 18 1 94.44% 25 4 84.00% |
490 | io.c:rx_frame 6 0 100.00% 9 0 100.00% | ||
491 | --------------------------------------------------------------------------------------- | ||
492 | TOTAL 123 5 95.93% 218 11 94.95% | ||
481 | 493 | ||
482 | File '/home/pedro/projects/libfido2/src/iso7816.c': | 494 | File '/libfido2/src/iso7816.c': |
483 | Name Regions Miss Cover Lines Miss Cover | 495 | Name Regions Miss Cover Lines Miss Cover |
484 | --------------------------------------------------------------------------------------- | 496 | --------------------------------------------------------------------------------------- |
485 | iso7816_new 4 0 100.00% 19 0 100.00% | 497 | iso7816_new 4 0 100.00% 19 0 100.00% |
@@ -490,25 +502,27 @@ iso7816_len 1 0 100.00% 4 0 | |||
490 | --------------------------------------------------------------------------------------- | 502 | --------------------------------------------------------------------------------------- |
491 | TOTAL 18 1 94.44% 47 0 100.00% | 503 | TOTAL 18 1 94.44% 47 0 100.00% |
492 | 504 | ||
493 | File '/home/pedro/projects/libfido2/src/log.c': | 505 | File '/libfido2/src/log.c': |
494 | Name Regions Miss Cover Lines Miss Cover | 506 | Name Regions Miss Cover Lines Miss Cover |
495 | --------------------------------------------------------------------------------------- | 507 | --------------------------------------------------------------------------------------- |
496 | fido_log_init 1 1 0.00% 3 3 0.00% | 508 | fido_log_init 1 0 100.00% 4 0 100.00% |
497 | fido_log_xxd 11 8 27.27% 18 12 33.33% | 509 | fido_log_debug 11 1 90.91% 16 0 100.00% |
498 | fido_log_debug 4 1 75.00% 13 8 38.46% | 510 | fido_log_xxd 18 0 100.00% 23 0 100.00% |
511 | fido_set_log_handler 3 0 100.00% 4 0 100.00% | ||
512 | log.c:log_on_stderr 1 1 0.00% 3 3 0.00% | ||
499 | --------------------------------------------------------------------------------------- | 513 | --------------------------------------------------------------------------------------- |
500 | TOTAL 16 10 37.50% 34 23 32.35% | 514 | TOTAL 34 2 94.12% 50 3 94.00% |
501 | 515 | ||
502 | File '/home/pedro/projects/libfido2/src/pin.c': | 516 | File '/libfido2/src/pin.c': |
503 | Name Regions Miss Cover Lines Miss Cover | 517 | Name Regions Miss Cover Lines Miss Cover |
504 | --------------------------------------------------------------------------------------- | 518 | --------------------------------------------------------------------------------------- |
505 | fido_dev_get_pin_token 1 0 100.00% 3 0 100.00% | 519 | fido_dev_get_pin_token 1 0 100.00% 3 0 100.00% |
506 | fido_dev_set_pin 1 0 100.00% 3 0 100.00% | 520 | fido_dev_set_pin 1 0 100.00% 3 0 100.00% |
507 | fido_dev_get_retry_count 1 0 100.00% 3 0 100.00% | 521 | fido_dev_get_retry_count 1 0 100.00% 3 0 100.00% |
508 | cbor_add_pin_params 17 0 100.00% 27 0 100.00% | 522 | cbor_add_pin_params 17 0 100.00% 27 0 100.00% |
509 | pin.c:fido_dev_get_pin_token_wait 10 0 100.00% 9 0 100.00% | 523 | pin.c:fido_dev_get_pin_token_wait 10 0 100.00% 10 0 100.00% |
510 | pin.c:fido_dev_get_pin_token_tx 29 0 100.00% 40 0 100.00% | 524 | pin.c:fido_dev_get_pin_token_tx 29 0 100.00% 40 0 100.00% |
511 | pin.c:fido_dev_get_pin_token_rx 21 0 100.00% 36 0 100.00% | 525 | pin.c:fido_dev_get_pin_token_rx 20 0 100.00% 36 0 100.00% |
512 | pin.c:parse_pintoken 8 0 100.00% 12 0 100.00% | 526 | pin.c:parse_pintoken 8 0 100.00% 12 0 100.00% |
513 | pin.c:fido_dev_set_pin_wait 16 0 100.00% 22 0 100.00% | 527 | pin.c:fido_dev_set_pin_wait 16 0 100.00% 22 0 100.00% |
514 | pin.c:fido_dev_change_pin_tx 41 0 100.00% 59 0 100.00% | 528 | pin.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 | |||
516 | pin.c:fido_dev_set_pin_tx 33 0 100.00% 48 0 100.00% | 530 | pin.c:fido_dev_set_pin_tx 33 0 100.00% 48 0 100.00% |
517 | pin.c:fido_dev_get_retry_count_wait 10 0 100.00% 9 0 100.00% | 531 | pin.c:fido_dev_get_retry_count_wait 10 0 100.00% 9 0 100.00% |
518 | pin.c:fido_dev_get_retry_count_tx 19 0 100.00% 28 0 100.00% | 532 | pin.c:fido_dev_get_retry_count_tx 19 0 100.00% 28 0 100.00% |
519 | pin.c:fido_dev_get_retry_count_rx 12 0 100.00% 21 0 100.00% | 533 | pin.c:fido_dev_get_retry_count_rx 11 0 100.00% 21 0 100.00% |
520 | pin.c:parse_retry_count 13 0 100.00% 20 0 100.00% | 534 | pin.c:parse_retry_count 13 0 100.00% 20 0 100.00% |
521 | --------------------------------------------------------------------------------------- | 535 | --------------------------------------------------------------------------------------- |
522 | TOTAL 250 0 100.00% 364 0 100.00% | 536 | TOTAL 248 0 100.00% 365 0 100.00% |
523 | 537 | ||
524 | File '/home/pedro/projects/libfido2/src/reset.c': | 538 | File '/libfido2/src/reset.c': |
525 | Name Regions Miss Cover Lines Miss Cover | 539 | Name Regions Miss Cover Lines Miss Cover |
526 | --------------------------------------------------------------------------------------- | 540 | --------------------------------------------------------------------------------------- |
527 | fido_dev_reset 1 0 100.00% 3 0 100.00% | 541 | fido_dev_reset 1 0 100.00% 3 0 100.00% |
528 | reset.c:fido_dev_reset_wait 10 0 100.00% 9 0 100.00% | 542 | reset.c:fido_dev_reset_wait 10 0 100.00% 9 0 100.00% |
529 | reset.c:fido_dev_reset_tx 9 0 100.00% 11 0 100.00% | 543 | reset.c:fido_dev_reset_tx 8 0 100.00% 10 0 100.00% |
530 | --------------------------------------------------------------------------------------- | 544 | --------------------------------------------------------------------------------------- |
531 | TOTAL 20 0 100.00% 23 0 100.00% | 545 | TOTAL 19 0 100.00% 22 0 100.00% |
532 | 546 | ||
533 | File '/home/pedro/projects/libfido2/src/rs256.c': | 547 | File '/libfido2/src/rs256.c': |
534 | Name Regions Miss Cover Lines Miss Cover | 548 | Name Regions Miss Cover Lines Miss Cover |
535 | --------------------------------------------------------------------------------------- | 549 | --------------------------------------------------------------------------------------- |
536 | rs256_pk_decode 8 0 100.00% 10 0 100.00% | 550 | rs256_pk_decode 8 8 0.00% 10 10 0.00% |
537 | rs256_pk_new 1 0 100.00% 3 0 100.00% | 551 | rs256_pk_new 1 0 100.00% 3 0 100.00% |
538 | rs256_pk_free 6 0 100.00% 11 0 100.00% | 552 | rs256_pk_free 6 0 100.00% 11 0 100.00% |
539 | rs256_pk_from_ptr 6 0 100.00% 8 0 100.00% | 553 | rs256_pk_from_ptr 6 0 100.00% 8 0 100.00% |
540 | rs256_pk_to_EVP_PKEY 32 0 100.00% 48 0 100.00% | 554 | rs256_pk_to_EVP_PKEY 32 0 100.00% 48 0 100.00% |
541 | rs256_pk_from_RSA 32 6 81.25% 32 9 71.88% | 555 | rs256_pk_from_RSA 32 4 87.50% 32 6 81.25% |
542 | rs256.c:decode_rsa_pubkey 9 0 100.00% 16 0 100.00% | 556 | rs256.c:decode_rsa_pubkey 9 9 0.00% 16 16 0.00% |
543 | rs256.c:decode_bignum 8 0 100.00% 12 0 100.00% | 557 | rs256.c:decode_bignum 8 8 0.00% 12 12 0.00% |
544 | --------------------------------------------------------------------------------------- | 558 | --------------------------------------------------------------------------------------- |
545 | TOTAL 102 6 94.12% 140 9 93.57% | 559 | TOTAL 102 29 71.57% 140 44 68.57% |
546 | 560 | ||
547 | File '/home/pedro/projects/libfido2/src/u2f.c': | 561 | File '/libfido2/src/u2f.c': |
548 | Name Regions Miss Cover Lines Miss Cover | 562 | Name Regions Miss Cover Lines Miss Cover |
549 | --------------------------------------------------------------------------------------- | 563 | --------------------------------------------------------------------------------------- |
550 | u2f_register 70 1 98.57% 89 0 100.00% | 564 | u2f_register 70 5 92.86% 88 7 92.05% |
551 | u2f_authenticate 27 0 100.00% 33 0 100.00% | 565 | u2f_authenticate 32 4 87.50% 44 2 95.45% |
552 | u2f.c:key_lookup 44 0 100.00% 69 0 100.00% | 566 | u2f.c:key_lookup 44 0 100.00% 69 0 100.00% |
553 | u2f.c:send_dummy_register 31 1 96.77% 50 0 100.00% | 567 | u2f.c:send_dummy_register 31 5 83.87% 49 8 83.67% |
554 | u2f.c:parse_register_reply 57 0 100.00% 83 0 100.00% | 568 | u2f.c:parse_register_reply 57 0 100.00% 83 0 100.00% |
555 | u2f.c:x5c_get 21 1 95.24% 37 3 91.89% | 569 | u2f.c:x5c_get 21 2 90.48% 37 6 83.78% |
556 | u2f.c:sig_get 8 1 87.50% 16 6 62.50% | 570 | u2f.c:sig_get 8 1 87.50% 16 6 62.50% |
557 | u2f.c:encode_cred_authdata 37 2 94.59% 82 6 92.68% | 571 | u2f.c:encode_cred_authdata 37 3 91.89% 82 9 89.02% |
558 | u2f.c:cbor_blob_from_ec_point 22 0 100.00% 39 0 100.00% | 572 | u2f.c:cbor_blob_from_ec_point 22 1 95.45% 39 3 92.31% |
559 | u2f.c:u2f_authenticate_single 34 2 94.12% 53 4 92.45% | 573 | u2f.c:u2f_authenticate_single 36 2 94.44% 58 4 93.10% |
560 | u2f.c:do_auth 50 1 98.00% 72 0 100.00% | 574 | u2f.c:do_auth 50 3 94.00% 71 4 94.37% |
561 | u2f.c:parse_auth_reply 23 2 91.30% 29 3 89.66% | 575 | u2f.c:parse_auth_reply 23 2 91.30% 29 3 89.66% |
562 | u2f.c:authdata_fake 12 0 100.00% 34 0 100.00% | 576 | u2f.c:authdata_fake 12 0 100.00% 34 0 100.00% |
563 | --------------------------------------------------------------------------------------- | 577 | --------------------------------------------------------------------------------------- |
564 | TOTAL 436 11 97.48% 686 22 96.79% | 578 | TOTAL 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. */ | ||
58 | static const char dummy_rp_id[] = "localhost"; | ||
59 | static const char dummy_pin[] = "9}4gT:8d=A37Dh}U"; | ||
60 | |||
61 | static 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 | |||
68 | static 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 | |||
79 | static 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 | |||
115 | static 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 | */ |
126 | static const uint8_t dummy_wire_data_fido[] = { | 65 | static 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 | */ |
197 | static const uint8_t dummy_wire_data_u2f[] = { | 77 | static 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 | ||
296 | int LLVMFuzzerTestOneInput(const uint8_t *, size_t); | 86 | int 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 | ||
139 | static size_t | ||
140 | input_len(int max) | ||
141 | { | ||
142 | return (5 * len_byte() + 2 * len_int() + 2 * len_string(max) + | ||
143 | 6 * len_blob(max)); | ||
144 | } | ||
145 | |||
349 | static void | 146 | static void |
350 | get_assert(fido_assert_t *assert, uint8_t u2f, const struct blob *cdh, | 147 | get_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. */ | ||
43 | static const uint8_t dummy_id[] = { 0x5e, 0xd2, }; | ||
44 | static const char dummy_pin[] = "3Q;I){TAx"; | ||
45 | static 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 | */ |
51 | static const uint8_t dummy_info_wire_data[] = { | 49 | static 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 | */ |
74 | static const uint8_t dummy_enroll_wire_data[] = { | 59 | static 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 | */ |
296 | static const uint8_t dummy_list_wire_data[] = { | 71 | static 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 | */ |
343 | static const uint8_t dummy_set_name_wire_data[] = { | 83 | static 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 | */ |
390 | static const uint8_t dummy_remove_wire_data[] = { | 95 | static 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 | ||
433 | int LLVMFuzzerTestOneInput(const uint8_t *, size_t); | 103 | int 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 | ||
144 | static size_t | ||
145 | input_len(int max) | ||
146 | { | ||
147 | return (2 * len_string(max) + len_int() + 6 * len_blob(max)); | ||
148 | } | ||
149 | |||
474 | static fido_dev_t * | 150 | static fido_dev_t * |
475 | prepare_dev() | 151 | prepare_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. */ | ||
58 | static const char dummy_rp_id[] = "localhost"; | ||
59 | static const char dummy_rp_name[] = "sweet home localhost"; | ||
60 | static const char dummy_pin[] = "9}4gT:8d=A37Dh}U"; | ||
61 | static const char dummy_user_icon[] = "an icon"; | ||
62 | static const char dummy_user_name[] = "john smith"; | ||
63 | static const char dummy_user_nick[] = "jsmith"; | ||
64 | |||
65 | static 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 | |||
72 | static 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 | */ |
83 | static const uint8_t dummy_wire_data_fido[] = { | 64 | static 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 | */ |
338 | static const uint8_t dummy_wire_data_u2f[] = { | 79 | static 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 | ||
629 | int LLVMFuzzerTestOneInput(const uint8_t *, size_t); | 89 | int 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 | ||
146 | static size_t | ||
147 | input_len(int max) | ||
148 | { | ||
149 | return (5 * len_byte() + 6 * len_string(max) + 2 * len_int() + | ||
150 | 4 * len_blob(max)); | ||
151 | } | ||
152 | |||
686 | static void | 153 | static void |
687 | make_cred(fido_cred_t *cred, uint8_t u2f, int type, const struct blob *cdh, | 154 | make_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. */ | ||
41 | static 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 | }; | ||
45 | static const char dummy_pin[] = "[n#899:~m"; | ||
46 | static 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 | */ |
52 | static const uint8_t dummy_meta_wire_data[] = { | 47 | static 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 | */ |
99 | static const uint8_t dummy_rp_wire_data[] = { | 59 | static 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 | */ |
162 | static const uint8_t dummy_rk_wire_data[] = { | 71 | static 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 | */ |
345 | static const uint8_t dummy_del_wire_data[] = { | 83 | static 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 | ||
388 | int LLVMFuzzerTestOneInput(const uint8_t *, size_t); | 91 | int 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 | ||
130 | static size_t | ||
131 | input_len(int max) | ||
132 | { | ||
133 | return (2 * len_string(max) + 5 * len_blob(max) + len_int()); | ||
134 | } | ||
135 | |||
427 | static fido_dev_t * | 136 | static fido_dev_t * |
428 | prepare_dev() | 137 | prepare_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. */ | ||
39 | static const char dummy_pin1[] = "skepp cg0u3;Y.."; | ||
40 | static const char dummy_pin2[] = "bastilha 6rJrfQZI."; | ||
41 | |||
42 | static const uint8_t dummy_reset_wire_data[] = { | 40 | static 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 | ||
109 | static const uint8_t dummy_info_wire_data[] = { | 49 | static 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 | ||
152 | static const uint8_t dummy_set_pin_wire_data[] = { | 55 | static 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 | ||
187 | static const uint8_t dummy_change_pin_wire_data[] = { | 62 | static 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 | ||
222 | static const uint8_t dummy_retry_wire_data[] = { | 69 | static 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 | ||
241 | int LLVMFuzzerTestOneInput(const uint8_t *, size_t); | 75 | int 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 | ||
114 | static size_t | ||
115 | input_len(int max) | ||
116 | { | ||
117 | return (2 * len_string(max) + 5 * len_blob(max) + len_int()); | ||
118 | } | ||
119 | |||
280 | static fido_dev_t * | 120 | static fido_dev_t * |
281 | prepare_dev() | 121 | prepare_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 | ||
217 | out: | ||
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 | |||
6 | T=assert | ||
7 | |||
8 | sync() { | ||
9 | mkdir ${T} | ||
10 | ssh "${REMOTE}" "cd ${T}/afl-out && tar -cf- queue ../pubkey" | \ | ||
11 | tar -C ${T} -xf- | ||
12 | } | ||
13 | |||
14 | run() { | ||
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 | |||
21 | case "$1" in | ||
22 | sync) | ||
23 | sync | ||
24 | ;; | ||
25 | run) | ||
26 | run | ||
27 | exit 0 | ||
28 | ;; | ||
29 | *) | ||
30 | echo unknown command "$1" | ||
31 | exit 1 | ||
32 | esac | ||
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 | |||
6 | T=assert-rsa-h-p | ||
7 | |||
8 | sync() { | ||
9 | mkdir ${T} | ||
10 | ssh "${REMOTE}" "cd ${T}/afl-out && tar -cf- queue ../pubkey ../hmac-salt" | \ | ||
11 | tar -C ${T} -xf- | ||
12 | } | ||
13 | |||
14 | run() { | ||
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 | |||
22 | case "$1" in | ||
23 | sync) | ||
24 | sync | ||
25 | ;; | ||
26 | run) | ||
27 | run | ||
28 | exit 0 | ||
29 | ;; | ||
30 | *) | ||
31 | echo unknown command "$1" | ||
32 | exit 1 | ||
33 | esac | ||
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 | |||
6 | T=assert-u2f | ||
7 | |||
8 | sync() { | ||
9 | mkdir ${T} | ||
10 | ssh "${REMOTE}" "cd ${T}/afl-out && tar -cf- queue ../cred_id ../pubkey" | \ | ||
11 | tar -C ${T} -xf- | ||
12 | } | ||
13 | |||
14 | run() { | ||
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 | |||
21 | case "$1" in | ||
22 | sync) | ||
23 | sync | ||
24 | ;; | ||
25 | run) | ||
26 | run | ||
27 | exit 0 | ||
28 | ;; | ||
29 | *) | ||
30 | echo unknown command "$1" | ||
31 | exit 1 | ||
32 | esac | ||
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 | |||
6 | T=cred | ||
7 | |||
8 | sync() { | ||
9 | mkdir ${T} | ||
10 | ssh "${REMOTE}" "cd ${T}/afl-out && tar -cf- queue" | tar -C ${T} -xf- | ||
11 | } | ||
12 | |||
13 | run() { | ||
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 | |||
20 | case "$1" in | ||
21 | sync) | ||
22 | sync | ||
23 | ;; | ||
24 | run) | ||
25 | run | ||
26 | exit 0 | ||
27 | ;; | ||
28 | *) | ||
29 | echo unknown command "$1" | ||
30 | exit 1 | ||
31 | esac | ||
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 | |||
6 | T=cred-rsa-h-p | ||
7 | |||
8 | sync() { | ||
9 | mkdir ${T} | ||
10 | ssh "${REMOTE}" "cd ${T}/afl-out && tar -cf- queue" | tar -C ${T} -xf- | ||
11 | } | ||
12 | |||
13 | run() { | ||
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 | |||
21 | case "$1" in | ||
22 | sync) | ||
23 | sync | ||
24 | ;; | ||
25 | run) | ||
26 | run | ||
27 | exit 0 | ||
28 | ;; | ||
29 | *) | ||
30 | echo unknown command "$1" | ||
31 | exit 1 | ||
32 | esac | ||
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 | |||
6 | T=cred-u2f | ||
7 | |||
8 | sync() { | ||
9 | mkdir ${T} | ||
10 | ssh "${REMOTE}" "cd ${T}/afl-out && tar -cf- queue" | tar -C ${T} -xf- | ||
11 | } | ||
12 | |||
13 | run() { | ||
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 | |||
20 | case "$1" in | ||
21 | sync) | ||
22 | sync | ||
23 | ;; | ||
24 | run) | ||
25 | run | ||
26 | exit 0 | ||
27 | ;; | ||
28 | *) | ||
29 | echo unknown command "$1" | ||
30 | exit 1 | ||
31 | esac | ||
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 | |||
6 | T=cred-u2f-exclude | ||
7 | |||
8 | sync() { | ||
9 | mkdir ${T} | ||
10 | ssh "${REMOTE}" "cd ${T}/afl-out && tar -cf- queue ../excl_id" | \ | ||
11 | tar -C ${T} -xf- | ||
12 | } | ||
13 | |||
14 | run() { | ||
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 | |||
22 | case "$1" in | ||
23 | sync) | ||
24 | sync | ||
25 | ;; | ||
26 | run) | ||
27 | run | ||
28 | exit 0 | ||
29 | ;; | ||
30 | *) | ||
31 | echo unknown command "$1" | ||
32 | exit 1 | ||
33 | esac | ||
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 | |||
6 | T=fido2-assert-G | ||
7 | |||
8 | sync() { | ||
9 | mkdir ${T} | ||
10 | ssh "${REMOTE}" "cd ${T}/afl-out && tar -cf- queue" | tar -C ${T} -xf- | ||
11 | } | ||
12 | |||
13 | run() { | ||
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 | |||
20 | case "$1" in | ||
21 | sync) | ||
22 | sync | ||
23 | ;; | ||
24 | run) | ||
25 | run | ||
26 | exit 0 | ||
27 | ;; | ||
28 | *) | ||
29 | echo unknown command "$1" | ||
30 | exit 1 | ||
31 | esac | ||
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 | |||
6 | T=fido2-assert-V | ||
7 | |||
8 | sync() { | ||
9 | mkdir ${T} | ||
10 | ssh "${REMOTE}" "cd ${T}/afl-out && tar -cf- queue ../pubkey" | \ | ||
11 | tar -C ${T} -xf- | ||
12 | } | ||
13 | |||
14 | run() { | ||
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 | |||
21 | case "$1" in | ||
22 | sync) | ||
23 | sync | ||
24 | ;; | ||
25 | run) | ||
26 | run | ||
27 | exit 0 | ||
28 | ;; | ||
29 | *) | ||
30 | echo unknown command "$1" | ||
31 | exit 1 | ||
32 | esac | ||
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 | |||
6 | T=fido2-cred-M | ||
7 | |||
8 | sync() { | ||
9 | mkdir ${T} | ||
10 | ssh "${REMOTE}" "cd ${T}/afl-out && tar -cf- queue" | tar -C ${T} -xf- | ||
11 | } | ||
12 | |||
13 | run() { | ||
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 | |||
20 | case "$1" in | ||
21 | sync) | ||
22 | sync | ||
23 | ;; | ||
24 | run) | ||
25 | run | ||
26 | exit 0 | ||
27 | ;; | ||
28 | *) | ||
29 | echo unknown command "$1" | ||
30 | exit 1 | ||
31 | esac | ||
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 | |||
6 | T=fido2-cred-V | ||
7 | |||
8 | sync() { | ||
9 | mkdir ${T} | ||
10 | ssh "${REMOTE}" "cd ${T}/afl-out && tar -cf- queue" | tar -C ${T} -xf- | ||
11 | } | ||
12 | |||
13 | run() { | ||
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 | |||
20 | case "$1" in | ||
21 | sync) | ||
22 | sync | ||
23 | ;; | ||
24 | run) | ||
25 | run | ||
26 | exit 0 | ||
27 | ;; | ||
28 | *) | ||
29 | echo unknown command "$1" | ||
30 | exit 1 | ||
31 | esac | ||
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 | |||
6 | T=fuzz_assert | ||
7 | |||
8 | sync() { | ||
9 | mkdir ${T} | ||
10 | ssh "${REMOTE}" "cd ${T} && tar -cf- corpus" | tar -C ${T} -xf- | ||
11 | } | ||
12 | |||
13 | run() { | ||
14 | build/fuzz/fuzz_assert -max_len=17408 -runs=1 ${T}/corpus \ | ||
15 | 2>/dev/null 1>&2 | ||
16 | } | ||
17 | |||
18 | case "$1" in | ||
19 | sync) | ||
20 | sync | ||
21 | ;; | ||
22 | run) | ||
23 | run | ||
24 | exit 0 | ||
25 | ;; | ||
26 | *) | ||
27 | echo unknown command "$1" | ||
28 | exit 1 | ||
29 | esac | ||
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 | |||
6 | T=fuzz_bio | ||
7 | |||
8 | sync() { | ||
9 | mkdir ${T} | ||
10 | ssh "${REMOTE}" "cd ${T} && tar -cf- corpus" | tar -C ${T} -xf- | ||
11 | } | ||
12 | |||
13 | run() { | ||
14 | build/fuzz/fuzz_bio -max_len=17408 -runs=1 ${T}/corpus \ | ||
15 | 2>/dev/null 1>&2 | ||
16 | } | ||
17 | |||
18 | case "$1" in | ||
19 | sync) | ||
20 | sync | ||
21 | ;; | ||
22 | run) | ||
23 | run | ||
24 | exit 0 | ||
25 | ;; | ||
26 | *) | ||
27 | echo unknown command "$1" | ||
28 | exit 1 | ||
29 | esac | ||
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 | |||
6 | T=fuzz_cred | ||
7 | |||
8 | sync() { | ||
9 | mkdir ${T} | ||
10 | ssh "${REMOTE}" "cd ${T} && tar -cf- corpus" | tar -C ${T} -xf- | ||
11 | } | ||
12 | |||
13 | run() { | ||
14 | build/fuzz/fuzz_cred -max_len=17408 -runs=1 ${T}/corpus 2>/dev/null 1>&2 | ||
15 | } | ||
16 | |||
17 | case "$1" in | ||
18 | sync) | ||
19 | sync | ||
20 | ;; | ||
21 | run) | ||
22 | run | ||
23 | exit 0 | ||
24 | ;; | ||
25 | *) | ||
26 | echo unknown command "$1" | ||
27 | exit 1 | ||
28 | esac | ||
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 | |||
6 | T=fuzz_credman | ||
7 | |||
8 | sync() { | ||
9 | mkdir ${T} | ||
10 | ssh "${REMOTE}" "cd ${T} && tar -cf- corpus" | tar -C ${T} -xf- | ||
11 | } | ||
12 | |||
13 | run() { | ||
14 | build/fuzz/fuzz_credman -max_len=17408 -runs=1 ${T}/corpus 2>/dev/null 1>&2 | ||
15 | } | ||
16 | |||
17 | case "$1" in | ||
18 | sync) | ||
19 | sync | ||
20 | ;; | ||
21 | run) | ||
22 | run | ||
23 | exit 0 | ||
24 | ;; | ||
25 | *) | ||
26 | echo unknown command "$1" | ||
27 | exit 1 | ||
28 | esac | ||
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 | |||
6 | T=fuzz_mgmt | ||
7 | |||
8 | sync() { | ||
9 | mkdir ${T} | ||
10 | ssh "${REMOTE}" "cd ${T} && tar -cf- corpus" | tar -C ${T} -xf- | ||
11 | } | ||
12 | |||
13 | run() { | ||
14 | build/fuzz/fuzz_mgmt -max_len=17408 -runs=1 ${T}/corpus \ | ||
15 | 2>/dev/null 1>&2 | ||
16 | } | ||
17 | |||
18 | case "$1" in | ||
19 | sync) | ||
20 | sync | ||
21 | ;; | ||
22 | run) | ||
23 | run | ||
24 | exit 0 | ||
25 | ;; | ||
26 | *) | ||
27 | echo unknown command "$1" | ||
28 | exit 1 | ||
29 | esac | ||
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 | ||
40 | void | ||
41 | consume_str(const char *str) | ||
42 | { | ||
43 | consume(str, strlen(str)); | ||
44 | } | ||
45 | |||
40 | int | 46 | int |
41 | unpack_int(uint8_t t, uint8_t **ptr, size_t *len, int *v) NO_MSAN | 47 | unpack_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 | ||
236 | size_t | ||
237 | len_int(void) | ||
238 | { | ||
239 | return (sizeof(uint8_t) + sizeof(size_t) + sizeof(int)); | ||
240 | } | ||
241 | |||
242 | size_t | ||
243 | len_string(int max) | ||
244 | { | ||
245 | return ((sizeof(uint8_t) + sizeof(size_t)) + (max ? MAXSTR - 1 : 0)); | ||
246 | } | ||
247 | |||
248 | size_t | ||
249 | len_byte(void) | ||
250 | { | ||
251 | return (sizeof(uint8_t) + sizeof(size_t) + sizeof(uint8_t)); | ||
252 | } | ||
253 | |||
254 | size_t | ||
255 | len_blob(int max) | ||
256 | { | ||
257 | return (sizeof(uint8_t) + sizeof(size_t) + (max ? MAXBLOB : 0)); | ||
258 | } | ||
259 | |||
230 | void | 260 | void |
231 | mutate_byte(uint8_t *b) | 261 | mutate_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 | |||
34 | struct blob { | 40 | struct 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 | ||
39 | size_t xstrlen(const char *); | 45 | size_t xstrlen(const char *); |
40 | void consume(const void *, size_t); | 46 | void consume(const void *, size_t); |
47 | void consume_str(const char *); | ||
41 | 48 | ||
42 | int unpack_blob(uint8_t, uint8_t **, size_t *, struct blob *); | 49 | int unpack_blob(uint8_t, uint8_t **, size_t *, struct blob *); |
43 | int unpack_byte(uint8_t, uint8_t **, size_t *, uint8_t *); | 50 | int 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); | |||
49 | int pack_int(uint8_t, uint8_t **, size_t *, int); | 56 | int pack_int(uint8_t, uint8_t **, size_t *, int); |
50 | int pack_string(uint8_t, uint8_t **, size_t *, const char *); | 57 | int pack_string(uint8_t, uint8_t **, size_t *, const char *); |
51 | 58 | ||
59 | size_t len_int(void); | ||
60 | size_t len_string(int); | ||
61 | size_t len_byte(void); | ||
62 | size_t len_blob(int); | ||
63 | |||
52 | void mutate_byte(uint8_t *); | 64 | void mutate_byte(uint8_t *); |
53 | void mutate_int(int *); | 65 | void mutate_int(int *); |
54 | void mutate_blob(struct blob *); | 66 | void mutate_blob(struct blob *); |
@@ -60,6 +72,9 @@ void set_wire_data(uint8_t *, size_t); | |||
60 | int dev_read(void *, unsigned char *, size_t, int); | 72 | int dev_read(void *, unsigned char *, size_t, int); |
61 | int dev_write(void *, const unsigned char *, size_t); | 73 | int dev_write(void *, const unsigned char *, size_t); |
62 | 74 | ||
75 | void prng_init(unsigned long); | ||
76 | unsigned long prng_uint32(void); | ||
77 | |||
63 | uint32_t uniform_random(uint32_t); | 78 | uint32_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 | |||
56 | int prng_up = 0; | ||
57 | static unsigned long mt[N]; /* the array for the state vector */ | ||
58 | static int mti=N+1; /* mti==N+1 means mt[N] is not initialized */ | ||
59 | |||
60 | /* initializes mt[N] with a seed */ | ||
61 | void 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 */ | ||
78 | unsigned 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 | |||
8 | T="" | ||
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" | ||
20 | T+=" harnesses/fuzz_assert" | ||
21 | T+=" harnesses/fuzz_bio" | ||
22 | T+=" harnesses/fuzz_cred" | ||
23 | T+=" harnesses/fuzz_credman" | ||
24 | T+=" harnesses/fuzz_mgmt" | ||
25 | |||
26 | clean() { | ||
27 | echo cleaning | ||
28 | rm -rf obj | ||
29 | mkdir obj | ||
30 | } | ||
31 | |||
32 | build() { | ||
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 | |||
41 | sync() { | ||
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 | |||
52 | run() { | ||
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 | |||
62 | merge() { | ||
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 | |||
76 | clean | ||
77 | build | ||
78 | sync | ||
79 | run | ||
80 | merge | ||
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 @@ | |||
1 | Filename Regions Missed Regions Cover Functions Missed Functions Executed Lines Missed Lines Cover | 1 | Filename Regions Missed Regions Cover Functions Missed Functions Executed Lines Missed Lines Cover |
2 | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 2 | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
3 | fuzz/prng.c 31 0 100.00% 2 0 100.00% 48 0 100.00% | ||
3 | fuzz/uniform_random.c 7 1 85.71% 1 0 100.00% 23 1 95.65% | 4 | fuzz/uniform_random.c 7 1 85.71% 1 0 100.00% 23 1 95.65% |
4 | fuzz/wrap.c 4 0 100.00% 1 0 100.00% 7 0 100.00% | 5 | fuzz/wrap.c 6 0 100.00% 1 0 100.00% 7 0 100.00% |
5 | openbsd-compat/explicit_bzero.c 4 0 100.00% 1 0 100.00% 12 0 100.00% | 6 | openbsd-compat/explicit_bzero.c 4 0 100.00% 1 0 100.00% 12 0 100.00% |
6 | openbsd-compat/recallocarray.c 41 7 82.93% 1 0 100.00% 49 7 85.71% | 7 | openbsd-compat/recallocarray.c 41 7 82.93% 1 0 100.00% 49 7 85.71% |
8 | openbsd-compat/strlcat.c 12 1 91.67% 1 0 100.00% 25 1 96.00% | ||
7 | openbsd-compat/timingsafe_bcmp.c 4 0 100.00% 1 0 100.00% 8 0 100.00% | 9 | openbsd-compat/timingsafe_bcmp.c 4 0 100.00% 1 0 100.00% 8 0 100.00% |
8 | src/aes256.c 56 0 100.00% 2 0 100.00% 82 0 100.00% | 10 | src/aes256.c 56 0 100.00% 2 0 100.00% 82 0 100.00% |
9 | src/assert.c 569 29 94.90% 53 1 98.11% 901 60 93.34% | 11 | src/assert.c 566 43 92.40% 53 1 98.11% 900 87 90.33% |
10 | src/authkey.c 45 0 100.00% 5 0 100.00% 75 0 100.00% | 12 | src/authkey.c 44 0 100.00% 5 0 100.00% 75 0 100.00% |
11 | src/bio.c 422 21 95.02% 49 2 95.92% 661 25 96.22% | 13 | src/bio.c 418 20 95.22% 49 2 95.92% 661 22 96.67% |
12 | src/blob.c 39 1 97.44% 7 0 100.00% 73 4 94.52% | 14 | src/blob.c 39 1 97.44% 7 0 100.00% 73 4 94.52% |
13 | src/buf.c 8 1 87.50% 2 0 100.00% 20 1 95.00% | 15 | src/buf.c 8 1 87.50% 2 0 100.00% 20 1 95.00% |
14 | src/cbor.c 844 31 96.33% 51 1 98.04% 1319 47 96.44% | 16 | src/cbor.c 884 70 92.08% 52 2 96.15% 1371 106 92.27% |
15 | src/cred.c 532 35 93.42% 54 1 98.15% 850 55 93.53% | 17 | src/cred.c 534 51 90.45% 55 1 98.18% 830 78 90.60% |
16 | src/credman.c 381 18 95.28% 38 0 100.00% 589 15 97.45% | 18 | src/credman.c 376 18 95.21% 38 0 100.00% 589 15 97.45% |
17 | src/dev.c 131 22 83.21% 19 1 94.74% 183 30 83.61% | 19 | src/dev.c 201 85 57.71% 26 8 69.23% 294 128 56.46% |
18 | src/ecdh.c 68 0 100.00% 2 0 100.00% 104 0 100.00% | 20 | src/ecdh.c 68 0 100.00% 2 0 100.00% 104 0 100.00% |
19 | src/eddsa.c 54 4 92.59% 8 0 100.00% 79 2 97.47% | 21 | src/eddsa.c 54 0 100.00% 8 0 100.00% 79 0 100.00% |
20 | src/err.c 108 108 0.00% 1 1 0.00% 112 112 0.00% | 22 | src/err.c 108 108 0.00% 1 1 0.00% 112 112 0.00% |
21 | src/es256.c 273 4 98.53% 16 0 100.00% 372 13 96.51% | 23 | src/es256.c 278 0 100.00% 16 0 100.00% 377 0 100.00% |
22 | src/hid.c 16 16 0.00% 8 8 0.00% 38 38 0.00% | 24 | src/hid.c 16 16 0.00% 8 8 0.00% 38 38 0.00% |
23 | src/hid_linux.c 166 166 0.00% 12 12 0.00% 287 287 0.00% | 25 | src/hid_linux.c 166 166 0.00% 12 12 0.00% 292 292 0.00% |
24 | src/info.c 148 1 99.32% 31 0 100.00% 305 0 100.00% | 26 | src/info.c 146 0 100.00% 31 0 100.00% 304 0 100.00% |
25 | src/io.c 113 6 94.69% 7 0 100.00% 201 13 93.53% | 27 | src/io.c 123 5 95.93% 10 0 100.00% 218 11 94.95% |
26 | src/iso7816.c 18 1 94.44% 5 0 100.00% 47 0 100.00% | 28 | src/iso7816.c 18 1 94.44% 5 0 100.00% 47 0 100.00% |
27 | src/log.c 16 10 37.50% 3 1 66.67% 34 23 32.35% | 29 | src/log.c 34 2 94.12% 5 1 80.00% 50 3 94.00% |
28 | src/pin.c 250 0 100.00% 16 0 100.00% 364 0 100.00% | 30 | src/pin.c 248 0 100.00% 16 0 100.00% 365 0 100.00% |
29 | src/reset.c 20 0 100.00% 3 0 100.00% 23 0 100.00% | 31 | src/reset.c 19 0 100.00% 3 0 100.00% 22 0 100.00% |
30 | src/rs256.c 102 6 94.12% 8 0 100.00% 140 9 93.57% | 32 | src/rs256.c 102 29 71.57% 8 3 62.50% 140 44 68.57% |
31 | src/u2f.c 436 11 97.48% 13 0 100.00% 686 22 96.79% | 33 | src/u2f.c 443 28 93.68% 13 0 100.00% 699 52 92.56% |
32 | 34 | ||
33 | Files which contain no functions: | 35 | Files which contain no functions: |
34 | src/extern.h 0 0 - 0 0 - 0 0 - | 36 | src/extern.h 0 0 - 0 0 - 0 0 - |
@@ -36,4 +38,4 @@ src/fido.h 0 0 - | |||
36 | src/fido/err.h 0 0 - 0 0 - 0 0 - | 38 | src/fido/err.h 0 0 - 0 0 - 0 0 - |
37 | src/fido/param.h 0 0 - 0 0 - 0 0 - | 39 | src/fido/param.h 0 0 - 0 0 - 0 0 - |
38 | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 40 | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
39 | TOTAL 4875 499 89.76% 418 28 93.30% 7644 764 90.01% | 41 | TOTAL 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 | ||
20 | uint32_t uniform_random(uint32_t); | 20 | uint32_t uniform_random(uint32_t); |
21 | unsigned 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 | ||
21 | extern 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 @@ | |||
27 | extern type __wrap_##name args; \ | 29 | extern type __wrap_##name args; \ |
28 | extern type __real_##name args; \ | 30 | extern type __real_##name args; \ |
29 | type __wrap_##name args { \ | 31 | type __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 | ||
146 | WRAP(EC_KEY *, | ||
147 | EVP_PKEY_get0_EC_KEY, | ||
148 | (EVP_PKEY *pkey), | ||
149 | NULL, | ||
150 | (pkey), | ||
151 | 1 | ||
152 | ) | ||
153 | |||
154 | WRAP(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 | |||
144 | WRAP(EVP_MD_CTX *, | 162 | WRAP(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 | ||
187 | WRAP(int, | ||
188 | BN_bn2bin, | ||
189 | (const BIGNUM *a, unsigned char *to), | ||
190 | -1, | ||
191 | (a, to), | ||
192 | 1 | ||
193 | ) | ||
194 | |||
169 | WRAP(BIGNUM *, | 195 | WRAP(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 | ||
243 | WRAP(const BIGNUM *, | ||
244 | EC_KEY_get0_private_key, | ||
245 | (const EC_KEY *key), | ||
246 | NULL, | ||
247 | (key), | ||
248 | 1 | ||
249 | ) | ||
250 | |||
217 | WRAP(EC_POINT *, | 251 | WRAP(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 | ||
259 | WRAP(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 | |||
225 | WRAP(EVP_PKEY *, | 267 | WRAP(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 | ||
283 | WRAP(int, | ||
284 | EVP_PKEY_keygen_init, | ||
285 | (EVP_PKEY_CTX *ctx), | ||
286 | 0, | ||
287 | (ctx), | ||
288 | 1 | ||
289 | ) | ||
290 | |||
291 | WRAP(int, | ||
292 | EVP_PKEY_keygen, | ||
293 | (EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey), | ||
294 | 0, | ||
295 | (ctx, ppkey), | ||
296 | 1 | ||
297 | ) | ||
298 | |||
299 | WRAP(int, | ||
300 | EVP_PKEY_paramgen_init, | ||
301 | (EVP_PKEY_CTX *ctx), | ||
302 | 0, | ||
303 | (ctx), | ||
304 | 1 | ||
305 | ) | ||
306 | |||
307 | WRAP(int, | ||
308 | EVP_PKEY_paramgen, | ||
309 | (EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey), | ||
310 | 0, | ||
311 | (ctx, ppkey), | ||
312 | 1 | ||
313 | ) | ||
314 | |||
241 | WRAP(EVP_PKEY *, | 315 | WRAP(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 | ||
331 | WRAP(EVP_PKEY_CTX *, | ||
332 | EVP_PKEY_CTX_new_id, | ||
333 | (int id, ENGINE *e), | ||
334 | NULL, | ||
335 | (id, e), | ||
336 | 1 | ||
337 | ) | ||
338 | |||
257 | WRAP(int, | 339 | WRAP(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 | ||
348 | WRAP(cbor_item_t *, | 430 | WRAP(cbor_item_t *, |
431 | cbor_build_bool, | ||
432 | (bool value), | ||
433 | NULL, | ||
434 | (value), | ||
435 | 1 | ||
436 | ) | ||
437 | |||
438 | WRAP(cbor_item_t *, | ||
439 | cbor_build_negint8, | ||
440 | (uint8_t value), | ||
441 | NULL, | ||
442 | (value), | ||
443 | 1 | ||
444 | ) | ||
445 | |||
446 | WRAP(cbor_item_t *, | ||
447 | cbor_build_negint16, | ||
448 | (uint16_t value), | ||
449 | NULL, | ||
450 | (value), | ||
451 | 1 | ||
452 | ) | ||
453 | |||
454 | WRAP(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 | ||
470 | WRAP(cbor_item_t *, | ||
471 | cbor_build_uint32, | ||
472 | (uint32_t value), | ||
473 | NULL, | ||
474 | (value), | ||
475 | 1 | ||
476 | ) | ||
477 | |||
364 | WRAP(struct cbor_pair *, | 478 | WRAP(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 | ||
380 | WRAP(bool, | 494 | WRAP(bool, |
495 | cbor_array_push, | ||
496 | (cbor_item_t *array, cbor_item_t *pushee), | ||
497 | false, | ||
498 | (array, pushee), | ||
499 | 1 | ||
500 | ) | ||
501 | |||
502 | WRAP(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 | ||
518 | WRAP(cbor_item_t *, | ||
519 | cbor_new_definite_array, | ||
520 | (size_t size), | ||
521 | NULL, | ||
522 | (size), | ||
523 | 1 | ||
524 | ) | ||
525 | |||
396 | WRAP(size_t, | 526 | WRAP(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 @@ | |||
1 | BN_bin2bn | 1 | BN_bin2bn |
2 | BN_bn2bin | ||
2 | BN_CTX_get | 3 | BN_CTX_get |
3 | BN_CTX_new | 4 | BN_CTX_new |
4 | BN_new | 5 | BN_new |
5 | calloc | 6 | calloc |
6 | cbor_array_handle | 7 | cbor_array_handle |
8 | cbor_array_push | ||
9 | cbor_build_bool | ||
7 | cbor_build_bytestring | 10 | cbor_build_bytestring |
11 | cbor_build_negint16 | ||
12 | cbor_build_negint8 | ||
8 | cbor_build_string | 13 | cbor_build_string |
14 | cbor_build_uint32 | ||
9 | cbor_build_uint8 | 15 | cbor_build_uint8 |
10 | cbor_load | 16 | cbor_load |
11 | cbor_map_add | 17 | cbor_map_add |
12 | cbor_map_handle | 18 | cbor_map_handle |
19 | cbor_new_definite_array | ||
13 | cbor_new_definite_map | 20 | cbor_new_definite_map |
14 | cbor_serialize_alloc | 21 | cbor_serialize_alloc |
15 | EC_KEY_get0_group | 22 | EC_KEY_get0_group |
23 | EC_KEY_get0_private_key | ||
16 | EC_KEY_new_by_curve_name | 24 | EC_KEY_new_by_curve_name |
25 | EC_POINT_get_affine_coordinates_GFp | ||
17 | EC_POINT_new | 26 | EC_POINT_new |
18 | EVP_CIPHER_CTX_new | 27 | EVP_CIPHER_CTX_new |
19 | EVP_CIPHER_CTX_set_padding | 28 | EVP_CIPHER_CTX_set_padding |
@@ -25,11 +34,18 @@ EVP_EncryptUpdate | |||
25 | EVP_MD_CTX_new | 34 | EVP_MD_CTX_new |
26 | EVP_PKEY_assign | 35 | EVP_PKEY_assign |
27 | EVP_PKEY_CTX_new | 36 | EVP_PKEY_CTX_new |
37 | EVP_PKEY_CTX_new_id | ||
28 | EVP_PKEY_derive_init | 38 | EVP_PKEY_derive_init |
29 | EVP_PKEY_derive_set_peer | 39 | EVP_PKEY_derive_set_peer |
40 | EVP_PKEY_get0_EC_KEY | ||
30 | EVP_PKEY_get0_RSA | 41 | EVP_PKEY_get0_RSA |
42 | EVP_PKEY_get_raw_public_key | ||
43 | EVP_PKEY_keygen | ||
44 | EVP_PKEY_keygen_init | ||
31 | EVP_PKEY_new | 45 | EVP_PKEY_new |
32 | EVP_PKEY_new_raw_public_key | 46 | EVP_PKEY_new_raw_public_key |
47 | EVP_PKEY_paramgen | ||
48 | EVP_PKEY_paramgen_init | ||
33 | EVP_sha256 | 49 | EVP_sha256 |
34 | fido_tx | 50 | fido_tx |
35 | HMAC | 51 | HMAC |
diff --git a/man/CMakeLists.txt b/man/CMakeLists.txt index c903ab8..44e4a96 100644 --- a/man/CMakeLists.txt +++ b/man/CMakeLists.txt | |||
@@ -5,7 +5,7 @@ | |||
5 | find_program(MANDOC_PATH mandoc) | 5 | find_program(MANDOC_PATH mandoc) |
6 | message(STATUS "MANDOC_PATH: ${MANDOC_PATH}") | 6 | message(STATUS "MANDOC_PATH: ${MANDOC_PATH}") |
7 | 7 | ||
8 | if(CMAKE_SYSTEM_NAME STREQUAL "Linux") | 8 | if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR CMAKE_SYSTEM_NAME STREQUAL "Linux") |
9 | find_program(GZIP_PATH gzip) | 9 | find_program(GZIP_PATH gzip) |
10 | message(STATUS "GZIP_PATH: ${GZIP_PATH}") | 10 | message(STATUS "GZIP_PATH: ${GZIP_PATH}") |
11 | endif() | 11 | endif() |
@@ -101,6 +101,7 @@ list(APPEND MAN_ALIAS | |||
101 | fido_cbor_info_new fido_cbor_info_extensions_ptr | 101 | fido_cbor_info_new fido_cbor_info_extensions_ptr |
102 | fido_cbor_info_new fido_cbor_info_free | 102 | fido_cbor_info_new fido_cbor_info_free |
103 | fido_cbor_info_new fido_cbor_info_maxmsgsiz | 103 | fido_cbor_info_new fido_cbor_info_maxmsgsiz |
104 | fido_cbor_info_new fido_cbor_info_fwversion | ||
104 | fido_cbor_info_new fido_cbor_info_options_len | 105 | fido_cbor_info_new fido_cbor_info_options_len |
105 | fido_cbor_info_new fido_cbor_info_options_name_ptr | 106 | fido_cbor_info_new fido_cbor_info_options_name_ptr |
106 | fido_cbor_info_new fido_cbor_info_options_value_ptr | 107 | fido_cbor_info_new fido_cbor_info_options_value_ptr |
@@ -117,6 +118,7 @@ list(APPEND MAN_ALIAS | |||
117 | fido_cred_new fido_cred_free | 118 | fido_cred_new fido_cred_free |
118 | fido_cred_new fido_cred_id_len | 119 | fido_cred_new fido_cred_id_len |
119 | fido_cred_new fido_cred_id_ptr | 120 | fido_cred_new fido_cred_id_ptr |
121 | fido_cred_new fido_cred_prot | ||
120 | fido_cred_new fido_cred_pubkey_len | 122 | fido_cred_new fido_cred_pubkey_len |
121 | fido_cred_new fido_cred_pubkey_ptr | 123 | fido_cred_new fido_cred_pubkey_ptr |
122 | fido_cred_new fido_cred_sig_len | 124 | fido_cred_new fido_cred_sig_len |
@@ -145,6 +147,7 @@ list(APPEND MAN_ALIAS | |||
145 | fido_cred_set_authdata fido_cred_set_clientdata_hash | 147 | fido_cred_set_authdata fido_cred_set_clientdata_hash |
146 | fido_cred_set_authdata fido_cred_set_extensions | 148 | fido_cred_set_authdata fido_cred_set_extensions |
147 | fido_cred_set_authdata fido_cred_set_fmt | 149 | fido_cred_set_authdata fido_cred_set_fmt |
150 | fido_cred_set_authdata fido_cred_set_prot | ||
148 | fido_cred_set_authdata fido_cred_set_rk | 151 | fido_cred_set_authdata fido_cred_set_rk |
149 | fido_cred_set_authdata fido_cred_set_rp | 152 | fido_cred_set_authdata fido_cred_set_rp |
150 | fido_cred_set_authdata fido_cred_set_sig | 153 | fido_cred_set_authdata fido_cred_set_sig |
@@ -261,17 +264,17 @@ if(MANDOC_PATH) | |||
261 | add_dependencies(man man_symlink_html) | 264 | add_dependencies(man man_symlink_html) |
262 | add_dependencies(man_gzip man_lint) | 265 | add_dependencies(man_gzip man_lint) |
263 | install(FILES ${CMAKE_SOURCE_DIR}/man/style.css | 266 | install(FILES ${CMAKE_SOURCE_DIR}/man/style.css |
264 | DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc/libfido2) | 267 | DESTINATION "${CMAKE_INSTALL_DOCDIR}/html") |
265 | foreach(f ${MAN_SOURCES}) | 268 | foreach(f ${MAN_SOURCES}) |
266 | string(REGEX REPLACE ".[13]" "" f ${f}) | 269 | string(REGEX REPLACE ".[13]" "" f ${f}) |
267 | install(FILES ${CMAKE_BINARY_DIR}/man/${f}.html | 270 | install(FILES ${CMAKE_BINARY_DIR}/man/${f}.html |
268 | DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc/libfido2) | 271 | DESTINATION "${CMAKE_INSTALL_DOCDIR}/html") |
269 | endforeach() | 272 | endforeach() |
270 | foreach(i RANGE 0 ${MAN_ALIAS_MAX} 2) | 273 | foreach(i RANGE 0 ${MAN_ALIAS_MAX} 2) |
271 | math(EXPR j "${i} + 1") | 274 | math(EXPR j "${i} + 1") |
272 | list(GET MAN_ALIAS ${j} DST) | 275 | list(GET MAN_ALIAS ${j} DST) |
273 | install(FILES ${CMAKE_BINARY_DIR}/man/${DST}.html | 276 | install(FILES ${CMAKE_BINARY_DIR}/man/${DST}.html |
274 | DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc/libfido2) | 277 | DESTINATION "${CMAKE_INSTALL_DOCDIR}/html") |
275 | endforeach() | 278 | endforeach() |
276 | endif() | 279 | endif() |
277 | 280 | ||
@@ -282,33 +285,33 @@ if(GZIP_PATH) | |||
282 | foreach(f ${MAN_SOURCES}) | 285 | foreach(f ${MAN_SOURCES}) |
283 | if (${f} MATCHES ".1$") | 286 | if (${f} MATCHES ".1$") |
284 | install(FILES ${CMAKE_BINARY_DIR}/man/${f}.gz | 287 | install(FILES ${CMAKE_BINARY_DIR}/man/${f}.gz |
285 | DESTINATION "${CMAKE_INSTALL_PREFIX}/share/man/man1") | 288 | DESTINATION "${CMAKE_INSTALL_MANDIR}/man1") |
286 | elseif(${f} MATCHES ".3$") | 289 | elseif(${f} MATCHES ".3$") |
287 | install(FILES ${CMAKE_BINARY_DIR}/man/${f}.gz | 290 | install(FILES ${CMAKE_BINARY_DIR}/man/${f}.gz |
288 | DESTINATION "${CMAKE_INSTALL_PREFIX}/share/man/man3") | 291 | DESTINATION "${CMAKE_INSTALL_MANDIR}/man3") |
289 | endif() | 292 | endif() |
290 | endforeach() | 293 | endforeach() |
291 | foreach(i RANGE 0 ${MAN_ALIAS_MAX} 2) | 294 | foreach(i RANGE 0 ${MAN_ALIAS_MAX} 2) |
292 | math(EXPR j "${i} + 1") | 295 | math(EXPR j "${i} + 1") |
293 | list(GET MAN_ALIAS ${j} DST) | 296 | list(GET MAN_ALIAS ${j} DST) |
294 | install(FILES ${CMAKE_BINARY_DIR}/man/${DST}.3.gz | 297 | install(FILES ${CMAKE_BINARY_DIR}/man/${DST}.3.gz |
295 | DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man3) | 298 | DESTINATION "${CMAKE_INSTALL_MANDIR}/man3") |
296 | endforeach() | 299 | endforeach() |
297 | elseif(NOT MSVC) | 300 | elseif(NOT MSVC) |
298 | add_dependencies(man man_symlink) | 301 | add_dependencies(man man_symlink) |
299 | foreach(f ${MAN_SOURCES}) | 302 | foreach(f ${MAN_SOURCES}) |
300 | if (${f} MATCHES ".1$") | 303 | if (${f} MATCHES ".1$") |
301 | install(FILES ${CMAKE_BINARY_DIR}/man/${f} | 304 | install(FILES ${CMAKE_BINARY_DIR}/man/${f} |
302 | DESTINATION "${CMAKE_INSTALL_PREFIX}/man/man1") | 305 | DESTINATION "${CMAKE_INSTALL_MANDIR}/man1") |
303 | elseif(${f} MATCHES ".3$") | 306 | elseif(${f} MATCHES ".3$") |
304 | install(FILES ${CMAKE_BINARY_DIR}/man/${f} | 307 | install(FILES ${CMAKE_BINARY_DIR}/man/${f} |
305 | DESTINATION "${CMAKE_INSTALL_PREFIX}/man/man3") | 308 | DESTINATION "${CMAKE_INSTALL_MANDIR}/man3") |
306 | endif() | 309 | endif() |
307 | endforeach() | 310 | endforeach() |
308 | foreach(i RANGE 0 ${MAN_ALIAS_MAX} 2) | 311 | foreach(i RANGE 0 ${MAN_ALIAS_MAX} 2) |
309 | math(EXPR j "${i} + 1") | 312 | math(EXPR j "${i} + 1") |
310 | list(GET MAN_ALIAS ${j} DST) | 313 | list(GET MAN_ALIAS ${j} DST) |
311 | install(FILES ${CMAKE_BINARY_DIR}/man/${DST}.3 | 314 | install(FILES ${CMAKE_BINARY_DIR}/man/${DST}.3 |
312 | DESTINATION ${CMAKE_INSTALL_PREFIX}/man/man3) | 315 | DESTINATION "${CMAKE_INSTALL_MANDIR}/man3") |
313 | endforeach() | 316 | endforeach() |
314 | endif() | 317 | endif() |
diff --git a/man/es256_pk_new.3 b/man/es256_pk_new.3 index 48eda0b..54439cd 100644 --- a/man/es256_pk_new.3 +++ b/man/es256_pk_new.3 | |||
@@ -89,6 +89,10 @@ where | |||
89 | points to | 89 | points to |
90 | .Fa len | 90 | .Fa len |
91 | bytes. | 91 | bytes. |
92 | The | ||
93 | .Fa ptr | ||
94 | pointer may point to an uncompressed point, or to the | ||
95 | concatenation of the x and y coordinates. | ||
92 | No references to | 96 | No references to |
93 | .Fa ptr | 97 | .Fa ptr |
94 | are kept. | 98 | are kept. |
diff --git a/man/fido2-token.1 b/man/fido2-token.1 index d5a5734..b59463a 100644 --- a/man/fido2-token.1 +++ b/man/fido2-token.1 | |||
@@ -156,3 +156,5 @@ authenticator. | |||
156 | Yubico authenticators do not allow resets after 5 seconds from | 156 | Yubico authenticators do not allow resets after 5 seconds from |
157 | power-up, and expect a reset to be confirmed by the user through | 157 | power-up, and expect a reset to be confirmed by the user through |
158 | touch within 30 seconds. | 158 | touch within 30 seconds. |
159 | .Pp | ||
160 | An authenticator's path may contain spaces. | ||
diff --git a/man/fido_bio_dev_get_info.3 b/man/fido_bio_dev_get_info.3 index bde1396..d18c9ec 100644 --- a/man/fido_bio_dev_get_info.3 +++ b/man/fido_bio_dev_get_info.3 | |||
@@ -35,6 +35,8 @@ | |||
35 | The functions described in this page allow biometric | 35 | The functions described in this page allow biometric |
36 | templates on a FIDO2 authenticator to be listed, created, | 36 | templates on a FIDO2 authenticator to be listed, created, |
37 | removed, and customised. | 37 | removed, and customised. |
38 | Please note that not all FIDO2 authenticators support biometric | ||
39 | enrollment. | ||
38 | For a description of the types involved, please refer to | 40 | For a description of the types involved, please refer to |
39 | .Xr fido_bio_info_new 3 , | 41 | .Xr fido_bio_info_new 3 , |
40 | .Xr fido_bio_enroll_new 3 , | 42 | .Xr fido_bio_enroll_new 3 , |
@@ -118,3 +120,11 @@ is returned. | |||
118 | .Xr fido_bio_enroll_new 3 , | 120 | .Xr fido_bio_enroll_new 3 , |
119 | .Xr fido_bio_info_new 3 , | 121 | .Xr fido_bio_info_new 3 , |
120 | .Xr fido_bio_template 3 | 122 | .Xr fido_bio_template 3 |
123 | .Sh CAVEATS | ||
124 | Biometric enrollment is a tentative feature of FIDO 2.1. | ||
125 | Applications willing to strictly abide by FIDO 2.0 should refrain | ||
126 | from using biometric enrollment. | ||
127 | Applications using biometric enrollment should ensure it is | ||
128 | supported by the authenticator prior to using the API. | ||
129 | Since FIDO 2.1 hasn't been finalised, there is a chance the | ||
130 | functionality and associated data structures may change. | ||
diff --git a/man/fido_bio_template.3 b/man/fido_bio_template.3 index 6140926..8414937 100644 --- a/man/fido_bio_template.3 +++ b/man/fido_bio_template.3 | |||
@@ -38,11 +38,11 @@ | |||
38 | .Ft fido_bio_template_array_t * | 38 | .Ft fido_bio_template_array_t * |
39 | .Fn fido_bio_template_array_new "void" | 39 | .Fn fido_bio_template_array_new "void" |
40 | .Ft void | 40 | .Ft void |
41 | .Fn fido_bio_template_array_free "fido_bio_template_array_t **template_array_p" | 41 | .Fn fido_bio_template_array_free "fido_bio_template_array_t **array_p" |
42 | .Ft size_t | 42 | .Ft size_t |
43 | .Fn fido_bio_template_array_count "const fido_bio_template_array_t *template_array" | 43 | .Fn fido_bio_template_array_count "const fido_bio_template_array_t *array" |
44 | .Ft const fido_bio_template_t * | 44 | .Ft const fido_bio_template_t * |
45 | .Fn fido_bio_template "const fido_bio_template_array_t *template_array" "size_t idx" | 45 | .Fn fido_bio_template "const fido_bio_template_array_t *array" "size_t idx" |
46 | .Sh DESCRIPTION | 46 | .Sh DESCRIPTION |
47 | Existing FIDO 2 biometric enrollments are abstracted in | 47 | Existing FIDO 2 biometric enrollments are abstracted in |
48 | .Em libfido2 | 48 | .Em libfido2 |
@@ -132,18 +132,18 @@ If memory cannot be allocated, NULL is returned. | |||
132 | The | 132 | The |
133 | .Fn fido_bio_template_array_free | 133 | .Fn fido_bio_template_array_free |
134 | function releases the memory backing | 134 | function releases the memory backing |
135 | .Fa *template_array_p , | 135 | .Fa *array_p , |
136 | where | 136 | where |
137 | .Fa *template_array_p | 137 | .Fa *array_p |
138 | must have been previously allocated by | 138 | must have been previously allocated by |
139 | .Fn fido_bio_template_array_new . | 139 | .Fn fido_bio_template_array_new . |
140 | On return, | 140 | On return, |
141 | .Fa *template_array_p | 141 | .Fa *array_p |
142 | is set to NULL. | 142 | is set to NULL. |
143 | Either | 143 | Either |
144 | .Fa template_array_p | 144 | .Fa array_p |
145 | or | 145 | or |
146 | .Fa *template_array_p | 146 | .Fa *array_p |
147 | may be NULL, in which case | 147 | may be NULL, in which case |
148 | .Fn fido_bio_template_array_free | 148 | .Fn fido_bio_template_array_free |
149 | is a NOP. | 149 | is a NOP. |
@@ -151,16 +151,16 @@ is a NOP. | |||
151 | The | 151 | The |
152 | .Fn fido_bio_template_array_count | 152 | .Fn fido_bio_template_array_count |
153 | function returns the number of templates in | 153 | function returns the number of templates in |
154 | .Fa template_array . | 154 | .Fa array . |
155 | .Pp | 155 | .Pp |
156 | The | 156 | The |
157 | .Fn fido_bio_template | 157 | .Fn fido_bio_template |
158 | function returns a pointer to the template at index | 158 | function returns a pointer to the template at index |
159 | .Fa idx | 159 | .Fa idx |
160 | in | 160 | in |
161 | .Fa template_array . | 161 | .Fa array . |
162 | Please note that the first template in | 162 | Please note that the first template in |
163 | .Fa template_array | 163 | .Fa array |
164 | has an | 164 | has an |
165 | .Fa idx | 165 | .Fa idx |
166 | (index) value of 0. | 166 | (index) value of 0. |
diff --git a/man/fido_cbor_info_new.3 b/man/fido_cbor_info_new.3 index d1e4c41..3e7de1f 100644 --- a/man/fido_cbor_info_new.3 +++ b/man/fido_cbor_info_new.3 | |||
@@ -20,7 +20,8 @@ | |||
20 | .Nm fido_cbor_info_protocols_len , | 20 | .Nm fido_cbor_info_protocols_len , |
21 | .Nm fido_cbor_info_versions_len , | 21 | .Nm fido_cbor_info_versions_len , |
22 | .Nm fido_cbor_info_options_len , | 22 | .Nm fido_cbor_info_options_len , |
23 | .Nm fido_cbor_info_maxmsgsiz | 23 | .Nm fido_cbor_info_maxmsgsiz , |
24 | .Nm fido_cbor_info_fwversion | ||
24 | .Nd FIDO 2 CBOR Info API | 25 | .Nd FIDO 2 CBOR Info API |
25 | .Sh SYNOPSIS | 26 | .Sh SYNOPSIS |
26 | .In fido.h | 27 | .In fido.h |
@@ -54,6 +55,8 @@ | |||
54 | .Fn fido_cbor_info_options_len "const fido_cbor_info_t *ci" | 55 | .Fn fido_cbor_info_options_len "const fido_cbor_info_t *ci" |
55 | .Ft uint64_t | 56 | .Ft uint64_t |
56 | .Fn fido_cbor_info_maxmsgsiz "const fido_cbor_info_t *ci" | 57 | .Fn fido_cbor_info_maxmsgsiz "const fido_cbor_info_t *ci" |
58 | .Ft uint64_t | ||
59 | .Fn fido_cbor_info_fwversion "const fido_cbor_info_t *ci" | ||
57 | .Sh DESCRIPTION | 60 | .Sh DESCRIPTION |
58 | The | 61 | The |
59 | .Fn fido_cbor_info_new | 62 | .Fn fido_cbor_info_new |
@@ -124,7 +127,12 @@ The length of the options array is returned by | |||
124 | .Pp | 127 | .Pp |
125 | The | 128 | The |
126 | .Fn fido_cbor_info_maxmsgsiz | 129 | .Fn fido_cbor_info_maxmsgsiz |
127 | function returns the maximum message size of | 130 | function returns the maximum message size attribute of |
131 | .Fa ci . | ||
132 | .Pp | ||
133 | The | ||
134 | .Fn fido_cbor_info_fwversion | ||
135 | function returns the firmware version attribute of | ||
128 | .Fa ci . | 136 | .Fa ci . |
129 | .Pp | 137 | .Pp |
130 | A complete example of how to use these functions can be found in the | 138 | A complete example of how to use these functions can be found in the |
diff --git a/man/fido_cred_new.3 b/man/fido_cred_new.3 index 47eeba8..22af60c 100644 --- a/man/fido_cred_new.3 +++ b/man/fido_cred_new.3 | |||
@@ -8,6 +8,7 @@ | |||
8 | .Sh NAME | 8 | .Sh NAME |
9 | .Nm fido_cred_new , | 9 | .Nm fido_cred_new , |
10 | .Nm fido_cred_free , | 10 | .Nm fido_cred_free , |
11 | .Nm fido_cred_prot , | ||
11 | .Nm fido_cred_fmt , | 12 | .Nm fido_cred_fmt , |
12 | .Nm fido_cred_authdata_ptr , | 13 | .Nm fido_cred_authdata_ptr , |
13 | .Nm fido_cred_clientdata_hash_ptr , | 14 | .Nm fido_cred_clientdata_hash_ptr , |
@@ -28,6 +29,8 @@ | |||
28 | .Fn fido_cred_new "void" | 29 | .Fn fido_cred_new "void" |
29 | .Ft void | 30 | .Ft void |
30 | .Fn fido_cred_free "fido_cred_t **cred_p" | 31 | .Fn fido_cred_free "fido_cred_t **cred_p" |
32 | .Ft int | ||
33 | .Fn fido_cred_prot "fido_cred_t *cred" | ||
31 | .Ft const char * | 34 | .Ft const char * |
32 | .Fn fido_cred_fmt "const fido_cred_t *cred" | 35 | .Fn fido_cred_fmt "const fido_cred_t *cred" |
33 | .Ft const unsigned char * | 36 | .Ft const unsigned char * |
@@ -99,6 +102,15 @@ may be NULL, in which case | |||
99 | is a NOP. | 102 | is a NOP. |
100 | .Pp | 103 | .Pp |
101 | The | 104 | The |
105 | .Fn fido_cred_prot | ||
106 | function returns the protection of | ||
107 | .Fa cred . | ||
108 | See | ||
109 | .Xr fido_cred_set_prot 3 | ||
110 | for the values understood by | ||
111 | .Em libfido2 . | ||
112 | .Pp | ||
113 | The | ||
102 | .Fn fido_cred_fmt | 114 | .Fn fido_cred_fmt |
103 | function returns a pointer to a NUL-terminated string containing | 115 | function returns a pointer to a NUL-terminated string containing |
104 | the format of | 116 | the format of |
diff --git a/man/fido_cred_set_authdata.3 b/man/fido_cred_set_authdata.3 index 8b087fa..d28c61e 100644 --- a/man/fido_cred_set_authdata.3 +++ b/man/fido_cred_set_authdata.3 | |||
@@ -14,6 +14,7 @@ | |||
14 | .Nm fido_cred_set_rp , | 14 | .Nm fido_cred_set_rp , |
15 | .Nm fido_cred_set_user , | 15 | .Nm fido_cred_set_user , |
16 | .Nm fido_cred_set_extensions , | 16 | .Nm fido_cred_set_extensions , |
17 | .Nm fido_cred_set_prot , | ||
17 | .Nm fido_cred_set_rk , | 18 | .Nm fido_cred_set_rk , |
18 | .Nm fido_cred_set_uv , | 19 | .Nm fido_cred_set_uv , |
19 | .Nm fido_cred_set_fmt , | 20 | .Nm fido_cred_set_fmt , |
@@ -45,6 +46,8 @@ typedef enum { | |||
45 | .Ft int | 46 | .Ft int |
46 | .Fn fido_cred_set_extensions "fido_cred_t *cred" "int flags" | 47 | .Fn fido_cred_set_extensions "fido_cred_t *cred" "int flags" |
47 | .Ft int | 48 | .Ft int |
49 | .Fn fido_cred_set_prot "fido_cred_t *cred" "int prot" | ||
50 | .Ft int | ||
48 | .Fn fido_cred_set_rk "fido_cred_t *cred" "fido_opt_t rk" | 51 | .Fn fido_cred_set_rk "fido_cred_t *cred" "fido_opt_t rk" |
49 | .Ft int | 52 | .Ft int |
50 | .Fn fido_cred_set_uv "fido_cred_t *cred" "fido_opt_t uv" | 53 | .Fn fido_cred_set_uv "fido_cred_t *cred" "fido_opt_t uv" |
@@ -149,7 +152,9 @@ to the bitmask | |||
149 | .Fa flags . | 152 | .Fa flags . |
150 | At the moment, only the | 153 | At the moment, only the |
151 | .Dv FIDO_EXT_HMAC_SECRET | 154 | .Dv FIDO_EXT_HMAC_SECRET |
152 | extension is supported. | 155 | and |
156 | .Dv FIDO_EXT_CRED_PROTECT | ||
157 | extensions are supported. | ||
153 | If | 158 | If |
154 | .Fa flags | 159 | .Fa flags |
155 | is zero, the extensions of | 160 | is zero, the extensions of |
@@ -157,6 +162,24 @@ is zero, the extensions of | |||
157 | are cleared. | 162 | are cleared. |
158 | .Pp | 163 | .Pp |
159 | The | 164 | The |
165 | .Fn fido_cred_set_prot | ||
166 | function sets the protection of | ||
167 | .Fa cred | ||
168 | to the scalar | ||
169 | .Fa prot . | ||
170 | At the moment, only the | ||
171 | .Dv FIDO_CRED_PROT_UV_OPTIONAL , | ||
172 | .Dv FIDO_CRED_PROT_UV_OPTIONAL_WITH_ID , | ||
173 | and | ||
174 | .Dv FIDO_CRED_PROT_UV_REQUIRED | ||
175 | protections are supported. | ||
176 | If | ||
177 | .Fa prot | ||
178 | is zero, the protection of | ||
179 | .Fa cred | ||
180 | is cleared. | ||
181 | .Pp | ||
182 | The | ||
160 | .Fn fido_cred_set_rk | 183 | .Fn fido_cred_set_rk |
161 | and | 184 | and |
162 | .Fn fido_cred_set_uv | 185 | .Fn fido_cred_set_uv |
diff --git a/man/fido_credman_metadata_new.3 b/man/fido_credman_metadata_new.3 index 16f0192..1a65978 100644 --- a/man/fido_credman_metadata_new.3 +++ b/man/fido_credman_metadata_new.3 | |||
@@ -72,7 +72,8 @@ The credential management API of | |||
72 | .Em libfido2 | 72 | .Em libfido2 |
73 | allows resident credentials on a FIDO2 authenticator to be listed, | 73 | allows resident credentials on a FIDO2 authenticator to be listed, |
74 | inspected, and removed. | 74 | inspected, and removed. |
75 | Please note that not all authenticators support credential management. | 75 | Please note that not all FIDO2 authenticators support credential |
76 | management. | ||
76 | To obtain information on what an authenticator supports, please | 77 | To obtain information on what an authenticator supports, please |
77 | refer to | 78 | refer to |
78 | .Xr fido_cbor_info_new 3 . | 79 | .Xr fido_cbor_info_new 3 . |
@@ -297,3 +298,11 @@ should have their return values checked for NULL. | |||
297 | .Sh SEE ALSO | 298 | .Sh SEE ALSO |
298 | .Xr fido_cbor_info_new 3 , | 299 | .Xr fido_cbor_info_new 3 , |
299 | .Xr fido_cred_new 3 | 300 | .Xr fido_cred_new 3 |
301 | .Sh CAVEATS | ||
302 | Credential management is a tentative feature of FIDO 2.1. | ||
303 | Applications willing to strictly abide by FIDO 2.0 should refrain | ||
304 | from using credential management. | ||
305 | Applications using credential management should ensure it is | ||
306 | supported by the authenticator prior to using the API. | ||
307 | Since FIDO 2.1 hasn't been finalised, there is a chance the | ||
308 | functionality and associated data structures may change. | ||
diff --git a/man/fido_dev_set_io_functions.3 b/man/fido_dev_set_io_functions.3 index adc4a9e..67bc6d0 100644 --- a/man/fido_dev_set_io_functions.3 +++ b/man/fido_dev_set_io_functions.3 | |||
@@ -15,12 +15,16 @@ typedef void *fido_dev_io_open_t(const char *); | |||
15 | typedef void fido_dev_io_close_t(void *); | 15 | typedef void fido_dev_io_close_t(void *); |
16 | typedef int fido_dev_io_read_t(void *, unsigned char *, size_t, int); | 16 | typedef int fido_dev_io_read_t(void *, unsigned char *, size_t, int); |
17 | typedef int fido_dev_io_write_t(void *, const unsigned char *, size_t); | 17 | typedef int fido_dev_io_write_t(void *, const unsigned char *, size_t); |
18 | typedef int fido_dev_io_rx_t(struct fido_dev *, uint8_t, unsigned char *, size_t, int); | ||
19 | typedef int fido_dev_io_tx_t(struct fido_dev *, uint8_t, const unsigned char *, size_t); | ||
18 | 20 | ||
19 | typedef struct fido_dev_io { | 21 | typedef struct fido_dev_io { |
20 | fido_dev_io_open_t *open; | 22 | fido_dev_io_open_t *open; |
21 | fido_dev_io_close_t *close; | 23 | fido_dev_io_close_t *close; |
22 | fido_dev_io_read_t *read; | 24 | fido_dev_io_read_t *read; |
23 | fido_dev_io_write_t *write; | 25 | fido_dev_io_write_t *write; |
26 | fido_dev_io_rx_t *rx; | ||
27 | fido_dev_io_tx_t *tx; | ||
24 | } fido_dev_io_t; | 28 | } fido_dev_io_t; |
25 | .Ed | 29 | .Ed |
26 | .Ft int | 30 | .Ft int |
@@ -28,12 +32,12 @@ typedef struct fido_dev_io { | |||
28 | .Sh DESCRIPTION | 32 | .Sh DESCRIPTION |
29 | The | 33 | The |
30 | .Nm | 34 | .Nm |
31 | interface defines the I/O handlers used to talk to | 35 | interface defines the I/O and transmission handlers used to talk to |
32 | .Fa dev . | 36 | .Fa dev . |
33 | Its usage is optional. | 37 | Its usage is optional. |
34 | By default, | 38 | By default, |
35 | .Em libfido2 | 39 | .Em libfido2 |
36 | will use the operating system's native HID interface to talk to | 40 | will use the operating system's native HID interface to talk CTAP2 to |
37 | a FIDO device. | 41 | a FIDO device. |
38 | .Pp | 42 | .Pp |
39 | A | 43 | A |
@@ -51,13 +55,13 @@ It is not expected to be idempotent. | |||
51 | .Pp | 55 | .Pp |
52 | A | 56 | A |
53 | .Vt fido_dev_io_read_t | 57 | .Vt fido_dev_io_read_t |
54 | function reads from | 58 | function reads a single HID report from |
55 | .Fa dev . | 59 | .Fa dev . |
56 | The first parameter taken is the opaque handle obtained from | 60 | The first parameter taken is the opaque handle obtained from |
57 | .Vt fido_dev_io_open_t . | 61 | .Vt fido_dev_io_open_t . |
58 | The read buffer is pointed to by the second parameter, and the | 62 | The read buffer is pointed to by the second parameter, and the |
59 | third parameter holds its size. | 63 | third parameter holds its size. |
60 | Finally, the last argument passed to | 64 | The last argument passed to |
61 | .Vt fido_dev_io_read_t | 65 | .Vt fido_dev_io_read_t |
62 | is the number of milliseconds the caller is willing to sleep, | 66 | is the number of milliseconds the caller is willing to sleep, |
63 | should the call need to block. | 67 | should the call need to block. |
@@ -67,9 +71,9 @@ may block indefinitely. | |||
67 | The number of bytes read is returned. | 71 | The number of bytes read is returned. |
68 | On error, -1 is returned. | 72 | On error, -1 is returned. |
69 | .Pp | 73 | .Pp |
70 | Conversely, a | 74 | A |
71 | .Vt fido_dev_io_write_t | 75 | .Vt fido_dev_io_write_t |
72 | function writes to | 76 | function writes a single HID report to |
73 | .Fa dev . | 77 | .Fa dev . |
74 | The first parameter taken is the opaque handle returned by | 78 | The first parameter taken is the opaque handle returned by |
75 | .Vt fido_dev_io_open_t . | 79 | .Vt fido_dev_io_open_t . |
@@ -81,6 +85,59 @@ function may block. | |||
81 | The number of bytes written is returned. | 85 | The number of bytes written is returned. |
82 | On error, -1 is returned. | 86 | On error, -1 is returned. |
83 | .Pp | 87 | .Pp |
88 | A | ||
89 | .Vt fido_dev_io_rx_t | ||
90 | function receives a complete CTAP2 message from | ||
91 | .Fa dev . | ||
92 | The first parameter taken is a pointer to | ||
93 | .Fa dev . | ||
94 | The second parameter holds the expected CTAP2 command byte. | ||
95 | The read buffer is pointed to by the third parameter, and the | ||
96 | fourth parameter holds its size. | ||
97 | The last argument passed to | ||
98 | .Vt fido_dev_io_rx_t | ||
99 | is the number of milliseconds the caller is willing to sleep, | ||
100 | should the call need to block. | ||
101 | If this value holds -1, | ||
102 | .Vt fido_dev_io_rx_t | ||
103 | may block indefinitely. | ||
104 | The number of bytes read is returned. | ||
105 | On error, -1 is returned. | ||
106 | .Pp | ||
107 | A | ||
108 | .Vt fido_dev_io_tx_t | ||
109 | function transmits a complete CTAP2 message to | ||
110 | .Fa dev . | ||
111 | The first parameter taken is a pointer to | ||
112 | .Fa dev . | ||
113 | The second parameter holds the CTAP2 command byte. | ||
114 | The write buffer is pointed to by the third parameter, and the | ||
115 | fourth parameter holds its size. | ||
116 | A | ||
117 | .Vt fido_dev_io_tx_t | ||
118 | function may block. | ||
119 | On success, 0 is returned. | ||
120 | On error, -1 is returned. | ||
121 | .Pp | ||
122 | When calling | ||
123 | .Fn fido_dev_set_io_functions , | ||
124 | the | ||
125 | .Fa open , | ||
126 | .Fa close , | ||
127 | .Fa read | ||
128 | and | ||
129 | .Fa write | ||
130 | fields of | ||
131 | .Fa io | ||
132 | may not be NULL. | ||
133 | Either | ||
134 | .Fa rx | ||
135 | or | ||
136 | .Fa tx | ||
137 | may be NULL, in which case | ||
138 | .Em libfido2 | ||
139 | uses its corresponding CTAP2 HID transport method. | ||
140 | .Pp | ||
84 | No references to | 141 | No references to |
85 | .Fa io | 142 | .Fa io |
86 | are held by | 143 | are held by |
diff --git a/openbsd-compat/openbsd-compat.h b/openbsd-compat/openbsd-compat.h index bee126c..30d80b3 100644 --- a/openbsd-compat/openbsd-compat.h +++ b/openbsd-compat/openbsd-compat.h | |||
@@ -32,6 +32,10 @@ | |||
32 | #define be32toh(x) ntohl((x)) | 32 | #define be32toh(x) ntohl((x)) |
33 | #endif /* _WIN32 && !HAVE_ENDIAN_H */ | 33 | #endif /* _WIN32 && !HAVE_ENDIAN_H */ |
34 | 34 | ||
35 | #if defined(__FreeBSD__) && !defined(HAVE_ENDIAN_H) | ||
36 | #include <sys/endian.h> | ||
37 | #endif | ||
38 | |||
35 | #include <stdlib.h> | 39 | #include <stdlib.h> |
36 | 40 | ||
37 | #if !defined(HAVE_STRLCAT) | 41 | #if !defined(HAVE_STRLCAT) |
diff --git a/openbsd-compat/readpassphrase.c b/openbsd-compat/readpassphrase.c index dfb3065..8b84190 100644 --- a/openbsd-compat/readpassphrase.c +++ b/openbsd-compat/readpassphrase.c | |||
@@ -52,7 +52,7 @@ | |||
52 | # define _POSIX_VDISABLE VDISABLE | 52 | # define _POSIX_VDISABLE VDISABLE |
53 | #endif | 53 | #endif |
54 | 54 | ||
55 | static volatile sig_atomic_t signo[_NSIG]; | 55 | static volatile sig_atomic_t signo[NSIG]; |
56 | 56 | ||
57 | static void handler(int); | 57 | static void handler(int); |
58 | 58 | ||
@@ -73,7 +73,7 @@ readpassphrase(const char *prompt, char *buf, size_t bufsiz, int flags) | |||
73 | } | 73 | } |
74 | 74 | ||
75 | restart: | 75 | restart: |
76 | for (i = 0; i < _NSIG; i++) | 76 | for (i = 0; i < NSIG; i++) |
77 | signo[i] = 0; | 77 | signo[i] = 0; |
78 | need_restart = 0; | 78 | need_restart = 0; |
79 | /* | 79 | /* |
@@ -177,7 +177,7 @@ restart: | |||
177 | * If we were interrupted by a signal, resend it to ourselves | 177 | * If we were interrupted by a signal, resend it to ourselves |
178 | * now that we have restored the signal handlers. | 178 | * now that we have restored the signal handlers. |
179 | */ | 179 | */ |
180 | for (i = 0; i < _NSIG; i++) { | 180 | for (i = 0; i < NSIG; i++) { |
181 | if (signo[i]) { | 181 | if (signo[i]) { |
182 | kill(getpid(), i); | 182 | kill(getpid(), i); |
183 | switch (i) { | 183 | switch (i) { |
diff --git a/openbsd-compat/readpassphrase.h b/openbsd-compat/readpassphrase.h index 0c4a59e..e4451f3 100644 --- a/openbsd-compat/readpassphrase.h +++ b/openbsd-compat/readpassphrase.h | |||
@@ -27,6 +27,8 @@ | |||
27 | 27 | ||
28 | #ifndef HAVE_READPASSPHRASE | 28 | #ifndef HAVE_READPASSPHRASE |
29 | 29 | ||
30 | #include <stdlib.h> | ||
31 | |||
30 | #define RPP_ECHO_OFF 0x00 /* Turn off echo (default). */ | 32 | #define RPP_ECHO_OFF 0x00 /* Turn off echo (default). */ |
31 | #define RPP_ECHO_ON 0x01 /* Leave echo on. */ | 33 | #define RPP_ECHO_ON 0x01 /* Leave echo on. */ |
32 | #define RPP_REQUIRE_TTY 0x02 /* Fail if there is no tty. */ | 34 | #define RPP_REQUIRE_TTY 0x02 /* Fail if there is no tty. */ |
diff --git a/regress/CMakeLists.txt b/regress/CMakeLists.txt index b8fea64..0314c38 100644 --- a/regress/CMakeLists.txt +++ b/regress/CMakeLists.txt | |||
@@ -2,17 +2,15 @@ | |||
2 | # Use of this source code is governed by a BSD-style | 2 | # Use of this source code is governed by a BSD-style |
3 | # license that can be found in the LICENSE file. | 3 | # license that can be found in the LICENSE file. |
4 | 4 | ||
5 | # cred | 5 | add_custom_target(regress ALL) |
6 | add_executable(regress_cred cred.c) | ||
7 | target_link_libraries(regress_cred fido2_shared) | ||
8 | add_custom_command(TARGET regress_cred POST_BUILD COMMAND regress_cred) | ||
9 | 6 | ||
10 | # assert | 7 | macro(add_regress_test NAME SOURCES) |
11 | add_executable(regress_assert assert.c) | 8 | add_executable(${NAME} ${SOURCES}) |
12 | target_link_libraries(regress_assert fido2_shared) | 9 | target_link_libraries(${NAME} fido2_shared) |
13 | add_custom_command(TARGET regress_assert POST_BUILD COMMAND regress_assert) | 10 | add_custom_command(TARGET regress POST_BUILD COMMAND ${NAME} |
11 | DEPENDS ${NAME}) | ||
12 | endmacro() | ||
14 | 13 | ||
15 | # dev | 14 | add_regress_test(regress_cred cred.c) |
16 | add_executable(regress_dev dev.c) | 15 | add_regress_test(regress_assert assert.c) |
17 | target_link_libraries(regress_dev fido2_shared) | 16 | add_regress_test(regress_dev dev.c) |
18 | add_custom_command(TARGET regress_dev POST_BUILD COMMAND regress_dev) | ||
diff --git a/regress/assert.c b/regress/assert.c index ebf0652..caa5725 100644 --- a/regress/assert.c +++ b/regress/assert.c | |||
@@ -216,12 +216,16 @@ empty_assert_tests(void) | |||
216 | fido_dev_io_t io_f; | 216 | fido_dev_io_t io_f; |
217 | int i; | 217 | int i; |
218 | 218 | ||
219 | memset(&io_f, 0, sizeof(io_f)); | ||
220 | |||
219 | a = alloc_assert(); | 221 | a = alloc_assert(); |
220 | d = alloc_dev(); | 222 | d = alloc_dev(); |
223 | |||
221 | io_f.open = dummy_open; | 224 | io_f.open = dummy_open; |
222 | io_f.close = dummy_close; | 225 | io_f.close = dummy_close; |
223 | io_f.read = dummy_read; | 226 | io_f.read = dummy_read; |
224 | io_f.write = dummy_write; | 227 | io_f.write = dummy_write; |
228 | |||
225 | assert(fido_dev_set_io_functions(d, &io_f) == FIDO_OK); | 229 | assert(fido_dev_set_io_functions(d, &io_f) == FIDO_OK); |
226 | 230 | ||
227 | empty_assert(d, a, 0); | 231 | empty_assert(d, a, 0); |
diff --git a/regress/cred.c b/regress/cred.c index 4998649..f8c08a4 100644 --- a/regress/cred.c +++ b/regress/cred.c | |||
@@ -333,10 +333,13 @@ empty_cred(void) | |||
333 | assert(fido_cred_x5c_ptr(c) == NULL); | 333 | assert(fido_cred_x5c_ptr(c) == NULL); |
334 | assert(fido_cred_verify(c) == FIDO_ERR_INVALID_ARGUMENT); | 334 | assert(fido_cred_verify(c) == FIDO_ERR_INVALID_ARGUMENT); |
335 | 335 | ||
336 | memset(&io_f, 0, sizeof(io_f)); | ||
337 | |||
336 | io_f.open = dummy_open; | 338 | io_f.open = dummy_open; |
337 | io_f.close = dummy_close; | 339 | io_f.close = dummy_close; |
338 | io_f.read = dummy_read; | 340 | io_f.read = dummy_read; |
339 | io_f.write = dummy_write; | 341 | io_f.write = dummy_write; |
342 | |||
340 | d = alloc_dev(); | 343 | d = alloc_dev(); |
341 | 344 | ||
342 | fido_dev_force_u2f(d); | 345 | fido_dev_force_u2f(d); |
diff --git a/regress/dev.c b/regress/dev.c index 39b3584..84a45cc 100644 --- a/regress/dev.c +++ b/regress/dev.c | |||
@@ -6,6 +6,7 @@ | |||
6 | 6 | ||
7 | #include <assert.h> | 7 | #include <assert.h> |
8 | #include <fido.h> | 8 | #include <fido.h> |
9 | #include <string.h> | ||
9 | 10 | ||
10 | #define FAKE_DEV_HANDLE ((void *)0xdeadbeef) | 11 | #define FAKE_DEV_HANDLE ((void *)0xdeadbeef) |
11 | #define REPORT_LEN (64 + 1) | 12 | #define REPORT_LEN (64 + 1) |
@@ -53,6 +54,8 @@ open_iff_ok(void) | |||
53 | fido_dev_t *dev = NULL; | 54 | fido_dev_t *dev = NULL; |
54 | fido_dev_io_t io; | 55 | fido_dev_io_t io; |
55 | 56 | ||
57 | memset(&io, 0, sizeof(io)); | ||
58 | |||
56 | io.open = dummy_open; | 59 | io.open = dummy_open; |
57 | io.close = dummy_close; | 60 | io.close = dummy_close; |
58 | io.read = dummy_read; | 61 | io.read = dummy_read; |
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 926e7f2..3cf62e8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt | |||
@@ -31,11 +31,14 @@ list(APPEND FIDO_SOURCES | |||
31 | ) | 31 | ) |
32 | 32 | ||
33 | if(FUZZ) | 33 | if(FUZZ) |
34 | list(APPEND FIDO_SOURCES ../fuzz/prng.c) | ||
34 | list(APPEND FIDO_SOURCES ../fuzz/uniform_random.c) | 35 | list(APPEND FIDO_SOURCES ../fuzz/uniform_random.c) |
35 | list(APPEND FIDO_SOURCES ../fuzz/wrap.c) | 36 | list(APPEND FIDO_SOURCES ../fuzz/wrap.c) |
36 | endif() | 37 | endif() |
37 | 38 | ||
38 | if(WIN32) | 39 | if(USE_HIDAPI) |
40 | list(APPEND COMPAT_SOURCES hid_hidapi.c) | ||
41 | elseif(WIN32) | ||
39 | list(APPEND COMPAT_SOURCES hid_win.c) | 42 | list(APPEND COMPAT_SOURCES hid_win.c) |
40 | elseif(APPLE) | 43 | elseif(APPLE) |
41 | list(APPEND COMPAT_SOURCES hid_osx.c) | 44 | list(APPEND COMPAT_SOURCES hid_osx.c) |
@@ -43,6 +46,8 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") | |||
43 | list(APPEND COMPAT_SOURCES hid_linux.c) | 46 | list(APPEND COMPAT_SOURCES hid_linux.c) |
44 | elseif(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") | 47 | elseif(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") |
45 | list(APPEND COMPAT_SOURCES hid_openbsd.c) | 48 | list(APPEND COMPAT_SOURCES hid_openbsd.c) |
49 | else() | ||
50 | message(FATAL_ERROR "please define a hid backend for your platform") | ||
46 | endif() | 51 | endif() |
47 | 52 | ||
48 | list(APPEND COMPAT_SOURCES | 53 | list(APPEND COMPAT_SOURCES |
@@ -50,13 +55,14 @@ list(APPEND COMPAT_SOURCES | |||
50 | ../openbsd-compat/explicit_bzero.c | 55 | ../openbsd-compat/explicit_bzero.c |
51 | ../openbsd-compat/explicit_bzero_win32.c | 56 | ../openbsd-compat/explicit_bzero_win32.c |
52 | ../openbsd-compat/recallocarray.c | 57 | ../openbsd-compat/recallocarray.c |
58 | ../openbsd-compat/strlcat.c | ||
53 | ../openbsd-compat/timingsafe_bcmp.c | 59 | ../openbsd-compat/timingsafe_bcmp.c |
54 | ) | 60 | ) |
55 | 61 | ||
56 | # static library | 62 | # static library |
57 | add_library(fido2 STATIC ${FIDO_SOURCES} ${COMPAT_SOURCES}) | 63 | add_library(fido2 STATIC ${FIDO_SOURCES} ${COMPAT_SOURCES}) |
58 | target_link_libraries(fido2 ${CBOR_LIBRARIES} ${CRYPTO_LIBRARIES} | 64 | target_link_libraries(fido2 ${CBOR_LIBRARIES} ${CRYPTO_LIBRARIES} |
59 | ${UDEV_LIBRARIES} ${BASE_LIBRARIES}) | 65 | ${UDEV_LIBRARIES} ${BASE_LIBRARIES} ${HIDAPI_LIBRARIES}) |
60 | if(WIN32) | 66 | if(WIN32) |
61 | if (MINGW) | 67 | if (MINGW) |
62 | target_link_libraries(fido2 wsock32 ws2_32 bcrypt setupapi hid) | 68 | target_link_libraries(fido2 wsock32 ws2_32 bcrypt setupapi hid) |
@@ -74,7 +80,7 @@ install(TARGETS fido2 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | |||
74 | # dynamic library | 80 | # dynamic library |
75 | add_library(fido2_shared SHARED ${FIDO_SOURCES} ${COMPAT_SOURCES}) | 81 | add_library(fido2_shared SHARED ${FIDO_SOURCES} ${COMPAT_SOURCES}) |
76 | target_link_libraries(fido2_shared ${CBOR_LIBRARIES} ${CRYPTO_LIBRARIES} | 82 | target_link_libraries(fido2_shared ${CBOR_LIBRARIES} ${CRYPTO_LIBRARIES} |
77 | ${UDEV_LIBRARIES} ${BASE_LIBRARIES}) | 83 | ${UDEV_LIBRARIES} ${BASE_LIBRARIES} ${HIDAPI_LIBRARIES}) |
78 | if(WIN32) | 84 | if(WIN32) |
79 | if (MINGW) | 85 | if (MINGW) |
80 | target_link_libraries(fido2_shared wsock32 ws2_32 bcrypt | 86 | target_link_libraries(fido2_shared wsock32 ws2_32 bcrypt |
diff --git a/src/assert.c b/src/assert.c index a21b308..b71d00e 100644 --- a/src/assert.c +++ b/src/assert.c | |||
@@ -152,8 +152,8 @@ fido_dev_get_assert_tx(fido_dev_t *dev, fido_assert_t *assert, | |||
152 | } | 152 | } |
153 | 153 | ||
154 | /* frame and transmit */ | 154 | /* frame and transmit */ |
155 | if (cbor_build_frame(CTAP_CBOR_ASSERT, argv, 7, &f) < 0 || | 155 | if (cbor_build_frame(CTAP_CBOR_ASSERT, argv, nitems(argv), &f) < 0 || |
156 | fido_tx(dev, CTAP_FRAME_INIT | CTAP_CMD_CBOR, f.ptr, f.len) < 0) { | 156 | fido_tx(dev, CTAP_CMD_CBOR, f.ptr, f.len) < 0) { |
157 | fido_log_debug("%s: fido_tx", __func__); | 157 | fido_log_debug("%s: fido_tx", __func__); |
158 | r = FIDO_ERR_TX; | 158 | r = FIDO_ERR_TX; |
159 | goto fail; | 159 | goto fail; |
@@ -170,14 +170,14 @@ fail: | |||
170 | static int | 170 | static int |
171 | fido_dev_get_assert_rx(fido_dev_t *dev, fido_assert_t *assert, int ms) | 171 | fido_dev_get_assert_rx(fido_dev_t *dev, fido_assert_t *assert, int ms) |
172 | { | 172 | { |
173 | const uint8_t cmd = CTAP_FRAME_INIT | CTAP_CMD_CBOR; | 173 | unsigned char reply[FIDO_MAXMSG]; |
174 | unsigned char reply[2048]; | ||
175 | int reply_len; | 174 | int reply_len; |
176 | int r; | 175 | int r; |
177 | 176 | ||
178 | fido_assert_reset_rx(assert); | 177 | fido_assert_reset_rx(assert); |
179 | 178 | ||
180 | if ((reply_len = fido_rx(dev, cmd, &reply, sizeof(reply), ms)) < 0) { | 179 | if ((reply_len = fido_rx(dev, CTAP_CMD_CBOR, &reply, sizeof(reply), |
180 | ms)) < 0) { | ||
181 | fido_log_debug("%s: fido_rx", __func__); | 181 | fido_log_debug("%s: fido_rx", __func__); |
182 | return (FIDO_ERR_RX); | 182 | return (FIDO_ERR_RX); |
183 | } | 183 | } |
@@ -211,10 +211,9 @@ fido_dev_get_assert_rx(fido_dev_t *dev, fido_assert_t *assert, int ms) | |||
211 | static int | 211 | static int |
212 | fido_get_next_assert_tx(fido_dev_t *dev) | 212 | fido_get_next_assert_tx(fido_dev_t *dev) |
213 | { | 213 | { |
214 | const unsigned char cbor[] = { CTAP_CBOR_NEXT_ASSERT }; | 214 | const unsigned char cbor[] = { CTAP_CBOR_NEXT_ASSERT }; |
215 | const uint8_t cmd = CTAP_FRAME_INIT | CTAP_CMD_CBOR; | ||
216 | 215 | ||
217 | if (fido_tx(dev, cmd, cbor, sizeof(cbor)) < 0) { | 216 | if (fido_tx(dev, CTAP_CMD_CBOR, cbor, sizeof(cbor)) < 0) { |
218 | fido_log_debug("%s: fido_tx", __func__); | 217 | fido_log_debug("%s: fido_tx", __func__); |
219 | return (FIDO_ERR_TX); | 218 | return (FIDO_ERR_TX); |
220 | } | 219 | } |
@@ -225,12 +224,12 @@ fido_get_next_assert_tx(fido_dev_t *dev) | |||
225 | static int | 224 | static int |
226 | fido_get_next_assert_rx(fido_dev_t *dev, fido_assert_t *assert, int ms) | 225 | fido_get_next_assert_rx(fido_dev_t *dev, fido_assert_t *assert, int ms) |
227 | { | 226 | { |
228 | const uint8_t cmd = CTAP_FRAME_INIT | CTAP_CMD_CBOR; | 227 | unsigned char reply[FIDO_MAXMSG]; |
229 | unsigned char reply[2048]; | ||
230 | int reply_len; | 228 | int reply_len; |
231 | int r; | 229 | int r; |
232 | 230 | ||
233 | if ((reply_len = fido_rx(dev, cmd, &reply, sizeof(reply), ms)) < 0) { | 231 | if ((reply_len = fido_rx(dev, CTAP_CMD_CBOR, &reply, sizeof(reply), |
232 | ms)) < 0) { | ||
234 | fido_log_debug("%s: fido_rx", __func__); | 233 | fido_log_debug("%s: fido_rx", __func__); |
235 | return (FIDO_ERR_RX); | 234 | return (FIDO_ERR_RX); |
236 | } | 235 | } |
@@ -363,8 +362,8 @@ check_extensions(int authdata_ext, int ext) | |||
363 | return (0); | 362 | return (0); |
364 | } | 363 | } |
365 | 364 | ||
366 | static int | 365 | int |
367 | get_signed_hash(int cose_alg, fido_blob_t *dgst, const fido_blob_t *clientdata, | 366 | fido_get_signed_hash(int cose_alg, fido_blob_t *dgst, const fido_blob_t *clientdata, |
368 | const fido_blob_t *authdata_cbor) | 367 | const fido_blob_t *authdata_cbor) |
369 | { | 368 | { |
370 | cbor_item_t *item = NULL; | 369 | cbor_item_t *item = NULL; |
@@ -534,7 +533,7 @@ int | |||
534 | fido_assert_verify(const fido_assert_t *assert, size_t idx, int cose_alg, | 533 | fido_assert_verify(const fido_assert_t *assert, size_t idx, int cose_alg, |
535 | const void *pk) | 534 | const void *pk) |
536 | { | 535 | { |
537 | unsigned char buf[1024]; | 536 | unsigned char buf[1024]; /* XXX */ |
538 | fido_blob_t dgst; | 537 | fido_blob_t dgst; |
539 | const fido_assert_stmt *stmt = NULL; | 538 | const fido_assert_stmt *stmt = NULL; |
540 | int ok = -1; | 539 | int ok = -1; |
@@ -579,9 +578,9 @@ fido_assert_verify(const fido_assert_t *assert, size_t idx, int cose_alg, | |||
579 | goto out; | 578 | goto out; |
580 | } | 579 | } |
581 | 580 | ||
582 | if (get_signed_hash(cose_alg, &dgst, &assert->cdh, | 581 | if (fido_get_signed_hash(cose_alg, &dgst, &assert->cdh, |
583 | &stmt->authdata_cbor) < 0) { | 582 | &stmt->authdata_cbor) < 0) { |
584 | fido_log_debug("%s: get_signed_hash", __func__); | 583 | fido_log_debug("%s: fido_get_signed_hash", __func__); |
585 | r = FIDO_ERR_INTERNAL; | 584 | r = FIDO_ERR_INTERNAL; |
586 | goto out; | 585 | goto out; |
587 | } | 586 | } |
diff --git a/src/authkey.c b/src/authkey.c index 9de37f1..83c2564 100644 --- a/src/authkey.c +++ b/src/authkey.c | |||
@@ -43,8 +43,8 @@ fido_dev_authkey_tx(fido_dev_t *dev) | |||
43 | } | 43 | } |
44 | 44 | ||
45 | /* frame and transmit */ | 45 | /* frame and transmit */ |
46 | if (cbor_build_frame(CTAP_CBOR_CLIENT_PIN, argv, 2, &f) < 0 || | 46 | if (cbor_build_frame(CTAP_CBOR_CLIENT_PIN, argv, nitems(argv), |
47 | fido_tx(dev, CTAP_FRAME_INIT | CTAP_CMD_CBOR, f.ptr, f.len) < 0) { | 47 | &f) < 0 || fido_tx(dev, CTAP_CMD_CBOR, f.ptr, f.len) < 0) { |
48 | fido_log_debug("%s: fido_tx", __func__); | 48 | fido_log_debug("%s: fido_tx", __func__); |
49 | r = FIDO_ERR_TX; | 49 | r = FIDO_ERR_TX; |
50 | goto fail; | 50 | goto fail; |
@@ -61,8 +61,7 @@ fail: | |||
61 | static int | 61 | static int |
62 | fido_dev_authkey_rx(fido_dev_t *dev, es256_pk_t *authkey, int ms) | 62 | fido_dev_authkey_rx(fido_dev_t *dev, es256_pk_t *authkey, int ms) |
63 | { | 63 | { |
64 | const uint8_t cmd = CTAP_FRAME_INIT | CTAP_CMD_CBOR; | 64 | unsigned char reply[FIDO_MAXMSG]; |
65 | unsigned char reply[2048]; | ||
66 | int reply_len; | 65 | int reply_len; |
67 | 66 | ||
68 | fido_log_debug("%s: dev=%p, authkey=%p, ms=%d", __func__, (void *)dev, | 67 | fido_log_debug("%s: dev=%p, authkey=%p, ms=%d", __func__, (void *)dev, |
@@ -70,7 +69,8 @@ fido_dev_authkey_rx(fido_dev_t *dev, es256_pk_t *authkey, int ms) | |||
70 | 69 | ||
71 | memset(authkey, 0, sizeof(*authkey)); | 70 | memset(authkey, 0, sizeof(*authkey)); |
72 | 71 | ||
73 | if ((reply_len = fido_rx(dev, cmd, &reply, sizeof(reply), ms)) < 0) { | 72 | if ((reply_len = fido_rx(dev, CTAP_CMD_CBOR, &reply, sizeof(reply), |
73 | ms)) < 0) { | ||
74 | fido_log_debug("%s: fido_rx", __func__); | 74 | fido_log_debug("%s: fido_rx", __func__); |
75 | return (FIDO_ERR_RX); | 75 | return (FIDO_ERR_RX); |
76 | } | 76 | } |
@@ -109,8 +109,8 @@ bio_tx(fido_dev_t *dev, uint8_t cmd, cbor_item_t **sub_argv, size_t sub_argc, | |||
109 | } | 109 | } |
110 | 110 | ||
111 | /* framing and transmission */ | 111 | /* framing and transmission */ |
112 | if (cbor_build_frame(CTAP_CBOR_BIO_ENROLL_PRE, argv, 5, &f) < 0 || | 112 | if (cbor_build_frame(CTAP_CBOR_BIO_ENROLL_PRE, argv, nitems(argv), |
113 | fido_tx(dev, CTAP_FRAME_INIT | CTAP_CMD_CBOR, f.ptr, f.len) < 0) { | 113 | &f) < 0 || fido_tx(dev, CTAP_CMD_CBOR, f.ptr, f.len) < 0) { |
114 | fido_log_debug("%s: fido_tx", __func__); | 114 | fido_log_debug("%s: fido_tx", __func__); |
115 | r = FIDO_ERR_TX; | 115 | r = FIDO_ERR_TX; |
116 | goto fail; | 116 | goto fail; |
@@ -235,14 +235,14 @@ bio_parse_template_array(const cbor_item_t *key, const cbor_item_t *val, | |||
235 | static int | 235 | static int |
236 | bio_rx_template_array(fido_dev_t *dev, fido_bio_template_array_t *ta, int ms) | 236 | bio_rx_template_array(fido_dev_t *dev, fido_bio_template_array_t *ta, int ms) |
237 | { | 237 | { |
238 | const uint8_t cmd = CTAP_FRAME_INIT | CTAP_CMD_CBOR; | 238 | unsigned char reply[FIDO_MAXMSG]; |
239 | unsigned char reply[2048]; | ||
240 | int reply_len; | 239 | int reply_len; |
241 | int r; | 240 | int r; |
242 | 241 | ||
243 | bio_reset_template_array(ta); | 242 | bio_reset_template_array(ta); |
244 | 243 | ||
245 | if ((reply_len = fido_rx(dev, cmd, &reply, sizeof(reply), ms)) < 0) { | 244 | if ((reply_len = fido_rx(dev, CTAP_CMD_CBOR, &reply, sizeof(reply), |
245 | ms)) < 0) { | ||
246 | fido_log_debug("%s: fido_rx", __func__); | 246 | fido_log_debug("%s: fido_rx", __func__); |
247 | return (FIDO_ERR_RX); | 247 | return (FIDO_ERR_RX); |
248 | } | 248 | } |
@@ -382,8 +382,7 @@ static int | |||
382 | bio_rx_enroll_begin(fido_dev_t *dev, fido_bio_template_t *t, | 382 | bio_rx_enroll_begin(fido_dev_t *dev, fido_bio_template_t *t, |
383 | fido_bio_enroll_t *e, int ms) | 383 | fido_bio_enroll_t *e, int ms) |
384 | { | 384 | { |
385 | const uint8_t cmd = CTAP_FRAME_INIT | CTAP_CMD_CBOR; | 385 | unsigned char reply[FIDO_MAXMSG]; |
386 | unsigned char reply[2048]; | ||
387 | int reply_len; | 386 | int reply_len; |
388 | int r; | 387 | int r; |
389 | 388 | ||
@@ -392,7 +391,8 @@ bio_rx_enroll_begin(fido_dev_t *dev, fido_bio_template_t *t, | |||
392 | e->remaining_samples = 0; | 391 | e->remaining_samples = 0; |
393 | e->last_status = 0; | 392 | e->last_status = 0; |
394 | 393 | ||
395 | if ((reply_len = fido_rx(dev, cmd, &reply, sizeof(reply), ms)) < 0) { | 394 | if ((reply_len = fido_rx(dev, CTAP_CMD_CBOR, &reply, sizeof(reply), |
395 | ms)) < 0) { | ||
396 | fido_log_debug("%s: fido_rx", __func__); | 396 | fido_log_debug("%s: fido_rx", __func__); |
397 | return (FIDO_ERR_RX); | 397 | return (FIDO_ERR_RX); |
398 | } | 398 | } |
@@ -407,7 +407,7 @@ bio_rx_enroll_begin(fido_dev_t *dev, fido_bio_template_t *t, | |||
407 | fido_log_debug("%s: bio_parse_template_id", __func__); | 407 | fido_log_debug("%s: bio_parse_template_id", __func__); |
408 | return (r); | 408 | return (r); |
409 | } | 409 | } |
410 | 410 | ||
411 | return (FIDO_OK); | 411 | return (FIDO_OK); |
412 | } | 412 | } |
413 | 413 | ||
@@ -482,15 +482,15 @@ fail: | |||
482 | static int | 482 | static int |
483 | bio_rx_enroll_continue(fido_dev_t *dev, fido_bio_enroll_t *e, int ms) | 483 | bio_rx_enroll_continue(fido_dev_t *dev, fido_bio_enroll_t *e, int ms) |
484 | { | 484 | { |
485 | const uint8_t cmd = CTAP_FRAME_INIT | CTAP_CMD_CBOR; | 485 | unsigned char reply[FIDO_MAXMSG]; |
486 | unsigned char reply[2048]; | ||
487 | int reply_len; | 486 | int reply_len; |
488 | int r; | 487 | int r; |
489 | 488 | ||
490 | e->remaining_samples = 0; | 489 | e->remaining_samples = 0; |
491 | e->last_status = 0; | 490 | e->last_status = 0; |
492 | 491 | ||
493 | if ((reply_len = fido_rx(dev, cmd, &reply, sizeof(reply), ms)) < 0) { | 492 | if ((reply_len = fido_rx(dev, CTAP_CMD_CBOR, &reply, sizeof(reply), |
493 | ms)) < 0) { | ||
494 | fido_log_debug("%s: fido_rx", __func__); | 494 | fido_log_debug("%s: fido_rx", __func__); |
495 | return (FIDO_ERR_RX); | 495 | return (FIDO_ERR_RX); |
496 | } | 496 | } |
@@ -500,7 +500,7 @@ bio_rx_enroll_continue(fido_dev_t *dev, fido_bio_enroll_t *e, int ms) | |||
500 | fido_log_debug("%s: bio_parse_enroll_status", __func__); | 500 | fido_log_debug("%s: bio_parse_enroll_status", __func__); |
501 | return (r); | 501 | return (r); |
502 | } | 502 | } |
503 | 503 | ||
504 | return (FIDO_OK); | 504 | return (FIDO_OK); |
505 | } | 505 | } |
506 | 506 | ||
@@ -643,14 +643,14 @@ bio_parse_info(const cbor_item_t *key, const cbor_item_t *val, void *arg) | |||
643 | static int | 643 | static int |
644 | bio_rx_info(fido_dev_t *dev, fido_bio_info_t *i, int ms) | 644 | bio_rx_info(fido_dev_t *dev, fido_bio_info_t *i, int ms) |
645 | { | 645 | { |
646 | const uint8_t cmd = CTAP_FRAME_INIT | CTAP_CMD_CBOR; | 646 | unsigned char reply[FIDO_MAXMSG]; |
647 | unsigned char reply[2048]; | ||
648 | int reply_len; | 647 | int reply_len; |
649 | int r; | 648 | int r; |
650 | 649 | ||
651 | bio_reset_info(i); | 650 | bio_reset_info(i); |
652 | 651 | ||
653 | if ((reply_len = fido_rx(dev, cmd, &reply, sizeof(reply), ms)) < 0) { | 652 | if ((reply_len = fido_rx(dev, CTAP_CMD_CBOR, &reply, sizeof(reply), |
653 | ms)) < 0) { | ||
654 | fido_log_debug("%s: fido_rx", __func__); | 654 | fido_log_debug("%s: fido_rx", __func__); |
655 | return (FIDO_ERR_RX); | 655 | return (FIDO_ERR_RX); |
656 | } | 656 | } |
@@ -7,6 +7,13 @@ | |||
7 | #ifndef _BLOB_H | 7 | #ifndef _BLOB_H |
8 | #define _BLOB_H | 8 | #define _BLOB_H |
9 | 9 | ||
10 | #include <cbor.h> | ||
11 | #include <stdlib.h> | ||
12 | |||
13 | #ifdef __cplusplus | ||
14 | extern "C" { | ||
15 | #endif /* __cplusplus */ | ||
16 | |||
10 | typedef struct fido_blob { | 17 | typedef struct fido_blob { |
11 | unsigned char *ptr; | 18 | unsigned char *ptr; |
12 | size_t len; | 19 | size_t len; |
@@ -25,4 +32,8 @@ int fido_blob_set(fido_blob_t *, const unsigned char *, size_t); | |||
25 | void fido_blob_free(fido_blob_t **); | 32 | void fido_blob_free(fido_blob_t **); |
26 | void fido_free_blob_array(fido_blob_array_t *); | 33 | void fido_free_blob_array(fido_blob_array_t *); |
27 | 34 | ||
35 | #ifdef __cplusplus | ||
36 | } /* extern "C" */ | ||
37 | #endif /* __cplusplus */ | ||
38 | |||
28 | #endif /* !_BLOB_H */ | 39 | #endif /* !_BLOB_H */ |
@@ -314,6 +314,35 @@ fail: | |||
314 | } | 314 | } |
315 | 315 | ||
316 | static int | 316 | static int |
317 | cbor_add_uint8(cbor_item_t *item, const char *key, uint8_t value) | ||
318 | { | ||
319 | struct cbor_pair pair; | ||
320 | int ok = -1; | ||
321 | |||
322 | memset(&pair, 0, sizeof(pair)); | ||
323 | |||
324 | if ((pair.key = cbor_build_string(key)) == NULL || | ||
325 | (pair.value = cbor_build_uint8(value)) == NULL) { | ||
326 | fido_log_debug("%s: cbor_build", __func__); | ||
327 | goto fail; | ||
328 | } | ||
329 | |||
330 | if (!cbor_map_add(item, pair)) { | ||
331 | fido_log_debug("%s: cbor_map_add", __func__); | ||
332 | goto fail; | ||
333 | } | ||
334 | |||
335 | ok = 0; | ||
336 | fail: | ||
337 | if (pair.key) | ||
338 | cbor_decref(&pair.key); | ||
339 | if (pair.value) | ||
340 | cbor_decref(&pair.value); | ||
341 | |||
342 | return (ok); | ||
343 | } | ||
344 | |||
345 | static int | ||
317 | cbor_add_arg(cbor_item_t *item, uint8_t n, cbor_item_t *arg) | 346 | cbor_add_arg(cbor_item_t *item, uint8_t n, cbor_item_t *arg) |
318 | { | 347 | { |
319 | struct cbor_pair pair; | 348 | struct cbor_pair pair; |
@@ -535,19 +564,29 @@ fail: | |||
535 | } | 564 | } |
536 | 565 | ||
537 | cbor_item_t * | 566 | cbor_item_t * |
538 | cbor_encode_extensions(int ext) | 567 | cbor_encode_extensions(const fido_cred_ext_t *ext) |
539 | { | 568 | { |
540 | cbor_item_t *item = NULL; | 569 | cbor_item_t *item = NULL; |
570 | size_t size = 0; | ||
541 | 571 | ||
542 | if (ext == 0 || ext != FIDO_EXT_HMAC_SECRET) | 572 | if (ext->mask & FIDO_EXT_HMAC_SECRET) |
543 | return (NULL); | 573 | size++; |
544 | 574 | if (ext->mask & FIDO_EXT_CRED_PROTECT) | |
545 | if ((item = cbor_new_definite_map(1)) == NULL) | 575 | size++; |
576 | if (size == 0 || (item = cbor_new_definite_map(size)) == NULL) | ||
546 | return (NULL); | 577 | return (NULL); |
547 | 578 | ||
548 | if (cbor_add_bool(item, "hmac-secret", FIDO_OPT_TRUE) < 0) { | 579 | if (ext->mask & FIDO_EXT_HMAC_SECRET) { |
549 | cbor_decref(&item); | 580 | if (cbor_add_bool(item, "hmac-secret", FIDO_OPT_TRUE) < 0) { |
550 | return (NULL); | 581 | cbor_decref(&item); |
582 | return (NULL); | ||
583 | } | ||
584 | } | ||
585 | if (ext->mask & FIDO_EXT_CRED_PROTECT) { | ||
586 | if (cbor_add_uint8(item, "credProtect", ext->prot) < 0) { | ||
587 | cbor_decref(&item); | ||
588 | return (NULL); | ||
589 | } | ||
551 | } | 590 | } |
552 | 591 | ||
553 | return (item); | 592 | return (item); |
@@ -1082,26 +1121,35 @@ fail: | |||
1082 | static int | 1121 | static int |
1083 | decode_extension(const cbor_item_t *key, const cbor_item_t *val, void *arg) | 1122 | decode_extension(const cbor_item_t *key, const cbor_item_t *val, void *arg) |
1084 | { | 1123 | { |
1085 | int *authdata_ext = arg; | 1124 | fido_cred_ext_t *authdata_ext = arg; |
1086 | char *type = NULL; | 1125 | char *type = NULL; |
1087 | int ok = -1; | 1126 | int ok = -1; |
1088 | 1127 | ||
1089 | if (cbor_string_copy(key, &type) < 0 || strcmp(type, "hmac-secret")) { | 1128 | if (cbor_string_copy(key, &type) < 0) { |
1090 | fido_log_debug("%s: cbor type", __func__); | 1129 | fido_log_debug("%s: cbor type", __func__); |
1091 | ok = 0; /* ignore */ | 1130 | ok = 0; /* ignore */ |
1092 | goto out; | 1131 | goto out; |
1093 | } | 1132 | } |
1094 | 1133 | ||
1095 | if (cbor_isa_float_ctrl(val) == false || | 1134 | if (strcmp(type, "hmac-secret") == 0) { |
1096 | cbor_float_get_width(val) != CBOR_FLOAT_0 || | 1135 | if (cbor_isa_float_ctrl(val) == false || |
1097 | cbor_is_bool(val) == false || *authdata_ext != 0) { | 1136 | cbor_float_get_width(val) != CBOR_FLOAT_0 || |
1098 | fido_log_debug("%s: cbor type", __func__); | 1137 | cbor_is_bool(val) == false) { |
1099 | goto out; | 1138 | fido_log_debug("%s: cbor type", __func__); |
1139 | goto out; | ||
1140 | } | ||
1141 | if (cbor_ctrl_value(val) == CBOR_CTRL_TRUE) | ||
1142 | authdata_ext->mask |= FIDO_EXT_HMAC_SECRET; | ||
1143 | } else if (strcmp(type, "credProtect") == 0) { | ||
1144 | if (cbor_isa_uint(val) == false || | ||
1145 | cbor_int_get_width(val) != CBOR_INT_8) { | ||
1146 | fido_log_debug("%s: cbor type", __func__); | ||
1147 | goto out; | ||
1148 | } | ||
1149 | authdata_ext->mask |= FIDO_EXT_CRED_PROTECT; | ||
1150 | authdata_ext->prot = cbor_get_uint8(val); | ||
1100 | } | 1151 | } |
1101 | 1152 | ||
1102 | if (cbor_ctrl_value(val) == CBOR_CTRL_TRUE) | ||
1103 | *authdata_ext |= FIDO_EXT_HMAC_SECRET; | ||
1104 | |||
1105 | ok = 0; | 1153 | ok = 0; |
1106 | out: | 1154 | out: |
1107 | free(type); | 1155 | free(type); |
@@ -1110,7 +1158,8 @@ out: | |||
1110 | } | 1158 | } |
1111 | 1159 | ||
1112 | static int | 1160 | static int |
1113 | decode_extensions(const unsigned char **buf, size_t *len, int *authdata_ext) | 1161 | decode_extensions(const unsigned char **buf, size_t *len, |
1162 | fido_cred_ext_t *authdata_ext) | ||
1114 | { | 1163 | { |
1115 | cbor_item_t *item = NULL; | 1164 | cbor_item_t *item = NULL; |
1116 | struct cbor_load_result cbor; | 1165 | struct cbor_load_result cbor; |
@@ -1118,8 +1167,9 @@ decode_extensions(const unsigned char **buf, size_t *len, int *authdata_ext) | |||
1118 | 1167 | ||
1119 | fido_log_debug("%s: buf=%p, len=%zu", __func__, (const void *)*buf, | 1168 | fido_log_debug("%s: buf=%p, len=%zu", __func__, (const void *)*buf, |
1120 | *len); | 1169 | *len); |
1170 | fido_log_xxd(*buf, *len); | ||
1121 | 1171 | ||
1122 | *authdata_ext = 0; | 1172 | memset(authdata_ext, 0, sizeof(*authdata_ext)); |
1123 | 1173 | ||
1124 | if ((item = cbor_load(*buf, *len, &cbor)) == NULL) { | 1174 | if ((item = cbor_load(*buf, *len, &cbor)) == NULL) { |
1125 | fido_log_debug("%s: cbor_load", __func__); | 1175 | fido_log_debug("%s: cbor_load", __func__); |
@@ -1129,7 +1179,6 @@ decode_extensions(const unsigned char **buf, size_t *len, int *authdata_ext) | |||
1129 | 1179 | ||
1130 | if (cbor_isa_map(item) == false || | 1180 | if (cbor_isa_map(item) == false || |
1131 | cbor_map_is_definite(item) == false || | 1181 | cbor_map_is_definite(item) == false || |
1132 | cbor_map_size(item) != 1 || | ||
1133 | cbor_map_iter(item, authdata_ext, decode_extension) < 0) { | 1182 | cbor_map_iter(item, authdata_ext, decode_extension) < 0) { |
1134 | fido_log_debug("%s: cbor type", __func__); | 1183 | fido_log_debug("%s: cbor type", __func__); |
1135 | goto fail; | 1184 | goto fail; |
@@ -1204,7 +1253,7 @@ fail: | |||
1204 | int | 1253 | int |
1205 | cbor_decode_cred_authdata(const cbor_item_t *item, int cose_alg, | 1254 | cbor_decode_cred_authdata(const cbor_item_t *item, int cose_alg, |
1206 | fido_blob_t *authdata_cbor, fido_authdata_t *authdata, | 1255 | fido_blob_t *authdata_cbor, fido_authdata_t *authdata, |
1207 | fido_attcred_t *attcred, int *authdata_ext) | 1256 | fido_attcred_t *attcred, fido_cred_ext_t *authdata_ext) |
1208 | { | 1257 | { |
1209 | const unsigned char *buf = NULL; | 1258 | const unsigned char *buf = NULL; |
1210 | size_t len; | 1259 | size_t len; |
@@ -1227,6 +1276,7 @@ cbor_decode_cred_authdata(const cbor_item_t *item, int cose_alg, | |||
1227 | len = cbor_bytestring_length(item); | 1276 | len = cbor_bytestring_length(item); |
1228 | 1277 | ||
1229 | fido_log_debug("%s: buf=%p, len=%zu", __func__, (const void *)buf, len); | 1278 | fido_log_debug("%s: buf=%p, len=%zu", __func__, (const void *)buf, len); |
1279 | fido_log_xxd(buf, len); | ||
1230 | 1280 | ||
1231 | if (fido_buf_read(&buf, &len, authdata, sizeof(*authdata)) < 0) { | 1281 | if (fido_buf_read(&buf, &len, authdata, sizeof(*authdata)) < 0) { |
1232 | fido_log_debug("%s: fido_buf_read", __func__); | 1282 | fido_log_debug("%s: fido_buf_read", __func__); |
@@ -1316,6 +1366,7 @@ decode_attstmt_entry(const cbor_item_t *key, const cbor_item_t *val, void *arg) | |||
1316 | { | 1366 | { |
1317 | fido_attstmt_t *attstmt = arg; | 1367 | fido_attstmt_t *attstmt = arg; |
1318 | char *name = NULL; | 1368 | char *name = NULL; |
1369 | int cose_alg = 0; | ||
1319 | int ok = -1; | 1370 | int ok = -1; |
1320 | 1371 | ||
1321 | if (cbor_string_copy(key, &name) < 0) { | 1372 | if (cbor_string_copy(key, &name) < 0) { |
@@ -1326,11 +1377,16 @@ decode_attstmt_entry(const cbor_item_t *key, const cbor_item_t *val, void *arg) | |||
1326 | 1377 | ||
1327 | if (!strcmp(name, "alg")) { | 1378 | if (!strcmp(name, "alg")) { |
1328 | if (cbor_isa_negint(val) == false || | 1379 | if (cbor_isa_negint(val) == false || |
1329 | cbor_int_get_width(val) != CBOR_INT_8 || | 1380 | cbor_get_int(val) > UINT16_MAX) { |
1330 | cbor_get_uint8(val) != -COSE_ES256 - 1) { | ||
1331 | fido_log_debug("%s: alg", __func__); | 1381 | fido_log_debug("%s: alg", __func__); |
1332 | goto out; | 1382 | goto out; |
1333 | } | 1383 | } |
1384 | if ((cose_alg = -(int)cbor_get_int(val) - 1) != COSE_ES256 && | ||
1385 | cose_alg != COSE_RS256 && cose_alg != COSE_EDDSA) { | ||
1386 | fido_log_debug("%s: unsupported cose_alg=%d", __func__, | ||
1387 | cose_alg); | ||
1388 | goto out; | ||
1389 | } | ||
1334 | } else if (!strcmp(name, "sig")) { | 1390 | } else if (!strcmp(name, "sig")) { |
1335 | if (cbor_bytestring_copy(val, &attstmt->sig.ptr, | 1391 | if (cbor_bytestring_copy(val, &attstmt->sig.ptr, |
1336 | &attstmt->sig.len) < 0) { | 1392 | &attstmt->sig.len) < 0) { |
@@ -76,8 +76,8 @@ fido_dev_make_cred_tx(fido_dev_t *dev, fido_cred_t *cred, const char *pin) | |||
76 | } | 76 | } |
77 | 77 | ||
78 | /* extensions */ | 78 | /* extensions */ |
79 | if (cred->ext) | 79 | if (cred->ext.mask) |
80 | if ((argv[5] = cbor_encode_extensions(cred->ext)) == NULL) { | 80 | if ((argv[5] = cbor_encode_extensions(&cred->ext)) == NULL) { |
81 | fido_log_debug("%s: cbor_encode_extensions", __func__); | 81 | fido_log_debug("%s: cbor_encode_extensions", __func__); |
82 | r = FIDO_ERR_INTERNAL; | 82 | r = FIDO_ERR_INTERNAL; |
83 | goto fail; | 83 | goto fail; |
@@ -106,8 +106,8 @@ fido_dev_make_cred_tx(fido_dev_t *dev, fido_cred_t *cred, const char *pin) | |||
106 | } | 106 | } |
107 | 107 | ||
108 | /* framing and transmission */ | 108 | /* framing and transmission */ |
109 | if (cbor_build_frame(CTAP_CBOR_MAKECRED, argv, 9, &f) < 0 || | 109 | if (cbor_build_frame(CTAP_CBOR_MAKECRED, argv, nitems(argv), &f) < 0 || |
110 | fido_tx(dev, CTAP_FRAME_INIT | CTAP_CMD_CBOR, f.ptr, f.len) < 0) { | 110 | fido_tx(dev, CTAP_CMD_CBOR, f.ptr, f.len) < 0) { |
111 | fido_log_debug("%s: fido_tx", __func__); | 111 | fido_log_debug("%s: fido_tx", __func__); |
112 | r = FIDO_ERR_TX; | 112 | r = FIDO_ERR_TX; |
113 | goto fail; | 113 | goto fail; |
@@ -126,14 +126,14 @@ fail: | |||
126 | static int | 126 | static int |
127 | fido_dev_make_cred_rx(fido_dev_t *dev, fido_cred_t *cred, int ms) | 127 | fido_dev_make_cred_rx(fido_dev_t *dev, fido_cred_t *cred, int ms) |
128 | { | 128 | { |
129 | const uint8_t cmd = CTAP_FRAME_INIT | CTAP_CMD_CBOR; | 129 | unsigned char reply[FIDO_MAXMSG]; |
130 | unsigned char reply[2048]; | ||
131 | int reply_len; | 130 | int reply_len; |
132 | int r; | 131 | int r; |
133 | 132 | ||
134 | fido_cred_reset_rx(cred); | 133 | fido_cred_reset_rx(cred); |
135 | 134 | ||
136 | if ((reply_len = fido_rx(dev, cmd, &reply, sizeof(reply), ms)) < 0) { | 135 | if ((reply_len = fido_rx(dev, CTAP_CMD_CBOR, &reply, sizeof(reply), |
136 | ms)) < 0) { | ||
137 | fido_log_debug("%s: fido_rx", __func__); | 137 | fido_log_debug("%s: fido_rx", __func__); |
138 | return (FIDO_ERR_RX); | 138 | return (FIDO_ERR_RX); |
139 | } | 139 | } |
@@ -170,7 +170,8 @@ int | |||
170 | fido_dev_make_cred(fido_dev_t *dev, fido_cred_t *cred, const char *pin) | 170 | fido_dev_make_cred(fido_dev_t *dev, fido_cred_t *cred, const char *pin) |
171 | { | 171 | { |
172 | if (fido_dev_is_fido2(dev) == false) { | 172 | if (fido_dev_is_fido2(dev) == false) { |
173 | if (pin != NULL || cred->rk == FIDO_OPT_TRUE || cred->ext != 0) | 173 | if (pin != NULL || cred->rk == FIDO_OPT_TRUE || |
174 | cred->ext.mask != 0) | ||
174 | return (FIDO_ERR_UNSUPPORTED_OPTION); | 175 | return (FIDO_ERR_UNSUPPORTED_OPTION); |
175 | return (u2f_register(dev, cred, -1)); | 176 | return (u2f_register(dev, cred, -1)); |
176 | } | 177 | } |
@@ -179,15 +180,9 @@ fido_dev_make_cred(fido_dev_t *dev, fido_cred_t *cred, const char *pin) | |||
179 | } | 180 | } |
180 | 181 | ||
181 | static int | 182 | static int |
182 | check_extensions(int authdata_ext, int ext) | 183 | check_extensions(const fido_cred_ext_t *authdata_ext, const fido_cred_ext_t *ext) |
183 | { | 184 | { |
184 | if (authdata_ext != ext) { | 185 | return (timingsafe_bcmp(authdata_ext, ext, sizeof(*authdata_ext))); |
185 | fido_log_debug("%s: authdata_ext=0x%x != ext=0x%x", __func__, | ||
186 | authdata_ext, ext); | ||
187 | return (-1); | ||
188 | } | ||
189 | |||
190 | return (0); | ||
191 | } | 186 | } |
192 | 187 | ||
193 | int | 188 | int |
@@ -208,48 +203,6 @@ fido_check_rp_id(const char *id, const unsigned char *obtained_hash) | |||
208 | } | 203 | } |
209 | 204 | ||
210 | static int | 205 | static int |
211 | get_signed_hash_packed(fido_blob_t *dgst, const fido_blob_t *clientdata, | ||
212 | const fido_blob_t *authdata_cbor) | ||
213 | { | ||
214 | cbor_item_t *item = NULL; | ||
215 | unsigned char *authdata_ptr = NULL; | ||
216 | size_t authdata_len; | ||
217 | struct cbor_load_result cbor; | ||
218 | SHA256_CTX ctx; | ||
219 | int ok = -1; | ||
220 | |||
221 | if ((item = cbor_load(authdata_cbor->ptr, authdata_cbor->len, | ||
222 | &cbor)) == NULL) { | ||
223 | fido_log_debug("%s: cbor_load", __func__); | ||
224 | goto fail; | ||
225 | } | ||
226 | |||
227 | if (cbor_isa_bytestring(item) == false || | ||
228 | cbor_bytestring_is_definite(item) == false) { | ||
229 | fido_log_debug("%s: cbor type", __func__); | ||
230 | goto fail; | ||
231 | } | ||
232 | |||
233 | authdata_ptr = cbor_bytestring_handle(item); | ||
234 | authdata_len = cbor_bytestring_length(item); | ||
235 | |||
236 | if (dgst->len != SHA256_DIGEST_LENGTH || SHA256_Init(&ctx) == 0 || | ||
237 | SHA256_Update(&ctx, authdata_ptr, authdata_len) == 0 || | ||
238 | SHA256_Update(&ctx, clientdata->ptr, clientdata->len) == 0 || | ||
239 | SHA256_Final(dgst->ptr, &ctx) == 0) { | ||
240 | fido_log_debug("%s: sha256", __func__); | ||
241 | goto fail; | ||
242 | } | ||
243 | |||
244 | ok = 0; | ||
245 | fail: | ||
246 | if (item != NULL) | ||
247 | cbor_decref(&item); | ||
248 | |||
249 | return (ok); | ||
250 | } | ||
251 | |||
252 | static int | ||
253 | get_signed_hash_u2f(fido_blob_t *dgst, const unsigned char *rp_id, | 206 | get_signed_hash_u2f(fido_blob_t *dgst, const unsigned char *rp_id, |
254 | size_t rp_id_len, const fido_blob_t *clientdata, const fido_blob_t *id, | 207 | size_t rp_id_len, const fido_blob_t *clientdata, const fido_blob_t *id, |
255 | const es256_pk_t *pk) | 208 | const es256_pk_t *pk) |
@@ -356,16 +309,16 @@ fido_cred_verify(const fido_cred_t *cred) | |||
356 | goto out; | 309 | goto out; |
357 | } | 310 | } |
358 | 311 | ||
359 | if (check_extensions(cred->authdata_ext, cred->ext) < 0) { | 312 | if (check_extensions(&cred->authdata_ext, &cred->ext) != 0) { |
360 | fido_log_debug("%s: check_extensions", __func__); | 313 | fido_log_debug("%s: check_extensions", __func__); |
361 | r = FIDO_ERR_INVALID_PARAM; | 314 | r = FIDO_ERR_INVALID_PARAM; |
362 | goto out; | 315 | goto out; |
363 | } | 316 | } |
364 | 317 | ||
365 | if (!strcmp(cred->fmt, "packed")) { | 318 | if (!strcmp(cred->fmt, "packed")) { |
366 | if (get_signed_hash_packed(&dgst, &cred->cdh, | 319 | if (fido_get_signed_hash(COSE_ES256, &dgst, &cred->cdh, |
367 | &cred->authdata_cbor) < 0) { | 320 | &cred->authdata_cbor) < 0) { |
368 | fido_log_debug("%s: get_signed_hash_packed", __func__); | 321 | fido_log_debug("%s: fido_get_signed_hash", __func__); |
369 | r = FIDO_ERR_INTERNAL; | 322 | r = FIDO_ERR_INTERNAL; |
370 | goto out; | 323 | goto out; |
371 | } | 324 | } |
@@ -395,7 +348,7 @@ out: | |||
395 | int | 348 | int |
396 | fido_cred_verify_self(const fido_cred_t *cred) | 349 | fido_cred_verify_self(const fido_cred_t *cred) |
397 | { | 350 | { |
398 | unsigned char buf[SHA256_DIGEST_LENGTH]; | 351 | unsigned char buf[1024]; /* XXX */ |
399 | fido_blob_t dgst; | 352 | fido_blob_t dgst; |
400 | int ok = -1; | 353 | int ok = -1; |
401 | int r; | 354 | int r; |
@@ -431,16 +384,16 @@ fido_cred_verify_self(const fido_cred_t *cred) | |||
431 | goto out; | 384 | goto out; |
432 | } | 385 | } |
433 | 386 | ||
434 | if (check_extensions(cred->authdata_ext, cred->ext) < 0) { | 387 | if (check_extensions(&cred->authdata_ext, &cred->ext) != 0) { |
435 | fido_log_debug("%s: check_extensions", __func__); | 388 | fido_log_debug("%s: check_extensions", __func__); |
436 | r = FIDO_ERR_INVALID_PARAM; | 389 | r = FIDO_ERR_INVALID_PARAM; |
437 | goto out; | 390 | goto out; |
438 | } | 391 | } |
439 | 392 | ||
440 | if (!strcmp(cred->fmt, "packed")) { | 393 | if (!strcmp(cred->fmt, "packed")) { |
441 | if (get_signed_hash_packed(&dgst, &cred->cdh, | 394 | if (fido_get_signed_hash(cred->attcred.type, &dgst, &cred->cdh, |
442 | &cred->authdata_cbor) < 0) { | 395 | &cred->authdata_cbor) < 0) { |
443 | fido_log_debug("%s: get_signed_hash_packed", __func__); | 396 | fido_log_debug("%s: fido_get_signed_hash", __func__); |
444 | r = FIDO_ERR_INTERNAL; | 397 | r = FIDO_ERR_INTERNAL; |
445 | goto out; | 398 | goto out; |
446 | } | 399 | } |
@@ -519,9 +472,9 @@ fido_cred_reset_tx(fido_cred_t *cred) | |||
519 | memset(&cred->rp, 0, sizeof(cred->rp)); | 472 | memset(&cred->rp, 0, sizeof(cred->rp)); |
520 | memset(&cred->user, 0, sizeof(cred->user)); | 473 | memset(&cred->user, 0, sizeof(cred->user)); |
521 | memset(&cred->excl, 0, sizeof(cred->excl)); | 474 | memset(&cred->excl, 0, sizeof(cred->excl)); |
475 | memset(&cred->ext, 0, sizeof(cred->ext)); | ||
522 | 476 | ||
523 | cred->type = 0; | 477 | cred->type = 0; |
524 | cred->ext = 0; | ||
525 | cred->rk = FIDO_OPT_OMIT; | 478 | cred->rk = FIDO_OPT_OMIT; |
526 | cred->uv = FIDO_OPT_OMIT; | 479 | cred->uv = FIDO_OPT_OMIT; |
527 | } | 480 | } |
@@ -810,10 +763,14 @@ fail: | |||
810 | int | 763 | int |
811 | fido_cred_set_extensions(fido_cred_t *cred, int ext) | 764 | fido_cred_set_extensions(fido_cred_t *cred, int ext) |
812 | { | 765 | { |
813 | if (ext != 0 && ext != FIDO_EXT_HMAC_SECRET) | 766 | if (ext == 0) |
814 | return (FIDO_ERR_INVALID_ARGUMENT); | 767 | cred->ext.mask = 0; |
815 | 768 | else { | |
816 | cred->ext = ext; | 769 | if (ext != FIDO_EXT_HMAC_SECRET && |
770 | ext != FIDO_EXT_CRED_PROTECT) | ||
771 | return (FIDO_ERR_INVALID_ARGUMENT); | ||
772 | cred->ext.mask |= ext; | ||
773 | } | ||
817 | 774 | ||
818 | return (FIDO_OK); | 775 | return (FIDO_OK); |
819 | } | 776 | } |
@@ -844,6 +801,25 @@ fido_cred_set_uv(fido_cred_t *cred, fido_opt_t uv) | |||
844 | } | 801 | } |
845 | 802 | ||
846 | int | 803 | int |
804 | fido_cred_set_prot(fido_cred_t *cred, int prot) | ||
805 | { | ||
806 | if (prot == 0) { | ||
807 | cred->ext.mask &= ~FIDO_EXT_CRED_PROTECT; | ||
808 | cred->ext.prot = 0; | ||
809 | } else { | ||
810 | if (prot != FIDO_CRED_PROT_UV_OPTIONAL && | ||
811 | prot != FIDO_CRED_PROT_UV_OPTIONAL_WITH_ID && | ||
812 | prot != FIDO_CRED_PROT_UV_REQUIRED) | ||
813 | return (FIDO_ERR_INVALID_ARGUMENT); | ||
814 | |||
815 | cred->ext.mask |= FIDO_EXT_CRED_PROTECT; | ||
816 | cred->ext.prot = prot; | ||
817 | } | ||
818 | |||
819 | return (FIDO_OK); | ||
820 | } | ||
821 | |||
822 | int | ||
847 | fido_cred_set_fmt(fido_cred_t *cred, const char *fmt) | 823 | fido_cred_set_fmt(fido_cred_t *cred, const char *fmt) |
848 | { | 824 | { |
849 | free(cred->fmt); | 825 | free(cred->fmt); |
@@ -991,6 +967,12 @@ fido_cred_id_len(const fido_cred_t *cred) | |||
991 | return (cred->attcred.id.len); | 967 | return (cred->attcred.id.len); |
992 | } | 968 | } |
993 | 969 | ||
970 | int | ||
971 | fido_cred_prot(const fido_cred_t *cred) | ||
972 | { | ||
973 | return (cred->ext.prot); | ||
974 | } | ||
975 | |||
994 | const char * | 976 | const char * |
995 | fido_cred_fmt(const fido_cred_t *cred) | 977 | fido_cred_fmt(const fido_cred_t *cred) |
996 | { | 978 | { |
diff --git a/src/credman.c b/src/credman.c index 76327e5..a382185 100644 --- a/src/credman.c +++ b/src/credman.c | |||
@@ -137,8 +137,8 @@ credman_tx(fido_dev_t *dev, uint8_t cmd, const fido_blob_t *param, | |||
137 | } | 137 | } |
138 | 138 | ||
139 | /* framing and transmission */ | 139 | /* framing and transmission */ |
140 | if (cbor_build_frame(CTAP_CBOR_CRED_MGMT_PRE, argv, 4, &f) < 0 || | 140 | if (cbor_build_frame(CTAP_CBOR_CRED_MGMT_PRE, argv, nitems(argv), |
141 | fido_tx(dev, CTAP_FRAME_INIT | CTAP_CMD_CBOR, f.ptr, f.len) < 0) { | 141 | &f) < 0 || fido_tx(dev, CTAP_CMD_CBOR, f.ptr, f.len) < 0) { |
142 | fido_log_debug("%s: fido_tx", __func__); | 142 | fido_log_debug("%s: fido_tx", __func__); |
143 | r = FIDO_ERR_TX; | 143 | r = FIDO_ERR_TX; |
144 | goto fail; | 144 | goto fail; |
@@ -181,14 +181,14 @@ credman_parse_metadata(const cbor_item_t *key, const cbor_item_t *val, | |||
181 | static int | 181 | static int |
182 | credman_rx_metadata(fido_dev_t *dev, fido_credman_metadata_t *metadata, int ms) | 182 | credman_rx_metadata(fido_dev_t *dev, fido_credman_metadata_t *metadata, int ms) |
183 | { | 183 | { |
184 | const uint8_t cmd = CTAP_FRAME_INIT | CTAP_CMD_CBOR; | 184 | unsigned char reply[FIDO_MAXMSG]; |
185 | unsigned char reply[512]; | ||
186 | int reply_len; | 185 | int reply_len; |
187 | int r; | 186 | int r; |
188 | 187 | ||
189 | memset(metadata, 0, sizeof(*metadata)); | 188 | memset(metadata, 0, sizeof(*metadata)); |
190 | 189 | ||
191 | if ((reply_len = fido_rx(dev, cmd, &reply, sizeof(reply), ms)) < 0) { | 190 | if ((reply_len = fido_rx(dev, CTAP_CMD_CBOR, &reply, sizeof(reply), |
191 | ms)) < 0) { | ||
192 | fido_log_debug("%s: fido_rx", __func__); | 192 | fido_log_debug("%s: fido_rx", __func__); |
193 | return (FIDO_ERR_RX); | 193 | return (FIDO_ERR_RX); |
194 | } | 194 | } |
@@ -300,14 +300,14 @@ credman_parse_rk_count(const cbor_item_t *key, const cbor_item_t *val, | |||
300 | static int | 300 | static int |
301 | credman_rx_rk(fido_dev_t *dev, fido_credman_rk_t *rk, int ms) | 301 | credman_rx_rk(fido_dev_t *dev, fido_credman_rk_t *rk, int ms) |
302 | { | 302 | { |
303 | const uint8_t cmd = CTAP_FRAME_INIT | CTAP_CMD_CBOR; | 303 | unsigned char reply[FIDO_MAXMSG]; |
304 | unsigned char reply[2048]; | ||
305 | int reply_len; | 304 | int reply_len; |
306 | int r; | 305 | int r; |
307 | 306 | ||
308 | credman_reset_rk(rk); | 307 | credman_reset_rk(rk); |
309 | 308 | ||
310 | if ((reply_len = fido_rx(dev, cmd, &reply, sizeof(reply), ms)) < 0) { | 309 | if ((reply_len = fido_rx(dev, CTAP_CMD_CBOR, &reply, sizeof(reply), |
310 | ms)) < 0) { | ||
311 | fido_log_debug("%s: fido_rx", __func__); | 311 | fido_log_debug("%s: fido_rx", __func__); |
312 | return (FIDO_ERR_RX); | 312 | return (FIDO_ERR_RX); |
313 | } | 313 | } |
@@ -339,12 +339,12 @@ credman_rx_rk(fido_dev_t *dev, fido_credman_rk_t *rk, int ms) | |||
339 | static int | 339 | static int |
340 | credman_rx_next_rk(fido_dev_t *dev, fido_credman_rk_t *rk, int ms) | 340 | credman_rx_next_rk(fido_dev_t *dev, fido_credman_rk_t *rk, int ms) |
341 | { | 341 | { |
342 | const uint8_t cmd = CTAP_FRAME_INIT | CTAP_CMD_CBOR; | 342 | unsigned char reply[FIDO_MAXMSG]; |
343 | unsigned char reply[2048]; | ||
344 | int reply_len; | 343 | int reply_len; |
345 | int r; | 344 | int r; |
346 | 345 | ||
347 | if ((reply_len = fido_rx(dev, cmd, &reply, sizeof(reply), ms)) < 0) { | 346 | if ((reply_len = fido_rx(dev, CTAP_CMD_CBOR, &reply, sizeof(reply), |
347 | ms)) < 0) { | ||
348 | fido_log_debug("%s: fido_rx", __func__); | 348 | fido_log_debug("%s: fido_rx", __func__); |
349 | return (FIDO_ERR_RX); | 349 | return (FIDO_ERR_RX); |
350 | } | 350 | } |
@@ -514,14 +514,14 @@ credman_parse_rp_count(const cbor_item_t *key, const cbor_item_t *val, | |||
514 | static int | 514 | static int |
515 | credman_rx_rp(fido_dev_t *dev, fido_credman_rp_t *rp, int ms) | 515 | credman_rx_rp(fido_dev_t *dev, fido_credman_rp_t *rp, int ms) |
516 | { | 516 | { |
517 | const uint8_t cmd = CTAP_FRAME_INIT | CTAP_CMD_CBOR; | 517 | unsigned char reply[FIDO_MAXMSG]; |
518 | unsigned char reply[2048]; | ||
519 | int reply_len; | 518 | int reply_len; |
520 | int r; | 519 | int r; |
521 | 520 | ||
522 | credman_reset_rp(rp); | 521 | credman_reset_rp(rp); |
523 | 522 | ||
524 | if ((reply_len = fido_rx(dev, cmd, &reply, sizeof(reply), ms)) < 0) { | 523 | if ((reply_len = fido_rx(dev, CTAP_CMD_CBOR, &reply, sizeof(reply), |
524 | ms)) < 0) { | ||
525 | fido_log_debug("%s: fido_rx", __func__); | 525 | fido_log_debug("%s: fido_rx", __func__); |
526 | return (FIDO_ERR_RX); | 526 | return (FIDO_ERR_RX); |
527 | } | 527 | } |
@@ -553,12 +553,12 @@ credman_rx_rp(fido_dev_t *dev, fido_credman_rp_t *rp, int ms) | |||
553 | static int | 553 | static int |
554 | credman_rx_next_rp(fido_dev_t *dev, fido_credman_rp_t *rp, int ms) | 554 | credman_rx_next_rp(fido_dev_t *dev, fido_credman_rp_t *rp, int ms) |
555 | { | 555 | { |
556 | const uint8_t cmd = CTAP_FRAME_INIT | CTAP_CMD_CBOR; | 556 | unsigned char reply[FIDO_MAXMSG]; |
557 | unsigned char reply[2048]; | ||
558 | int reply_len; | 557 | int reply_len; |
559 | int r; | 558 | int r; |
560 | 559 | ||
561 | if ((reply_len = fido_rx(dev, cmd, &reply, sizeof(reply), ms)) < 0) { | 560 | if ((reply_len = fido_rx(dev, CTAP_CMD_CBOR, &reply, sizeof(reply), |
561 | ms)) < 0) { | ||
562 | fido_log_debug("%s: fido_rx", __func__); | 562 | fido_log_debug("%s: fido_rx", __func__); |
563 | return (FIDO_ERR_RX); | 563 | return (FIDO_ERR_RX); |
564 | } | 564 | } |
@@ -6,6 +6,9 @@ | |||
6 | 6 | ||
7 | #include <sys/types.h> | 7 | #include <sys/types.h> |
8 | #include <sys/stat.h> | 8 | #include <sys/stat.h> |
9 | #ifdef HAVE_SYS_RANDOM_H | ||
10 | #include <sys/random.h> | ||
11 | #endif | ||
9 | 12 | ||
10 | #include <fcntl.h> | 13 | #include <fcntl.h> |
11 | #include <stdint.h> | 14 | #include <stdint.h> |
@@ -39,7 +42,22 @@ obtain_nonce(uint64_t *nonce) | |||
39 | 42 | ||
40 | return (0); | 43 | return (0); |
41 | } | 44 | } |
42 | #elif defined(HAS_DEV_URANDOM) | 45 | #elif defined(HAVE_ARC4RANDOM_BUF) |
46 | static int | ||
47 | obtain_nonce(uint64_t *nonce) | ||
48 | { | ||
49 | arc4random_buf(nonce, sizeof(*nonce)); | ||
50 | return (0); | ||
51 | } | ||
52 | #elif defined(HAVE_GETRANDOM) | ||
53 | static int | ||
54 | obtain_nonce(uint64_t *nonce) | ||
55 | { | ||
56 | if (getrandom(nonce, sizeof(*nonce), 0) < 0) | ||
57 | return (-1); | ||
58 | return (0); | ||
59 | } | ||
60 | #elif defined(HAVE_DEV_URANDOM) | ||
43 | static int | 61 | static int |
44 | obtain_nonce(uint64_t *nonce) | 62 | obtain_nonce(uint64_t *nonce) |
45 | { | 63 | { |
@@ -64,10 +82,34 @@ fail: | |||
64 | #error "please provide an implementation of obtain_nonce() for your platform" | 82 | #error "please provide an implementation of obtain_nonce() for your platform" |
65 | #endif /* _WIN32 */ | 83 | #endif /* _WIN32 */ |
66 | 84 | ||
85 | #ifndef TLS | ||
86 | #define TLS | ||
87 | #endif | ||
88 | |||
89 | typedef struct dev_manifest_func_node { | ||
90 | dev_manifest_func_t manifest_func; | ||
91 | struct dev_manifest_func_node *next; | ||
92 | } dev_manifest_func_node_t; | ||
93 | |||
94 | static TLS dev_manifest_func_node_t *manifest_funcs = NULL; | ||
95 | |||
96 | static void | ||
97 | find_manifest_func_node(dev_manifest_func_t f, dev_manifest_func_node_t **curr, | ||
98 | dev_manifest_func_node_t **prev) | ||
99 | { | ||
100 | *prev = NULL; | ||
101 | *curr = manifest_funcs; | ||
102 | |||
103 | while (*curr != NULL && (*curr)->manifest_func != f) { | ||
104 | *prev = *curr; | ||
105 | *curr = (*curr)->next; | ||
106 | } | ||
107 | } | ||
108 | |||
67 | static int | 109 | static int |
68 | fido_dev_open_tx(fido_dev_t *dev, const char *path) | 110 | fido_dev_open_tx(fido_dev_t *dev, const char *path) |
69 | { | 111 | { |
70 | const uint8_t cmd = CTAP_FRAME_INIT | CTAP_CMD_INIT; | 112 | const uint8_t cmd = CTAP_CMD_INIT; |
71 | 113 | ||
72 | if (dev->io_handle != NULL) { | 114 | if (dev->io_handle != NULL) { |
73 | fido_log_debug("%s: handle=%p", __func__, dev->io_handle); | 115 | fido_log_debug("%s: handle=%p", __func__, dev->io_handle); |
@@ -102,11 +144,14 @@ fido_dev_open_tx(fido_dev_t *dev, const char *path) | |||
102 | static int | 144 | static int |
103 | fido_dev_open_rx(fido_dev_t *dev, int ms) | 145 | fido_dev_open_rx(fido_dev_t *dev, int ms) |
104 | { | 146 | { |
105 | const uint8_t cmd = CTAP_FRAME_INIT | CTAP_CMD_INIT; | 147 | fido_cbor_info_t *info = NULL; |
106 | int n; | 148 | int reply_len; |
149 | int r; | ||
107 | 150 | ||
108 | if ((n = fido_rx(dev, cmd, &dev->attr, sizeof(dev->attr), ms)) < 0) { | 151 | if ((reply_len = fido_rx(dev, CTAP_CMD_INIT, &dev->attr, |
152 | sizeof(dev->attr), ms)) < 0) { | ||
109 | fido_log_debug("%s: fido_rx", __func__); | 153 | fido_log_debug("%s: fido_rx", __func__); |
154 | r = FIDO_ERR_RX; | ||
110 | goto fail; | 155 | goto fail; |
111 | } | 156 | } |
112 | 157 | ||
@@ -114,19 +159,42 @@ fido_dev_open_rx(fido_dev_t *dev, int ms) | |||
114 | dev->attr.nonce = dev->nonce; | 159 | dev->attr.nonce = dev->nonce; |
115 | #endif | 160 | #endif |
116 | 161 | ||
117 | if ((size_t)n != sizeof(dev->attr) || dev->attr.nonce != dev->nonce) { | 162 | if ((size_t)reply_len != sizeof(dev->attr) || |
163 | dev->attr.nonce != dev->nonce) { | ||
118 | fido_log_debug("%s: invalid nonce", __func__); | 164 | fido_log_debug("%s: invalid nonce", __func__); |
165 | r = FIDO_ERR_RX; | ||
119 | goto fail; | 166 | goto fail; |
120 | } | 167 | } |
121 | 168 | ||
122 | dev->cid = dev->attr.cid; | 169 | dev->cid = dev->attr.cid; |
123 | 170 | ||
124 | return (FIDO_OK); | 171 | if (fido_dev_is_fido2(dev)) { |
172 | if ((info = fido_cbor_info_new()) == NULL) { | ||
173 | fido_log_debug("%s: fido_cbor_info_new", __func__); | ||
174 | r = FIDO_ERR_INTERNAL; | ||
175 | goto fail; | ||
176 | } | ||
177 | if (fido_dev_get_cbor_info_wait(dev, info, ms) != FIDO_OK) { | ||
178 | fido_log_debug("%s: falling back to u2f", __func__); | ||
179 | fido_dev_force_u2f(dev); | ||
180 | } | ||
181 | } | ||
182 | |||
183 | if (fido_dev_is_fido2(dev) && info != NULL) { | ||
184 | fido_log_debug("%s: FIDO_MAXMSG=%d, maxmsgsiz=%lu", __func__, | ||
185 | FIDO_MAXMSG, (unsigned long)fido_cbor_info_maxmsgsiz(info)); | ||
186 | } | ||
187 | |||
188 | r = FIDO_OK; | ||
125 | fail: | 189 | fail: |
126 | dev->io.close(dev->io_handle); | 190 | fido_cbor_info_free(&info); |
127 | dev->io_handle = NULL; | 191 | |
192 | if (r != FIDO_OK) { | ||
193 | dev->io.close(dev->io_handle); | ||
194 | dev->io_handle = NULL; | ||
195 | } | ||
128 | 196 | ||
129 | return (FIDO_ERR_RX); | 197 | return (r); |
130 | } | 198 | } |
131 | 199 | ||
132 | static int | 200 | static int |
@@ -142,6 +210,79 @@ fido_dev_open_wait(fido_dev_t *dev, const char *path, int ms) | |||
142 | } | 210 | } |
143 | 211 | ||
144 | int | 212 | int |
213 | fido_dev_register_manifest_func(const dev_manifest_func_t f) | ||
214 | { | ||
215 | dev_manifest_func_node_t *prev, *curr, *n; | ||
216 | |||
217 | find_manifest_func_node(f, &curr, &prev); | ||
218 | if (curr != NULL) | ||
219 | return (FIDO_OK); | ||
220 | |||
221 | if ((n = calloc(1, sizeof(*n))) == NULL) { | ||
222 | fido_log_debug("%s: calloc", __func__); | ||
223 | return (FIDO_ERR_INTERNAL); | ||
224 | } | ||
225 | |||
226 | n->manifest_func = f; | ||
227 | n->next = manifest_funcs; | ||
228 | manifest_funcs = n; | ||
229 | |||
230 | return (FIDO_OK); | ||
231 | } | ||
232 | |||
233 | void | ||
234 | fido_dev_unregister_manifest_func(const dev_manifest_func_t f) | ||
235 | { | ||
236 | dev_manifest_func_node_t *prev, *curr; | ||
237 | |||
238 | find_manifest_func_node(f, &curr, &prev); | ||
239 | if (curr == NULL) | ||
240 | return; | ||
241 | if (prev != NULL) | ||
242 | prev->next = curr->next; | ||
243 | else | ||
244 | manifest_funcs = curr->next; | ||
245 | |||
246 | free(curr); | ||
247 | } | ||
248 | |||
249 | int | ||
250 | fido_dev_info_manifest(fido_dev_info_t *devlist, size_t ilen, size_t *olen) | ||
251 | { | ||
252 | dev_manifest_func_node_t *curr = NULL; | ||
253 | dev_manifest_func_t m_func; | ||
254 | size_t curr_olen; | ||
255 | int r; | ||
256 | |||
257 | *olen = 0; | ||
258 | |||
259 | if (fido_dev_register_manifest_func(fido_hid_manifest) != FIDO_OK) | ||
260 | return (FIDO_ERR_INTERNAL); | ||
261 | |||
262 | for (curr = manifest_funcs; curr != NULL; curr = curr->next) { | ||
263 | curr_olen = 0; | ||
264 | m_func = curr->manifest_func; | ||
265 | r = m_func(devlist + *olen, ilen - *olen, &curr_olen); | ||
266 | if (r != FIDO_OK) | ||
267 | return (r); | ||
268 | *olen += curr_olen; | ||
269 | if (*olen == ilen) | ||
270 | break; | ||
271 | } | ||
272 | |||
273 | return (FIDO_OK); | ||
274 | } | ||
275 | |||
276 | int | ||
277 | fido_dev_open_with_info(fido_dev_t *dev) | ||
278 | { | ||
279 | if (dev->path == NULL) | ||
280 | return (FIDO_ERR_INVALID_ARGUMENT); | ||
281 | |||
282 | return (fido_dev_open_wait(dev, dev->path, -1)); | ||
283 | } | ||
284 | |||
285 | int | ||
145 | fido_dev_open(fido_dev_t *dev, const char *path) | 286 | fido_dev_open(fido_dev_t *dev, const char *path) |
146 | { | 287 | { |
147 | return (fido_dev_open_wait(dev, path, -1)); | 288 | return (fido_dev_open_wait(dev, path, -1)); |
@@ -162,7 +303,7 @@ fido_dev_close(fido_dev_t *dev) | |||
162 | int | 303 | int |
163 | fido_dev_cancel(fido_dev_t *dev) | 304 | fido_dev_cancel(fido_dev_t *dev) |
164 | { | 305 | { |
165 | if (fido_tx(dev, CTAP_FRAME_INIT | CTAP_CMD_CANCEL, NULL, 0) < 0) | 306 | if (fido_tx(dev, CTAP_CMD_CANCEL, NULL, 0) < 0) |
166 | return (FIDO_ERR_TX); | 307 | return (FIDO_ERR_TX); |
167 | 308 | ||
168 | return (FIDO_OK); | 309 | return (FIDO_OK); |
@@ -172,7 +313,7 @@ int | |||
172 | fido_dev_set_io_functions(fido_dev_t *dev, const fido_dev_io_t *io) | 313 | fido_dev_set_io_functions(fido_dev_t *dev, const fido_dev_io_t *io) |
173 | { | 314 | { |
174 | if (dev->io_handle != NULL) { | 315 | if (dev->io_handle != NULL) { |
175 | fido_log_debug("%s: NULL handle", __func__); | 316 | fido_log_debug("%s: non-NULL handle", __func__); |
176 | return (FIDO_ERR_INVALID_ARGUMENT); | 317 | return (FIDO_ERR_INVALID_ARGUMENT); |
177 | } | 318 | } |
178 | 319 | ||
@@ -182,10 +323,20 @@ fido_dev_set_io_functions(fido_dev_t *dev, const fido_dev_io_t *io) | |||
182 | return (FIDO_ERR_INVALID_ARGUMENT); | 323 | return (FIDO_ERR_INVALID_ARGUMENT); |
183 | } | 324 | } |
184 | 325 | ||
185 | dev->io.open = io->open; | 326 | dev->io = *io; |
186 | dev->io.close = io->close; | 327 | |
187 | dev->io.read = io->read; | 328 | return (FIDO_OK); |
188 | dev->io.write = io->write; | 329 | } |
330 | |||
331 | int | ||
332 | fido_dev_set_transport_functions(fido_dev_t *dev, const fido_dev_transport_t *t) | ||
333 | { | ||
334 | if (dev->io_handle != NULL) { | ||
335 | fido_log_debug("%s: non-NULL handle", __func__); | ||
336 | return (FIDO_ERR_INVALID_ARGUMENT); | ||
337 | } | ||
338 | |||
339 | dev->transport = *t; | ||
189 | 340 | ||
190 | return (FIDO_OK); | 341 | return (FIDO_OK); |
191 | } | 342 | } |
@@ -200,21 +351,44 @@ fido_init(int flags) | |||
200 | fido_dev_t * | 351 | fido_dev_t * |
201 | fido_dev_new(void) | 352 | fido_dev_new(void) |
202 | { | 353 | { |
203 | fido_dev_t *dev; | 354 | fido_dev_t *dev; |
204 | fido_dev_io_t io; | ||
205 | 355 | ||
206 | if ((dev = calloc(1, sizeof(*dev))) == NULL) | 356 | if ((dev = calloc(1, sizeof(*dev))) == NULL) |
207 | return (NULL); | 357 | return (NULL); |
208 | 358 | ||
209 | dev->cid = CTAP_CID_BROADCAST; | 359 | dev->cid = CTAP_CID_BROADCAST; |
360 | dev->io = (fido_dev_io_t) { | ||
361 | &fido_hid_open, | ||
362 | &fido_hid_close, | ||
363 | &fido_hid_read, | ||
364 | &fido_hid_write, | ||
365 | }; | ||
366 | |||
367 | return (dev); | ||
368 | } | ||
369 | |||
370 | fido_dev_t * | ||
371 | fido_dev_new_with_info(const fido_dev_info_t *di) | ||
372 | { | ||
373 | fido_dev_t *dev; | ||
374 | |||
375 | if ((dev = calloc(1, sizeof(*dev))) == NULL) | ||
376 | return (NULL); | ||
377 | |||
378 | dev->cid = CTAP_CID_BROADCAST; | ||
379 | |||
380 | if (di->io.open == NULL || di->io.close == NULL || | ||
381 | di->io.read == NULL || di->io.write == NULL) { | ||
382 | fido_log_debug("%s: NULL function", __func__); | ||
383 | fido_dev_free(&dev); | ||
384 | return (NULL); | ||
385 | } | ||
210 | 386 | ||
211 | io.open = fido_hid_open; | 387 | dev->io = di->io; |
212 | io.close = fido_hid_close; | 388 | dev->transport = di->transport; |
213 | io.read = fido_hid_read; | ||
214 | io.write = fido_hid_write; | ||
215 | 389 | ||
216 | if (fido_dev_set_io_functions(dev, &io) != FIDO_OK) { | 390 | if ((dev->path = strdup(di->path)) == NULL) { |
217 | fido_log_debug("%s: fido_dev_set_io_functions", __func__); | 391 | fido_log_debug("%s: strdup", __func__); |
218 | fido_dev_free(&dev); | 392 | fido_dev_free(&dev); |
219 | return (NULL); | 393 | return (NULL); |
220 | } | 394 | } |
@@ -230,6 +404,7 @@ fido_dev_free(fido_dev_t **dev_p) | |||
230 | if (dev_p == NULL || (dev = *dev_p) == NULL) | 404 | if (dev_p == NULL || (dev = *dev_p) == NULL) |
231 | return; | 405 | return; |
232 | 406 | ||
407 | free(dev->path); | ||
233 | free(dev); | 408 | free(dev); |
234 | 409 | ||
235 | *dev_p = NULL; | 410 | *dev_p = NULL; |
diff --git a/src/eddsa.c b/src/eddsa.c index 92a0222..44a5563 100644 --- a/src/eddsa.c +++ b/src/eddsa.c | |||
@@ -23,6 +23,8 @@ EVP_PKEY_new_raw_public_key(int type, ENGINE *e, const unsigned char *key, | |||
23 | (void)key; | 23 | (void)key; |
24 | (void)keylen; | 24 | (void)keylen; |
25 | 25 | ||
26 | fido_log_debug("%s: unimplemented", __func__); | ||
27 | |||
26 | return (NULL); | 28 | return (NULL); |
27 | } | 29 | } |
28 | 30 | ||
@@ -34,6 +36,8 @@ EVP_PKEY_get_raw_public_key(const EVP_PKEY *pkey, unsigned char *pub, | |||
34 | (void)pub; | 36 | (void)pub; |
35 | (void)len; | 37 | (void)len; |
36 | 38 | ||
39 | fido_log_debug("%s: unimplemented", __func__); | ||
40 | |||
37 | return (0); | 41 | return (0); |
38 | } | 42 | } |
39 | 43 | ||
@@ -47,6 +51,8 @@ EVP_DigestVerify(EVP_MD_CTX *ctx, const unsigned char *sigret, size_t siglen, | |||
47 | (void)tbs; | 51 | (void)tbs; |
48 | (void)tbslen; | 52 | (void)tbslen; |
49 | 53 | ||
54 | fido_log_debug("%s: unimplemented", __func__); | ||
55 | |||
50 | return (0); | 56 | return (0); |
51 | } | 57 | } |
52 | #endif /* LIBRESSL_VERSION_NUMBER || OPENSSL_VERSION_NUMBER < 0x10101000L */ | 58 | #endif /* LIBRESSL_VERSION_NUMBER || OPENSSL_VERSION_NUMBER < 0x10101000L */ |
@@ -55,6 +61,8 @@ EVP_DigestVerify(EVP_MD_CTX *ctx, const unsigned char *sigret, size_t siglen, | |||
55 | EVP_MD_CTX * | 61 | EVP_MD_CTX * |
56 | EVP_MD_CTX_new(void) | 62 | EVP_MD_CTX_new(void) |
57 | { | 63 | { |
64 | fido_log_debug("%s: unimplemented", __func__); | ||
65 | |||
58 | return (NULL); | 66 | return (NULL); |
59 | } | 67 | } |
60 | 68 | ||
@@ -29,7 +29,7 @@ fido_strerr(int n) | |||
29 | case FIDO_ERR_INVALID_CHANNEL: | 29 | case FIDO_ERR_INVALID_CHANNEL: |
30 | return "FIDO_ERR_INVALID_CHANNEL"; | 30 | return "FIDO_ERR_INVALID_CHANNEL"; |
31 | case FIDO_ERR_CBOR_UNEXPECTED_TYPE: | 31 | case FIDO_ERR_CBOR_UNEXPECTED_TYPE: |
32 | return "FIDO_ERR_UNEXPECTED_TYPE"; | 32 | return "FIDO_ERR_CBOR_UNEXPECTED_TYPE"; |
33 | case FIDO_ERR_INVALID_CBOR: | 33 | case FIDO_ERR_INVALID_CBOR: |
34 | return "FIDO_ERR_INVALID_CBOR"; | 34 | return "FIDO_ERR_INVALID_CBOR"; |
35 | case FIDO_ERR_MISSING_PARAMETER: | 35 | case FIDO_ERR_MISSING_PARAMETER: |
@@ -45,7 +45,7 @@ fido_strerr(int n) | |||
45 | case FIDO_ERR_INVALID_CREDENTIAL: | 45 | case FIDO_ERR_INVALID_CREDENTIAL: |
46 | return "FIDO_ERR_INVALID_CREDENTIAL"; | 46 | return "FIDO_ERR_INVALID_CREDENTIAL"; |
47 | case FIDO_ERR_USER_ACTION_PENDING: | 47 | case FIDO_ERR_USER_ACTION_PENDING: |
48 | return "FIDO_ERR_ACTION_PENDING"; | 48 | return "FIDO_ERR_USER_ACTION_PENDING"; |
49 | case FIDO_ERR_OPERATION_PENDING: | 49 | case FIDO_ERR_OPERATION_PENDING: |
50 | return "FIDO_ERR_OPERATION_PENDING"; | 50 | return "FIDO_ERR_OPERATION_PENDING"; |
51 | case FIDO_ERR_NO_OPERATIONS: | 51 | case FIDO_ERR_NO_OPERATIONS: |
@@ -55,11 +55,11 @@ fido_strerr(int n) | |||
55 | case FIDO_ERR_OPERATION_DENIED: | 55 | case FIDO_ERR_OPERATION_DENIED: |
56 | return "FIDO_ERR_OPERATION_DENIED"; | 56 | return "FIDO_ERR_OPERATION_DENIED"; |
57 | case FIDO_ERR_KEY_STORE_FULL: | 57 | case FIDO_ERR_KEY_STORE_FULL: |
58 | return "FIDO_ERR_STORE_FULL"; | 58 | return "FIDO_ERR_KEY_STORE_FULL"; |
59 | case FIDO_ERR_NOT_BUSY: | 59 | case FIDO_ERR_NOT_BUSY: |
60 | return "FIDO_ERR_NOT_BUSY"; | 60 | return "FIDO_ERR_NOT_BUSY"; |
61 | case FIDO_ERR_NO_OPERATION_PENDING: | 61 | case FIDO_ERR_NO_OPERATION_PENDING: |
62 | return "FIDO_ERR_OPERATION_PENDING"; | 62 | return "FIDO_ERR_NO_OPERATION_PENDING"; |
63 | case FIDO_ERR_UNSUPPORTED_OPTION: | 63 | case FIDO_ERR_UNSUPPORTED_OPTION: |
64 | return "FIDO_ERR_UNSUPPORTED_OPTION"; | 64 | return "FIDO_ERR_UNSUPPORTED_OPTION"; |
65 | case FIDO_ERR_INVALID_OPTION: | 65 | case FIDO_ERR_INVALID_OPTION: |
@@ -69,7 +69,7 @@ fido_strerr(int n) | |||
69 | case FIDO_ERR_NO_CREDENTIALS: | 69 | case FIDO_ERR_NO_CREDENTIALS: |
70 | return "FIDO_ERR_NO_CREDENTIALS"; | 70 | return "FIDO_ERR_NO_CREDENTIALS"; |
71 | case FIDO_ERR_USER_ACTION_TIMEOUT: | 71 | case FIDO_ERR_USER_ACTION_TIMEOUT: |
72 | return "FIDO_ERR_ACTION_TIMEOUT"; | 72 | return "FIDO_ERR_USER_ACTION_TIMEOUT"; |
73 | case FIDO_ERR_NOT_ALLOWED: | 73 | case FIDO_ERR_NOT_ALLOWED: |
74 | return "FIDO_ERR_NOT_ALLOWED"; | 74 | return "FIDO_ERR_NOT_ALLOWED"; |
75 | case FIDO_ERR_PIN_INVALID: | 75 | case FIDO_ERR_PIN_INVALID: |
@@ -77,25 +77,25 @@ fido_strerr(int n) | |||
77 | case FIDO_ERR_PIN_BLOCKED: | 77 | case FIDO_ERR_PIN_BLOCKED: |
78 | return "FIDO_ERR_PIN_BLOCKED"; | 78 | return "FIDO_ERR_PIN_BLOCKED"; |
79 | case FIDO_ERR_PIN_AUTH_INVALID: | 79 | case FIDO_ERR_PIN_AUTH_INVALID: |
80 | return "FIDO_ERR_AUTH_INVALID"; | 80 | return "FIDO_ERR_PIN_AUTH_INVALID"; |
81 | case FIDO_ERR_PIN_AUTH_BLOCKED: | 81 | case FIDO_ERR_PIN_AUTH_BLOCKED: |
82 | return "FIDO_ERR_AUTH_BLOCKED"; | 82 | return "FIDO_ERR_PIN_AUTH_BLOCKED"; |
83 | case FIDO_ERR_PIN_NOT_SET: | 83 | case FIDO_ERR_PIN_NOT_SET: |
84 | return "FIDO_ERR_NOT_SET"; | 84 | return "FIDO_ERR_PIN_NOT_SET"; |
85 | case FIDO_ERR_PIN_REQUIRED: | 85 | case FIDO_ERR_PIN_REQUIRED: |
86 | return "FIDO_ERR_PIN_REQUIRED"; | 86 | return "FIDO_ERR_PIN_REQUIRED"; |
87 | case FIDO_ERR_PIN_POLICY_VIOLATION: | 87 | case FIDO_ERR_PIN_POLICY_VIOLATION: |
88 | return "FIDO_ERR_POLICY_VIOLATION"; | 88 | return "FIDO_ERR_PIN_POLICY_VIOLATION"; |
89 | case FIDO_ERR_PIN_TOKEN_EXPIRED: | 89 | case FIDO_ERR_PIN_TOKEN_EXPIRED: |
90 | return "FIDO_ERR_TOKEN_EXPIRED"; | 90 | return "FIDO_ERR_PIN_TOKEN_EXPIRED"; |
91 | case FIDO_ERR_REQUEST_TOO_LARGE: | 91 | case FIDO_ERR_REQUEST_TOO_LARGE: |
92 | return "FIDO_ERR_TOO_LARGE"; | 92 | return "FIDO_ERR_REQUEST_TOO_LARGE"; |
93 | case FIDO_ERR_ACTION_TIMEOUT: | 93 | case FIDO_ERR_ACTION_TIMEOUT: |
94 | return "FIDO_ERR_ACTION_TIMEOUT"; | 94 | return "FIDO_ERR_ACTION_TIMEOUT"; |
95 | case FIDO_ERR_UP_REQUIRED: | 95 | case FIDO_ERR_UP_REQUIRED: |
96 | return "FIDO_ERR_UP_REQUIRED"; | 96 | return "FIDO_ERR_UP_REQUIRED"; |
97 | case FIDO_ERR_ERR_OTHER: | 97 | case FIDO_ERR_ERR_OTHER: |
98 | return "FIDO_ERR_OTHER"; | 98 | return "FIDO_ERR_ERR_OTHER"; |
99 | case FIDO_ERR_SPEC_LAST: | 99 | case FIDO_ERR_SPEC_LAST: |
100 | return "FIDO_ERR_SPEC_LAST"; | 100 | return "FIDO_ERR_SPEC_LAST"; |
101 | case FIDO_ERR_TX: | 101 | case FIDO_ERR_TX: |
diff --git a/src/es256.c b/src/es256.c index c8fd9f4..020ecaa 100644 --- a/src/es256.c +++ b/src/es256.c | |||
@@ -176,10 +176,15 @@ es256_pk_free(es256_pk_t **pkp) | |||
176 | int | 176 | int |
177 | es256_pk_from_ptr(es256_pk_t *pk, const void *ptr, size_t len) | 177 | es256_pk_from_ptr(es256_pk_t *pk, const void *ptr, size_t len) |
178 | { | 178 | { |
179 | const uint8_t *p = ptr; | ||
180 | |||
179 | if (len < sizeof(*pk)) | 181 | if (len < sizeof(*pk)) |
180 | return (FIDO_ERR_INVALID_ARGUMENT); | 182 | return (FIDO_ERR_INVALID_ARGUMENT); |
181 | 183 | ||
182 | memcpy(pk, ptr, sizeof(*pk)); | 184 | if (len == sizeof(*pk) + 1 && *p == 0x04) |
185 | memcpy(pk, ++p, sizeof(*pk)); /* uncompressed format */ | ||
186 | else | ||
187 | memcpy(pk, ptr, sizeof(*pk)); /* libfido2 x||y format */ | ||
183 | 188 | ||
184 | return (FIDO_OK); | 189 | return (FIDO_OK); |
185 | } | 190 | } |
@@ -262,8 +267,12 @@ es256_pk_to_EVP_PKEY(const es256_pk_t *k) | |||
262 | const int nid = NID_X9_62_prime256v1; | 267 | const int nid = NID_X9_62_prime256v1; |
263 | int ok = -1; | 268 | int ok = -1; |
264 | 269 | ||
265 | if ((bnctx = BN_CTX_new()) == NULL || | 270 | if ((bnctx = BN_CTX_new()) == NULL) |
266 | (x = BN_CTX_get(bnctx)) == NULL || | 271 | goto fail; |
272 | |||
273 | BN_CTX_start(bnctx); | ||
274 | |||
275 | if ((x = BN_CTX_get(bnctx)) == NULL || | ||
267 | (y = BN_CTX_get(bnctx)) == NULL) | 276 | (y = BN_CTX_get(bnctx)) == NULL) |
268 | goto fail; | 277 | goto fail; |
269 | 278 | ||
@@ -296,12 +305,16 @@ es256_pk_to_EVP_PKEY(const es256_pk_t *k) | |||
296 | 305 | ||
297 | ok = 0; | 306 | ok = 0; |
298 | fail: | 307 | fail: |
299 | if (bnctx != NULL) | 308 | if (bnctx != NULL) { |
309 | BN_CTX_end(bnctx); | ||
300 | BN_CTX_free(bnctx); | 310 | BN_CTX_free(bnctx); |
311 | } | ||
312 | |||
301 | if (ec != NULL) | 313 | if (ec != NULL) |
302 | EC_KEY_free(ec); | 314 | EC_KEY_free(ec); |
303 | if (q != NULL) | 315 | if (q != NULL) |
304 | EC_POINT_free(q); | 316 | EC_POINT_free(q); |
317 | |||
305 | if (ok < 0 && pkey != NULL) { | 318 | if (ok < 0 && pkey != NULL) { |
306 | EVP_PKEY_free(pkey); | 319 | EVP_PKEY_free(pkey); |
307 | pkey = NULL; | 320 | pkey = NULL; |
@@ -313,7 +326,7 @@ fail: | |||
313 | int | 326 | int |
314 | es256_pk_from_EC_KEY(es256_pk_t *pk, const EC_KEY *ec) | 327 | es256_pk_from_EC_KEY(es256_pk_t *pk, const EC_KEY *ec) |
315 | { | 328 | { |
316 | BN_CTX *ctx = NULL; | 329 | BN_CTX *bnctx = NULL; |
317 | BIGNUM *x = NULL; | 330 | BIGNUM *x = NULL; |
318 | BIGNUM *y = NULL; | 331 | BIGNUM *y = NULL; |
319 | const EC_POINT *q = NULL; | 332 | const EC_POINT *q = NULL; |
@@ -322,15 +335,17 @@ es256_pk_from_EC_KEY(es256_pk_t *pk, const EC_KEY *ec) | |||
322 | int n; | 335 | int n; |
323 | 336 | ||
324 | if ((q = EC_KEY_get0_public_key(ec)) == NULL || | 337 | if ((q = EC_KEY_get0_public_key(ec)) == NULL || |
325 | (g = EC_KEY_get0_group(ec)) == NULL) | 338 | (g = EC_KEY_get0_group(ec)) == NULL || |
339 | (bnctx = BN_CTX_new()) == NULL) | ||
326 | goto fail; | 340 | goto fail; |
327 | 341 | ||
328 | if ((ctx = BN_CTX_new()) == NULL || | 342 | BN_CTX_start(bnctx); |
329 | (x = BN_CTX_get(ctx)) == NULL || | 343 | |
330 | (y = BN_CTX_get(ctx)) == NULL) | 344 | if ((x = BN_CTX_get(bnctx)) == NULL || |
345 | (y = BN_CTX_get(bnctx)) == NULL) | ||
331 | goto fail; | 346 | goto fail; |
332 | 347 | ||
333 | if (EC_POINT_get_affine_coordinates_GFp(g, q, x, y, ctx) == 0 || | 348 | if (EC_POINT_get_affine_coordinates_GFp(g, q, x, y, bnctx) == 0 || |
334 | (n = BN_num_bytes(x)) < 0 || (size_t)n > sizeof(pk->x) || | 349 | (n = BN_num_bytes(x)) < 0 || (size_t)n > sizeof(pk->x) || |
335 | (n = BN_num_bytes(y)) < 0 || (size_t)n > sizeof(pk->y)) { | 350 | (n = BN_num_bytes(y)) < 0 || (size_t)n > sizeof(pk->y)) { |
336 | fido_log_debug("%s: EC_POINT_get_affine_coordinates_GFp", | 351 | fido_log_debug("%s: EC_POINT_get_affine_coordinates_GFp", |
@@ -346,8 +361,10 @@ es256_pk_from_EC_KEY(es256_pk_t *pk, const EC_KEY *ec) | |||
346 | 361 | ||
347 | ok = FIDO_OK; | 362 | ok = FIDO_OK; |
348 | fail: | 363 | fail: |
349 | if (ctx != NULL) | 364 | if (bnctx != NULL) { |
350 | BN_CTX_free(ctx); | 365 | BN_CTX_end(bnctx); |
366 | BN_CTX_free(bnctx); | ||
367 | } | ||
351 | 368 | ||
352 | return (ok); | 369 | return (ok); |
353 | } | 370 | } |
@@ -362,7 +379,12 @@ es256_sk_to_EVP_PKEY(const es256_sk_t *k) | |||
362 | const int nid = NID_X9_62_prime256v1; | 379 | const int nid = NID_X9_62_prime256v1; |
363 | int ok = -1; | 380 | int ok = -1; |
364 | 381 | ||
365 | if ((bnctx = BN_CTX_new()) == NULL || (d = BN_CTX_get(bnctx)) == NULL || | 382 | if ((bnctx = BN_CTX_new()) == NULL) |
383 | goto fail; | ||
384 | |||
385 | BN_CTX_start(bnctx); | ||
386 | |||
387 | if ((d = BN_CTX_get(bnctx)) == NULL || | ||
366 | BN_bin2bn(k->d, sizeof(k->d), d) == NULL) { | 388 | BN_bin2bn(k->d, sizeof(k->d), d) == NULL) { |
367 | fido_log_debug("%s: BN_bin2bn", __func__); | 389 | fido_log_debug("%s: BN_bin2bn", __func__); |
368 | goto fail; | 390 | goto fail; |
@@ -384,10 +406,14 @@ es256_sk_to_EVP_PKEY(const es256_sk_t *k) | |||
384 | 406 | ||
385 | ok = 0; | 407 | ok = 0; |
386 | fail: | 408 | fail: |
387 | if (bnctx != NULL) | 409 | if (bnctx != NULL) { |
410 | BN_CTX_end(bnctx); | ||
388 | BN_CTX_free(bnctx); | 411 | BN_CTX_free(bnctx); |
412 | } | ||
413 | |||
389 | if (ec != NULL) | 414 | if (ec != NULL) |
390 | EC_KEY_free(ec); | 415 | EC_KEY_free(ec); |
416 | |||
391 | if (ok < 0 && pkey != NULL) { | 417 | if (ok < 0 && pkey != NULL) { |
392 | EVP_PKEY_free(pkey); | 418 | EVP_PKEY_free(pkey); |
393 | pkey = NULL; | 419 | pkey = NULL; |
diff --git a/src/export.gnu b/src/export.gnu index f111e33..cbfa69f 100644 --- a/src/export.gnu +++ b/src/export.gnu | |||
@@ -76,6 +76,7 @@ | |||
76 | fido_cbor_info_extensions_ptr; | 76 | fido_cbor_info_extensions_ptr; |
77 | fido_cbor_info_free; | 77 | fido_cbor_info_free; |
78 | fido_cbor_info_maxmsgsiz; | 78 | fido_cbor_info_maxmsgsiz; |
79 | fido_cbor_info_fwversion; | ||
79 | fido_cbor_info_new; | 80 | fido_cbor_info_new; |
80 | fido_cbor_info_options_len; | 81 | fido_cbor_info_options_len; |
81 | fido_cbor_info_options_name_ptr; | 82 | fido_cbor_info_options_name_ptr; |
@@ -115,6 +116,7 @@ | |||
115 | fido_credman_rp_name; | 116 | fido_credman_rp_name; |
116 | fido_credman_rp_new; | 117 | fido_credman_rp_new; |
117 | fido_cred_new; | 118 | fido_cred_new; |
119 | fido_cred_prot; | ||
118 | fido_cred_pubkey_len; | 120 | fido_cred_pubkey_len; |
119 | fido_cred_pubkey_ptr; | 121 | fido_cred_pubkey_ptr; |
120 | fido_cred_rp_id; | 122 | fido_cred_rp_id; |
@@ -125,6 +127,7 @@ | |||
125 | fido_cred_set_extensions; | 127 | fido_cred_set_extensions; |
126 | fido_cred_set_fmt; | 128 | fido_cred_set_fmt; |
127 | fido_cred_set_options; | 129 | fido_cred_set_options; |
130 | fido_cred_set_prot; | ||
128 | fido_cred_set_rk; | 131 | fido_cred_set_rk; |
129 | fido_cred_set_rp; | 132 | fido_cred_set_rp; |
130 | fido_cred_set_sig; | 133 | fido_cred_set_sig; |
@@ -171,7 +174,9 @@ | |||
171 | fido_dev_reset; | 174 | fido_dev_reset; |
172 | fido_dev_set_io_functions; | 175 | fido_dev_set_io_functions; |
173 | fido_dev_set_pin; | 176 | fido_dev_set_pin; |
177 | fido_dev_set_transport_functions; | ||
174 | fido_init; | 178 | fido_init; |
179 | fido_set_log_handler; | ||
175 | fido_strerr; | 180 | fido_strerr; |
176 | rs256_pk_free; | 181 | rs256_pk_free; |
177 | rs256_pk_from_ptr; | 182 | rs256_pk_from_ptr; |
diff --git a/src/export.llvm b/src/export.llvm index ef99a26..abde2e9 100644 --- a/src/export.llvm +++ b/src/export.llvm | |||
@@ -74,6 +74,7 @@ _fido_cbor_info_extensions_len | |||
74 | _fido_cbor_info_extensions_ptr | 74 | _fido_cbor_info_extensions_ptr |
75 | _fido_cbor_info_free | 75 | _fido_cbor_info_free |
76 | _fido_cbor_info_maxmsgsiz | 76 | _fido_cbor_info_maxmsgsiz |
77 | _fido_cbor_info_fwversion | ||
77 | _fido_cbor_info_new | 78 | _fido_cbor_info_new |
78 | _fido_cbor_info_options_len | 79 | _fido_cbor_info_options_len |
79 | _fido_cbor_info_options_name_ptr | 80 | _fido_cbor_info_options_name_ptr |
@@ -113,6 +114,7 @@ _fido_credman_rp_id_hash_ptr | |||
113 | _fido_credman_rp_name | 114 | _fido_credman_rp_name |
114 | _fido_credman_rp_new | 115 | _fido_credman_rp_new |
115 | _fido_cred_new | 116 | _fido_cred_new |
117 | _fido_cred_prot | ||
116 | _fido_cred_pubkey_len | 118 | _fido_cred_pubkey_len |
117 | _fido_cred_pubkey_ptr | 119 | _fido_cred_pubkey_ptr |
118 | _fido_cred_rp_id | 120 | _fido_cred_rp_id |
@@ -123,6 +125,7 @@ _fido_cred_set_clientdata_hash | |||
123 | _fido_cred_set_extensions | 125 | _fido_cred_set_extensions |
124 | _fido_cred_set_fmt | 126 | _fido_cred_set_fmt |
125 | _fido_cred_set_options | 127 | _fido_cred_set_options |
128 | _fido_cred_set_prot | ||
126 | _fido_cred_set_rk | 129 | _fido_cred_set_rk |
127 | _fido_cred_set_rp | 130 | _fido_cred_set_rp |
128 | _fido_cred_set_sig | 131 | _fido_cred_set_sig |
@@ -169,7 +172,9 @@ _fido_dev_protocol | |||
169 | _fido_dev_reset | 172 | _fido_dev_reset |
170 | _fido_dev_set_io_functions | 173 | _fido_dev_set_io_functions |
171 | _fido_dev_set_pin | 174 | _fido_dev_set_pin |
175 | _fido_dev_set_transport_functions | ||
172 | _fido_init | 176 | _fido_init |
177 | _fido_set_log_handler | ||
173 | _fido_strerr | 178 | _fido_strerr |
174 | _rs256_pk_free | 179 | _rs256_pk_free |
175 | _rs256_pk_from_ptr | 180 | _rs256_pk_from_ptr |
diff --git a/src/export.msvc b/src/export.msvc index ff5425a..06ec69a 100644 --- a/src/export.msvc +++ b/src/export.msvc | |||
@@ -75,6 +75,7 @@ fido_cbor_info_extensions_len | |||
75 | fido_cbor_info_extensions_ptr | 75 | fido_cbor_info_extensions_ptr |
76 | fido_cbor_info_free | 76 | fido_cbor_info_free |
77 | fido_cbor_info_maxmsgsiz | 77 | fido_cbor_info_maxmsgsiz |
78 | fido_cbor_info_fwversion | ||
78 | fido_cbor_info_new | 79 | fido_cbor_info_new |
79 | fido_cbor_info_options_len | 80 | fido_cbor_info_options_len |
80 | fido_cbor_info_options_name_ptr | 81 | fido_cbor_info_options_name_ptr |
@@ -114,6 +115,7 @@ fido_credman_rp_id_hash_ptr | |||
114 | fido_credman_rp_name | 115 | fido_credman_rp_name |
115 | fido_credman_rp_new | 116 | fido_credman_rp_new |
116 | fido_cred_new | 117 | fido_cred_new |
118 | fido_cred_prot | ||
117 | fido_cred_pubkey_len | 119 | fido_cred_pubkey_len |
118 | fido_cred_pubkey_ptr | 120 | fido_cred_pubkey_ptr |
119 | fido_cred_rp_id | 121 | fido_cred_rp_id |
@@ -124,6 +126,7 @@ fido_cred_set_clientdata_hash | |||
124 | fido_cred_set_extensions | 126 | fido_cred_set_extensions |
125 | fido_cred_set_fmt | 127 | fido_cred_set_fmt |
126 | fido_cred_set_options | 128 | fido_cred_set_options |
129 | fido_cred_set_prot | ||
127 | fido_cred_set_rk | 130 | fido_cred_set_rk |
128 | fido_cred_set_rp | 131 | fido_cred_set_rp |
129 | fido_cred_set_sig | 132 | fido_cred_set_sig |
@@ -170,7 +173,9 @@ fido_dev_protocol | |||
170 | fido_dev_reset | 173 | fido_dev_reset |
171 | fido_dev_set_io_functions | 174 | fido_dev_set_io_functions |
172 | fido_dev_set_pin | 175 | fido_dev_set_pin |
176 | fido_dev_set_transport_functions | ||
173 | fido_init | 177 | fido_init |
178 | fido_set_log_handler | ||
174 | fido_strerr | 179 | fido_strerr |
175 | rs256_pk_free | 180 | rs256_pk_free |
176 | rs256_pk_from_ptr | 181 | rs256_pk_from_ptr |
diff --git a/src/extern.h b/src/extern.h index c35af58..fc0a49d 100644 --- a/src/extern.h +++ b/src/extern.h | |||
@@ -7,6 +7,15 @@ | |||
7 | #ifndef _EXTERN_H | 7 | #ifndef _EXTERN_H |
8 | #define _EXTERN_H | 8 | #define _EXTERN_H |
9 | 9 | ||
10 | #include <stdint.h> | ||
11 | |||
12 | #include "fido/types.h" | ||
13 | #include "blob.h" | ||
14 | |||
15 | #ifdef __cplusplus | ||
16 | extern "C" { | ||
17 | #endif /* __cplusplus */ | ||
18 | |||
10 | /* aes256 */ | 19 | /* aes256 */ |
11 | int aes256_cbc_dec(const fido_blob_t *, const fido_blob_t *, fido_blob_t *); | 20 | int aes256_cbc_dec(const fido_blob_t *, const fido_blob_t *, fido_blob_t *); |
12 | int aes256_cbc_enc(const fido_blob_t *, const fido_blob_t *, fido_blob_t *); | 21 | int aes256_cbc_enc(const fido_blob_t *, const fido_blob_t *, fido_blob_t *); |
@@ -16,7 +25,7 @@ cbor_item_t *cbor_flatten_vector(cbor_item_t **, size_t); | |||
16 | cbor_item_t *cbor_encode_assert_options(fido_opt_t, fido_opt_t); | 25 | cbor_item_t *cbor_encode_assert_options(fido_opt_t, fido_opt_t); |
17 | cbor_item_t *cbor_encode_change_pin_auth(const fido_blob_t *, | 26 | cbor_item_t *cbor_encode_change_pin_auth(const fido_blob_t *, |
18 | const fido_blob_t *, const fido_blob_t *); | 27 | const fido_blob_t *, const fido_blob_t *); |
19 | cbor_item_t *cbor_encode_extensions(int); | 28 | cbor_item_t *cbor_encode_extensions(const fido_cred_ext_t *); |
20 | cbor_item_t *cbor_encode_hmac_secret_param(const fido_blob_t *, | 29 | cbor_item_t *cbor_encode_hmac_secret_param(const fido_blob_t *, |
21 | const es256_pk_t *, const fido_blob_t *); | 30 | const es256_pk_t *, const fido_blob_t *); |
22 | cbor_item_t *cbor_encode_options(fido_opt_t, fido_opt_t); | 31 | cbor_item_t *cbor_encode_options(fido_opt_t, fido_opt_t); |
@@ -35,7 +44,7 @@ cbor_item_t *es256_pk_encode(const es256_pk_t *, int); | |||
35 | /* cbor decoding functions */ | 44 | /* cbor decoding functions */ |
36 | int cbor_decode_attstmt(const cbor_item_t *, fido_attstmt_t *); | 45 | int cbor_decode_attstmt(const cbor_item_t *, fido_attstmt_t *); |
37 | int cbor_decode_cred_authdata(const cbor_item_t *, int, fido_blob_t *, | 46 | int cbor_decode_cred_authdata(const cbor_item_t *, int, fido_blob_t *, |
38 | fido_authdata_t *, fido_attcred_t *, int *); | 47 | fido_authdata_t *, fido_attcred_t *, fido_cred_ext_t *); |
39 | int cbor_decode_assert_authdata(const cbor_item_t *, fido_blob_t *, | 48 | int cbor_decode_assert_authdata(const cbor_item_t *, fido_blob_t *, |
40 | fido_authdata_t *, int *, fido_blob_t *); | 49 | fido_authdata_t *, int *, fido_blob_t *); |
41 | int cbor_decode_cred_id(const cbor_item_t *, fido_blob_t *); | 50 | int cbor_decode_cred_id(const cbor_item_t *, fido_blob_t *); |
@@ -77,8 +86,8 @@ int fido_buf_write(unsigned char **, size_t *, const void *, size_t); | |||
77 | /* hid i/o */ | 86 | /* hid i/o */ |
78 | void *fido_hid_open(const char *); | 87 | void *fido_hid_open(const char *); |
79 | void fido_hid_close(void *); | 88 | void fido_hid_close(void *); |
80 | int fido_hid_read(void *, unsigned char *, size_t, int); | 89 | int fido_hid_read(void *, unsigned char *, size_t, int); |
81 | int fido_hid_write(void *, const unsigned char *, size_t); | 90 | int fido_hid_write(void *, const unsigned char *, size_t); |
82 | 91 | ||
83 | /* generic i/o */ | 92 | /* generic i/o */ |
84 | int fido_rx_cbor_status(fido_dev_t *, int); | 93 | int fido_rx_cbor_status(fido_dev_t *, int); |
@@ -109,6 +118,7 @@ int u2f_authenticate(fido_dev_t *, fido_assert_t *, int); | |||
109 | 118 | ||
110 | /* unexposed fido ops */ | 119 | /* unexposed fido ops */ |
111 | int fido_dev_authkey(fido_dev_t *, es256_pk_t *); | 120 | int fido_dev_authkey(fido_dev_t *, es256_pk_t *); |
121 | int fido_dev_get_cbor_info_wait(fido_dev_t *, fido_cbor_info_t *, int); | ||
112 | int fido_dev_get_pin_token(fido_dev_t *, const char *, const fido_blob_t *, | 122 | int fido_dev_get_pin_token(fido_dev_t *, const char *, const fido_blob_t *, |
113 | const es256_pk_t *, fido_blob_t *); | 123 | const es256_pk_t *, fido_blob_t *); |
114 | int fido_do_ecdh(fido_dev_t *, es256_pk_t **, fido_blob_t **); | 124 | int fido_do_ecdh(fido_dev_t *, es256_pk_t **, fido_blob_t **); |
@@ -128,5 +138,19 @@ int fido_verify_sig_rs256(const fido_blob_t *, const rs256_pk_t *, | |||
128 | const fido_blob_t *); | 138 | const fido_blob_t *); |
129 | int fido_verify_sig_eddsa(const fido_blob_t *, const eddsa_pk_t *, | 139 | int fido_verify_sig_eddsa(const fido_blob_t *, const eddsa_pk_t *, |
130 | const fido_blob_t *); | 140 | const fido_blob_t *); |
141 | int fido_get_signed_hash(int, fido_blob_t *, const fido_blob_t *, | ||
142 | const fido_blob_t *); | ||
143 | |||
144 | /* hid device manifest */ | ||
145 | int fido_hid_manifest(fido_dev_info_t *, size_t, size_t *); | ||
146 | |||
147 | /* device manifest registration */ | ||
148 | typedef int (*dev_manifest_func_t)(fido_dev_info_t *, size_t, size_t *); | ||
149 | int fido_dev_register_manifest_func(const dev_manifest_func_t); | ||
150 | void fido_dev_unregister_manifest_func(const dev_manifest_func_t); | ||
151 | |||
152 | #ifdef __cplusplus | ||
153 | } /* extern "C" */ | ||
154 | #endif /* __cplusplus */ | ||
131 | 155 | ||
132 | #endif /* !_EXTERN_H */ | 156 | #endif /* !_EXTERN_H */ |
@@ -14,24 +14,6 @@ | |||
14 | #include <stdint.h> | 14 | #include <stdint.h> |
15 | #include <stdlib.h> | 15 | #include <stdlib.h> |
16 | 16 | ||
17 | typedef void *fido_dev_io_open_t(const char *); | ||
18 | typedef void fido_dev_io_close_t(void *); | ||
19 | typedef int fido_dev_io_read_t(void *, unsigned char *, size_t, int); | ||
20 | typedef int fido_dev_io_write_t(void *, const unsigned char *, size_t); | ||
21 | |||
22 | typedef struct fido_dev_io { | ||
23 | fido_dev_io_open_t *open; | ||
24 | fido_dev_io_close_t *close; | ||
25 | fido_dev_io_read_t *read; | ||
26 | fido_dev_io_write_t *write; | ||
27 | } fido_dev_io_t; | ||
28 | |||
29 | typedef enum { | ||
30 | FIDO_OPT_OMIT = 0, /* use authenticator's default */ | ||
31 | FIDO_OPT_FALSE, /* explicitly set option to false */ | ||
32 | FIDO_OPT_TRUE, /* explicitly set option to true */ | ||
33 | } fido_opt_t; | ||
34 | |||
35 | #ifdef _FIDO_INTERNAL | 17 | #ifdef _FIDO_INTERNAL |
36 | #include <cbor.h> | 18 | #include <cbor.h> |
37 | #include <limits.h> | 19 | #include <limits.h> |
@@ -39,28 +21,21 @@ typedef enum { | |||
39 | #include "blob.h" | 21 | #include "blob.h" |
40 | #include "../openbsd-compat/openbsd-compat.h" | 22 | #include "../openbsd-compat/openbsd-compat.h" |
41 | #include "iso7816.h" | 23 | #include "iso7816.h" |
42 | #include "types.h" | ||
43 | #include "extern.h" | 24 | #include "extern.h" |
44 | #endif | 25 | #endif |
45 | 26 | ||
46 | #include "fido/err.h" | 27 | #include "fido/err.h" |
47 | #include "fido/param.h" | 28 | #include "fido/param.h" |
29 | #include "fido/types.h" | ||
48 | 30 | ||
49 | #ifndef _FIDO_INTERNAL | 31 | #ifdef __cplusplus |
50 | typedef struct fido_assert fido_assert_t; | 32 | extern "C" { |
51 | typedef struct fido_cbor_info fido_cbor_info_t; | 33 | #endif /* __cplusplus */ |
52 | typedef struct fido_cred fido_cred_t; | ||
53 | typedef struct fido_dev fido_dev_t; | ||
54 | typedef struct fido_dev_info fido_dev_info_t; | ||
55 | typedef struct es256_pk es256_pk_t; | ||
56 | typedef struct es256_sk es256_sk_t; | ||
57 | typedef struct rs256_pk rs256_pk_t; | ||
58 | typedef struct eddsa_pk eddsa_pk_t; | ||
59 | #endif | ||
60 | 34 | ||
61 | fido_assert_t *fido_assert_new(void); | 35 | fido_assert_t *fido_assert_new(void); |
62 | fido_cred_t *fido_cred_new(void); | 36 | fido_cred_t *fido_cred_new(void); |
63 | fido_dev_t *fido_dev_new(void); | 37 | fido_dev_t *fido_dev_new(void); |
38 | fido_dev_t *fido_dev_new_with_info(const fido_dev_info_t *); | ||
64 | fido_dev_info_t *fido_dev_info_new(size_t); | 39 | fido_dev_info_t *fido_dev_info_new(size_t); |
65 | fido_cbor_info_t *fido_cbor_info_new(void); | 40 | fido_cbor_info_t *fido_cbor_info_new(void); |
66 | 41 | ||
@@ -76,6 +51,7 @@ void fido_dev_info_free(fido_dev_info_t **, size_t); | |||
76 | #define FIDO_DEBUG 0x01 | 51 | #define FIDO_DEBUG 0x01 |
77 | 52 | ||
78 | void fido_init(int); | 53 | void fido_init(int); |
54 | void fido_set_log_handler(fido_log_handler_t *); | ||
79 | 55 | ||
80 | const unsigned char *fido_assert_authdata_ptr(const fido_assert_t *, size_t); | 56 | const unsigned char *fido_assert_authdata_ptr(const fido_assert_t *, size_t); |
81 | const unsigned char *fido_assert_clientdata_hash_ptr(const fido_assert_t *); | 57 | const unsigned char *fido_assert_clientdata_hash_ptr(const fido_assert_t *); |
@@ -121,19 +97,23 @@ int fido_assert_set_clientdata_hash(fido_assert_t *, const unsigned char *, | |||
121 | int fido_assert_set_count(fido_assert_t *, size_t); | 97 | int fido_assert_set_count(fido_assert_t *, size_t); |
122 | int fido_assert_set_extensions(fido_assert_t *, int); | 98 | int fido_assert_set_extensions(fido_assert_t *, int); |
123 | int fido_assert_set_hmac_salt(fido_assert_t *, const unsigned char *, size_t); | 99 | int fido_assert_set_hmac_salt(fido_assert_t *, const unsigned char *, size_t); |
124 | int fido_assert_set_options(fido_assert_t *, bool, bool) __attribute__((__deprecated__)); | 100 | int fido_assert_set_options(fido_assert_t *, bool, bool) |
101 | __attribute__((__deprecated__("use fido_assert_set_up/fido_assert_set_uv"))); | ||
125 | int fido_assert_set_rp(fido_assert_t *, const char *); | 102 | int fido_assert_set_rp(fido_assert_t *, const char *); |
126 | int fido_assert_set_up(fido_assert_t *, fido_opt_t); | 103 | int fido_assert_set_up(fido_assert_t *, fido_opt_t); |
127 | int fido_assert_set_uv(fido_assert_t *, fido_opt_t); | 104 | int fido_assert_set_uv(fido_assert_t *, fido_opt_t); |
128 | int fido_assert_set_sig(fido_assert_t *, size_t, const unsigned char *, size_t); | 105 | int fido_assert_set_sig(fido_assert_t *, size_t, const unsigned char *, size_t); |
129 | int fido_assert_verify(const fido_assert_t *, size_t, int, const void *); | 106 | int fido_assert_verify(const fido_assert_t *, size_t, int, const void *); |
130 | int fido_cred_exclude(fido_cred_t *, const unsigned char *, size_t); | 107 | int fido_cred_exclude(fido_cred_t *, const unsigned char *, size_t); |
108 | int fido_cred_prot(const fido_cred_t *); | ||
131 | int fido_cred_set_authdata(fido_cred_t *, const unsigned char *, size_t); | 109 | int fido_cred_set_authdata(fido_cred_t *, const unsigned char *, size_t); |
132 | int fido_cred_set_authdata_raw(fido_cred_t *, const unsigned char *, size_t); | 110 | int fido_cred_set_authdata_raw(fido_cred_t *, const unsigned char *, size_t); |
133 | int fido_cred_set_clientdata_hash(fido_cred_t *, const unsigned char *, size_t); | 111 | int fido_cred_set_clientdata_hash(fido_cred_t *, const unsigned char *, size_t); |
134 | int fido_cred_set_extensions(fido_cred_t *, int); | 112 | int fido_cred_set_extensions(fido_cred_t *, int); |
135 | int fido_cred_set_fmt(fido_cred_t *, const char *); | 113 | int fido_cred_set_fmt(fido_cred_t *, const char *); |
136 | int fido_cred_set_options(fido_cred_t *, bool, bool) __attribute__((__deprecated__)); | 114 | int fido_cred_set_options(fido_cred_t *, bool, bool) |
115 | __attribute__((__deprecated__("use fido_cred_set_rk/fido_cred_set_uv"))); | ||
116 | int fido_cred_set_prot(fido_cred_t *, int); | ||
137 | int fido_cred_set_rk(fido_cred_t *, fido_opt_t); | 117 | int fido_cred_set_rk(fido_cred_t *, fido_opt_t); |
138 | int fido_cred_set_rp(fido_cred_t *, const char *, const char *); | 118 | int fido_cred_set_rp(fido_cred_t *, const char *, const char *); |
139 | int fido_cred_set_sig(fido_cred_t *, const unsigned char *, size_t); | 119 | int fido_cred_set_sig(fido_cred_t *, const unsigned char *, size_t); |
@@ -152,10 +132,12 @@ int fido_dev_get_cbor_info(fido_dev_t *, fido_cbor_info_t *); | |||
152 | int fido_dev_get_retry_count(fido_dev_t *, int *); | 132 | int fido_dev_get_retry_count(fido_dev_t *, int *); |
153 | int fido_dev_info_manifest(fido_dev_info_t *, size_t, size_t *); | 133 | int fido_dev_info_manifest(fido_dev_info_t *, size_t, size_t *); |
154 | int fido_dev_make_cred(fido_dev_t *, fido_cred_t *, const char *); | 134 | int fido_dev_make_cred(fido_dev_t *, fido_cred_t *, const char *); |
135 | int fido_dev_open_with_info(fido_dev_t *); | ||
155 | int fido_dev_open(fido_dev_t *, const char *); | 136 | int fido_dev_open(fido_dev_t *, const char *); |
156 | int fido_dev_reset(fido_dev_t *); | 137 | int fido_dev_reset(fido_dev_t *); |
157 | int fido_dev_set_io_functions(fido_dev_t *, const fido_dev_io_t *); | 138 | int fido_dev_set_io_functions(fido_dev_t *, const fido_dev_io_t *); |
158 | int fido_dev_set_pin(fido_dev_t *, const char *, const char *); | 139 | int fido_dev_set_pin(fido_dev_t *, const char *, const char *); |
140 | int fido_dev_set_transport_functions(fido_dev_t *, const fido_dev_transport_t *); | ||
159 | 141 | ||
160 | size_t fido_assert_authdata_len(const fido_assert_t *, size_t); | 142 | size_t fido_assert_authdata_len(const fido_assert_t *, size_t); |
161 | size_t fido_assert_clientdata_hash_len(const fido_assert_t *); | 143 | size_t fido_assert_clientdata_hash_len(const fido_assert_t *); |
@@ -178,7 +160,7 @@ size_t fido_cred_sig_len(const fido_cred_t *); | |||
178 | size_t fido_cred_x5c_len(const fido_cred_t *); | 160 | size_t fido_cred_x5c_len(const fido_cred_t *); |
179 | 161 | ||
180 | uint8_t fido_assert_flags(const fido_assert_t *, size_t); | 162 | uint8_t fido_assert_flags(const fido_assert_t *, size_t); |
181 | uint32_t fido_assert_sigcount(const fido_assert_t *, size_t); | 163 | uint32_t fido_assert_sigcount(const fido_assert_t *, size_t); |
182 | uint8_t fido_cred_flags(const fido_cred_t *); | 164 | uint8_t fido_cred_flags(const fido_cred_t *); |
183 | uint8_t fido_dev_protocol(const fido_dev_t *); | 165 | uint8_t fido_dev_protocol(const fido_dev_t *); |
184 | uint8_t fido_dev_major(const fido_dev_t *); | 166 | uint8_t fido_dev_major(const fido_dev_t *); |
@@ -188,7 +170,12 @@ uint8_t fido_dev_flags(const fido_dev_t *); | |||
188 | int16_t fido_dev_info_vendor(const fido_dev_info_t *); | 170 | int16_t fido_dev_info_vendor(const fido_dev_info_t *); |
189 | int16_t fido_dev_info_product(const fido_dev_info_t *); | 171 | int16_t fido_dev_info_product(const fido_dev_info_t *); |
190 | uint64_t fido_cbor_info_maxmsgsiz(const fido_cbor_info_t *); | 172 | uint64_t fido_cbor_info_maxmsgsiz(const fido_cbor_info_t *); |
173 | uint64_t fido_cbor_info_fwversion(const fido_cbor_info_t *); | ||
191 | 174 | ||
192 | bool fido_dev_is_fido2(const fido_dev_t *); | 175 | bool fido_dev_is_fido2(const fido_dev_t *); |
193 | 176 | ||
177 | #ifdef __cplusplus | ||
178 | } /* extern "C" */ | ||
179 | #endif /* __cplusplus */ | ||
180 | |||
194 | #endif /* !_FIDO_H */ | 181 | #endif /* !_FIDO_H */ |
diff --git a/src/fido/bio.h b/src/fido/bio.h index 31dffe4..afe9ca4 100644 --- a/src/fido/bio.h +++ b/src/fido/bio.h | |||
@@ -10,8 +10,20 @@ | |||
10 | #include <stdint.h> | 10 | #include <stdint.h> |
11 | #include <stdlib.h> | 11 | #include <stdlib.h> |
12 | 12 | ||
13 | #ifdef _FIDO_INTERNAL | ||
14 | #include "blob.h" | ||
13 | #include "fido/err.h" | 15 | #include "fido/err.h" |
14 | #include "fido/param.h" | 16 | #include "fido/param.h" |
17 | #include "fido/types.h" | ||
18 | #else | ||
19 | #include <fido.h> | ||
20 | #include <fido/err.h> | ||
21 | #include <fido/param.h> | ||
22 | #endif | ||
23 | |||
24 | #ifdef __cplusplus | ||
25 | extern "C" { | ||
26 | #endif /* __cplusplus */ | ||
15 | 27 | ||
16 | #ifdef _FIDO_INTERNAL | 28 | #ifdef _FIDO_INTERNAL |
17 | struct fido_bio_template { | 29 | struct fido_bio_template { |
@@ -92,4 +104,8 @@ void fido_bio_info_free(fido_bio_info_t **); | |||
92 | void fido_bio_template_array_free(fido_bio_template_array_t **); | 104 | void fido_bio_template_array_free(fido_bio_template_array_t **); |
93 | void fido_bio_template_free(fido_bio_template_t **); | 105 | void fido_bio_template_free(fido_bio_template_t **); |
94 | 106 | ||
107 | #ifdef __cplusplus | ||
108 | } /* extern "C" */ | ||
109 | #endif /* __cplusplus */ | ||
110 | |||
95 | #endif /* !_FIDO_BIO_H */ | 111 | #endif /* !_FIDO_BIO_H */ |
diff --git a/src/fido/credman.h b/src/fido/credman.h index 1c7cafe..eaffd65 100644 --- a/src/fido/credman.h +++ b/src/fido/credman.h | |||
@@ -10,8 +10,20 @@ | |||
10 | #include <stdint.h> | 10 | #include <stdint.h> |
11 | #include <stdlib.h> | 11 | #include <stdlib.h> |
12 | 12 | ||
13 | #ifdef _FIDO_INTERNAL | ||
14 | #include "blob.h" | ||
13 | #include "fido/err.h" | 15 | #include "fido/err.h" |
14 | #include "fido/param.h" | 16 | #include "fido/param.h" |
17 | #include "fido/types.h" | ||
18 | #else | ||
19 | #include <fido.h> | ||
20 | #include <fido/err.h> | ||
21 | #include <fido/param.h> | ||
22 | #endif | ||
23 | |||
24 | #ifdef __cplusplus | ||
25 | extern "C" { | ||
26 | #endif /* __cplusplus */ | ||
15 | 27 | ||
16 | #ifdef _FIDO_INTERNAL | 28 | #ifdef _FIDO_INTERNAL |
17 | struct fido_credman_metadata { | 29 | struct fido_credman_metadata { |
@@ -71,4 +83,8 @@ void fido_credman_metadata_free(fido_credman_metadata_t **); | |||
71 | void fido_credman_rk_free(fido_credman_rk_t **); | 83 | void fido_credman_rk_free(fido_credman_rk_t **); |
72 | void fido_credman_rp_free(fido_credman_rp_t **); | 84 | void fido_credman_rp_free(fido_credman_rp_t **); |
73 | 85 | ||
86 | #ifdef __cplusplus | ||
87 | } /* extern "C" */ | ||
88 | #endif /* __cplusplus */ | ||
89 | |||
74 | #endif /* !_FIDO_CREDMAN_H */ | 90 | #endif /* !_FIDO_CREDMAN_H */ |
diff --git a/src/fido/eddsa.h b/src/fido/eddsa.h index 9de272d..4a81017 100644 --- a/src/fido/eddsa.h +++ b/src/fido/eddsa.h | |||
@@ -12,6 +12,16 @@ | |||
12 | #include <stdint.h> | 12 | #include <stdint.h> |
13 | #include <stdlib.h> | 13 | #include <stdlib.h> |
14 | 14 | ||
15 | #ifdef _FIDO_INTERNAL | ||
16 | #include "types.h" | ||
17 | #else | ||
18 | #include <fido.h> | ||
19 | #endif | ||
20 | |||
21 | #ifdef __cplusplus | ||
22 | extern "C" { | ||
23 | #endif /* __cplusplus */ | ||
24 | |||
15 | eddsa_pk_t *eddsa_pk_new(void); | 25 | eddsa_pk_t *eddsa_pk_new(void); |
16 | void eddsa_pk_free(eddsa_pk_t **); | 26 | void eddsa_pk_free(eddsa_pk_t **); |
17 | EVP_PKEY *eddsa_pk_to_EVP_PKEY(const eddsa_pk_t *); | 27 | EVP_PKEY *eddsa_pk_to_EVP_PKEY(const eddsa_pk_t *); |
@@ -37,4 +47,8 @@ void EVP_MD_CTX_free(EVP_MD_CTX *); | |||
37 | 47 | ||
38 | #endif /* _FIDO_INTERNAL */ | 48 | #endif /* _FIDO_INTERNAL */ |
39 | 49 | ||
50 | #ifdef __cplusplus | ||
51 | } /* extern "C" */ | ||
52 | #endif /* __cplusplus */ | ||
53 | |||
40 | #endif /* !_FIDO_EDDSA_H */ | 54 | #endif /* !_FIDO_EDDSA_H */ |
diff --git a/src/fido/err.h b/src/fido/err.h index 11f52bc..d7453fc 100644 --- a/src/fido/err.h +++ b/src/fido/err.h | |||
@@ -64,6 +64,14 @@ | |||
64 | #define FIDO_ERR_USER_PRESENCE_REQUIRED -8 | 64 | #define FIDO_ERR_USER_PRESENCE_REQUIRED -8 |
65 | #define FIDO_ERR_INTERNAL -9 | 65 | #define FIDO_ERR_INTERNAL -9 |
66 | 66 | ||
67 | #ifdef __cplusplus | ||
68 | extern "C" { | ||
69 | #endif /* __cplusplus */ | ||
70 | |||
67 | const char *fido_strerr(int); | 71 | const char *fido_strerr(int); |
68 | 72 | ||
73 | #ifdef __cplusplus | ||
74 | } /* extern "C" */ | ||
75 | #endif /* __cplusplus */ | ||
76 | |||
69 | #endif /* _FIDO_ERR_H */ | 77 | #endif /* _FIDO_ERR_H */ |
diff --git a/src/fido/es256.h b/src/fido/es256.h index d3d13dd..80f4db3 100644 --- a/src/fido/es256.h +++ b/src/fido/es256.h | |||
@@ -12,6 +12,16 @@ | |||
12 | #include <stdint.h> | 12 | #include <stdint.h> |
13 | #include <stdlib.h> | 13 | #include <stdlib.h> |
14 | 14 | ||
15 | #ifdef _FIDO_INTERNAL | ||
16 | #include "types.h" | ||
17 | #else | ||
18 | #include <fido.h> | ||
19 | #endif | ||
20 | |||
21 | #ifdef __cplusplus | ||
22 | extern "C" { | ||
23 | #endif /* __cplusplus */ | ||
24 | |||
15 | es256_pk_t *es256_pk_new(void); | 25 | es256_pk_t *es256_pk_new(void); |
16 | void es256_pk_free(es256_pk_t **); | 26 | void es256_pk_free(es256_pk_t **); |
17 | EVP_PKEY *es256_pk_to_EVP_PKEY(const es256_pk_t *); | 27 | EVP_PKEY *es256_pk_to_EVP_PKEY(const es256_pk_t *); |
@@ -31,4 +41,8 @@ int es256_pk_set_x(es256_pk_t *, const unsigned char *); | |||
31 | int es256_pk_set_y(es256_pk_t *, const unsigned char *); | 41 | int es256_pk_set_y(es256_pk_t *, const unsigned char *); |
32 | #endif | 42 | #endif |
33 | 43 | ||
44 | #ifdef __cplusplus | ||
45 | } /* extern "C" */ | ||
46 | #endif /* __cplusplus */ | ||
47 | |||
34 | #endif /* !_FIDO_ES256_H */ | 48 | #endif /* !_FIDO_ES256_H */ |
diff --git a/src/fido/param.h b/src/fido/param.h index 9e12ac6..7d3c0cc 100644 --- a/src/fido/param.h +++ b/src/fido/param.h | |||
@@ -58,6 +58,11 @@ | |||
58 | #define FIDO_RANDOM_DEV "/dev/urandom" | 58 | #define FIDO_RANDOM_DEV "/dev/urandom" |
59 | #endif | 59 | #endif |
60 | 60 | ||
61 | /* Maximum message size in bytes. */ | ||
62 | #ifndef FIDO_MAXMSG | ||
63 | #define FIDO_MAXMSG 1200 | ||
64 | #endif | ||
65 | |||
61 | /* CTAP capability bits. */ | 66 | /* CTAP capability bits. */ |
62 | #define FIDO_CAP_WINK 0x01 /* if set, device supports CTAP_CMD_WINK */ | 67 | #define FIDO_CAP_WINK 0x01 /* if set, device supports CTAP_CMD_WINK */ |
63 | #define FIDO_CAP_CBOR 0x04 /* if set, device supports CTAP_CMD_CBOR */ | 68 | #define FIDO_CAP_CBOR 0x04 /* if set, device supports CTAP_CMD_CBOR */ |
@@ -80,5 +85,11 @@ | |||
80 | 85 | ||
81 | /* Supported extensions. */ | 86 | /* Supported extensions. */ |
82 | #define FIDO_EXT_HMAC_SECRET 0x01 | 87 | #define FIDO_EXT_HMAC_SECRET 0x01 |
88 | #define FIDO_EXT_CRED_PROTECT 0x02 | ||
89 | |||
90 | /* Supported credential protection policies. */ | ||
91 | #define FIDO_CRED_PROT_UV_OPTIONAL 0x01 | ||
92 | #define FIDO_CRED_PROT_UV_OPTIONAL_WITH_ID 0x02 | ||
93 | #define FIDO_CRED_PROT_UV_REQUIRED 0x03 | ||
83 | 94 | ||
84 | #endif /* !_FIDO_PARAM_H */ | 95 | #endif /* !_FIDO_PARAM_H */ |
diff --git a/src/fido/rs256.h b/src/fido/rs256.h index d2fa162..2b08d59 100644 --- a/src/fido/rs256.h +++ b/src/fido/rs256.h | |||
@@ -12,6 +12,16 @@ | |||
12 | #include <stdint.h> | 12 | #include <stdint.h> |
13 | #include <stdlib.h> | 13 | #include <stdlib.h> |
14 | 14 | ||
15 | #ifdef _FIDO_INTERNAL | ||
16 | #include "types.h" | ||
17 | #else | ||
18 | #include <fido.h> | ||
19 | #endif | ||
20 | |||
21 | #ifdef __cplusplus | ||
22 | extern "C" { | ||
23 | #endif /* __cplusplus */ | ||
24 | |||
15 | rs256_pk_t *rs256_pk_new(void); | 25 | rs256_pk_t *rs256_pk_new(void); |
16 | void rs256_pk_free(rs256_pk_t **); | 26 | void rs256_pk_free(rs256_pk_t **); |
17 | EVP_PKEY *rs256_pk_to_EVP_PKEY(const rs256_pk_t *); | 27 | EVP_PKEY *rs256_pk_to_EVP_PKEY(const rs256_pk_t *); |
@@ -19,4 +29,8 @@ EVP_PKEY *rs256_pk_to_EVP_PKEY(const rs256_pk_t *); | |||
19 | int rs256_pk_from_RSA(rs256_pk_t *, const RSA *); | 29 | int rs256_pk_from_RSA(rs256_pk_t *, const RSA *); |
20 | int rs256_pk_from_ptr(rs256_pk_t *, const void *, size_t); | 30 | int rs256_pk_from_ptr(rs256_pk_t *, const void *, size_t); |
21 | 31 | ||
32 | #ifdef __cplusplus | ||
33 | } /* extern "C" */ | ||
34 | #endif /* __cplusplus */ | ||
35 | |||
22 | #endif /* !_FIDO_RS256_H */ | 36 | #endif /* !_FIDO_RS256_H */ |
diff --git a/src/types.h b/src/fido/types.h index 42ed1b7..5df5e36 100644 --- a/src/types.h +++ b/src/fido/types.h | |||
@@ -4,10 +4,48 @@ | |||
4 | * license that can be found in the LICENSE file. | 4 | * license that can be found in the LICENSE file. |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #ifndef _TYPES_H | 7 | #ifndef _FIDO_TYPES_H |
8 | #define _TYPES_H | 8 | #define _FIDO_TYPES_H |
9 | 9 | ||
10 | #include <stddef.h> | ||
11 | #include <stdint.h> | ||
12 | |||
13 | #ifdef __cplusplus | ||
14 | extern "C" { | ||
15 | #endif /* __cplusplus */ | ||
16 | |||
17 | struct fido_dev; | ||
18 | |||
19 | typedef void *fido_dev_io_open_t(const char *); | ||
20 | typedef void fido_dev_io_close_t(void *); | ||
21 | typedef int fido_dev_io_read_t(void *, unsigned char *, size_t, int); | ||
22 | typedef int fido_dev_io_write_t(void *, const unsigned char *, size_t); | ||
23 | typedef int fido_dev_rx_t(struct fido_dev *, uint8_t, unsigned char *, size_t, int); | ||
24 | typedef int fido_dev_tx_t(struct fido_dev *, uint8_t, const unsigned char *, size_t); | ||
25 | |||
26 | typedef struct fido_dev_io { | ||
27 | fido_dev_io_open_t *open; | ||
28 | fido_dev_io_close_t *close; | ||
29 | fido_dev_io_read_t *read; | ||
30 | fido_dev_io_write_t *write; | ||
31 | } fido_dev_io_t; | ||
32 | |||
33 | typedef struct fido_dev_transport { | ||
34 | fido_dev_rx_t *rx; | ||
35 | fido_dev_tx_t *tx; | ||
36 | } fido_dev_transport_t; | ||
37 | |||
38 | typedef enum { | ||
39 | FIDO_OPT_OMIT = 0, /* use authenticator's default */ | ||
40 | FIDO_OPT_FALSE, /* explicitly set option to false */ | ||
41 | FIDO_OPT_TRUE, /* explicitly set option to true */ | ||
42 | } fido_opt_t; | ||
43 | |||
44 | typedef void fido_log_handler_t(const char *); | ||
45 | |||
46 | #ifdef _FIDO_INTERNAL | ||
10 | #include "packed.h" | 47 | #include "packed.h" |
48 | #include "blob.h" | ||
11 | 49 | ||
12 | /* COSE ES256 (ECDSA over P-256 with SHA-256) public key */ | 50 | /* COSE ES256 (ECDSA over P-256 with SHA-256) public key */ |
13 | typedef struct es256_pk { | 51 | typedef struct es256_pk { |
@@ -74,6 +112,11 @@ typedef struct fido_user { | |||
74 | char *display_name; /* required */ | 112 | char *display_name; /* required */ |
75 | } fido_user_t; | 113 | } fido_user_t; |
76 | 114 | ||
115 | typedef struct fido_cred_ext { | ||
116 | int mask; /* enabled extensions */ | ||
117 | int prot; /* protection policy */ | ||
118 | } fido_cred_ext_t; | ||
119 | |||
77 | typedef struct fido_cred { | 120 | typedef struct fido_cred { |
78 | fido_blob_t cdh; /* client data hash */ | 121 | fido_blob_t cdh; /* client data hash */ |
79 | fido_rp_t rp; /* relying party */ | 122 | fido_rp_t rp; /* relying party */ |
@@ -81,10 +124,10 @@ typedef struct fido_cred { | |||
81 | fido_blob_array_t excl; /* list of credential ids to exclude */ | 124 | fido_blob_array_t excl; /* list of credential ids to exclude */ |
82 | fido_opt_t rk; /* resident key */ | 125 | fido_opt_t rk; /* resident key */ |
83 | fido_opt_t uv; /* user verification */ | 126 | fido_opt_t uv; /* user verification */ |
84 | int ext; /* enabled extensions */ | 127 | fido_cred_ext_t ext; /* extensions */ |
85 | int type; /* cose algorithm */ | 128 | int type; /* cose algorithm */ |
86 | char *fmt; /* credential format */ | 129 | char *fmt; /* credential format */ |
87 | int authdata_ext; /* decoded extensions */ | 130 | fido_cred_ext_t authdata_ext; /* decoded extensions */ |
88 | fido_blob_t authdata_cbor; /* raw cbor payload */ | 131 | fido_blob_t authdata_cbor; /* raw cbor payload */ |
89 | fido_authdata_t authdata; /* decoded authdata payload */ | 132 | fido_authdata_t authdata; /* decoded authdata payload */ |
90 | fido_attcred_t attcred; /* returned credential (key + id) */ | 133 | fido_attcred_t attcred; /* returned credential (key + id) */ |
@@ -138,14 +181,17 @@ typedef struct fido_cbor_info { | |||
138 | fido_opt_array_t options; /* list of supported options */ | 181 | fido_opt_array_t options; /* list of supported options */ |
139 | uint64_t maxmsgsiz; /* maximum message size */ | 182 | uint64_t maxmsgsiz; /* maximum message size */ |
140 | fido_byte_array_t protocols; /* supported pin protocols */ | 183 | fido_byte_array_t protocols; /* supported pin protocols */ |
184 | uint64_t fwversion; /* firmware version */ | ||
141 | } fido_cbor_info_t; | 185 | } fido_cbor_info_t; |
142 | 186 | ||
143 | typedef struct fido_dev_info { | 187 | typedef struct fido_dev_info { |
144 | char *path; /* device path */ | 188 | char *path; /* device path */ |
145 | int16_t vendor_id; /* 2-byte vendor id */ | 189 | int16_t vendor_id; /* 2-byte vendor id */ |
146 | int16_t product_id; /* 2-byte product id */ | 190 | int16_t product_id; /* 2-byte product id */ |
147 | char *manufacturer; /* manufacturer string */ | 191 | char *manufacturer; /* manufacturer string */ |
148 | char *product; /* product string */ | 192 | char *product; /* product string */ |
193 | fido_dev_io_t io; /* i/o functions */ | ||
194 | fido_dev_transport_t transport; /* transport functions */ | ||
149 | } fido_dev_info_t; | 195 | } fido_dev_info_t; |
150 | 196 | ||
151 | PACKED_TYPE(fido_ctap_info_t, | 197 | PACKED_TYPE(fido_ctap_info_t, |
@@ -161,11 +207,29 @@ struct fido_ctap_info { | |||
161 | }) | 207 | }) |
162 | 208 | ||
163 | typedef struct fido_dev { | 209 | typedef struct fido_dev { |
164 | uint64_t nonce; /* issued nonce */ | 210 | uint64_t nonce; /* issued nonce */ |
165 | fido_ctap_info_t attr; /* device attributes */ | 211 | fido_ctap_info_t attr; /* device attributes */ |
166 | uint32_t cid; /* assigned channel id */ | 212 | uint32_t cid; /* assigned channel id */ |
167 | void *io_handle; /* abstract i/o handle */ | 213 | char *path; /* device path */ |
168 | fido_dev_io_t io; /* i/o functions & data */ | 214 | void *io_handle; /* abstract i/o handle */ |
215 | fido_dev_io_t io; /* i/o functions */ | ||
216 | fido_dev_transport_t transport; /* transport functions */ | ||
169 | } fido_dev_t; | 217 | } fido_dev_t; |
170 | 218 | ||
171 | #endif /* !_TYPES_H */ | 219 | #else |
220 | typedef struct fido_assert fido_assert_t; | ||
221 | typedef struct fido_cbor_info fido_cbor_info_t; | ||
222 | typedef struct fido_cred fido_cred_t; | ||
223 | typedef struct fido_dev fido_dev_t; | ||
224 | typedef struct fido_dev_info fido_dev_info_t; | ||
225 | typedef struct es256_pk es256_pk_t; | ||
226 | typedef struct es256_sk es256_sk_t; | ||
227 | typedef struct rs256_pk rs256_pk_t; | ||
228 | typedef struct eddsa_pk eddsa_pk_t; | ||
229 | #endif /* _FIDO_INTERNAL */ | ||
230 | |||
231 | #ifdef __cplusplus | ||
232 | } /* extern "C" */ | ||
233 | #endif /* __cplusplus */ | ||
234 | |||
235 | #endif /* !_FIDO_TYPES_H */ | ||
diff --git a/src/hid_hidapi.c b/src/hid_hidapi.c new file mode 100644 index 0000000..915621f --- /dev/null +++ b/src/hid_hidapi.c | |||
@@ -0,0 +1,138 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2019 Google LLC. All rights reserved. | ||
3 | * Use of this source code is governed by a BSD-style | ||
4 | * license that can be found in the LICENSE file. | ||
5 | */ | ||
6 | |||
7 | #include <hidapi/hidapi.h> | ||
8 | |||
9 | #include <stdlib.h> | ||
10 | #include <string.h> | ||
11 | #include <wchar.h> | ||
12 | |||
13 | #include "fido.h" | ||
14 | |||
15 | static size_t | ||
16 | fido_wcslen(const wchar_t *wcs) | ||
17 | { | ||
18 | size_t l = 0; | ||
19 | while (*wcs++ != L'\0') | ||
20 | l++; | ||
21 | return l; | ||
22 | } | ||
23 | |||
24 | static char * | ||
25 | wcs_to_cs(const wchar_t *wcs) | ||
26 | { | ||
27 | char *cs; | ||
28 | size_t i; | ||
29 | |||
30 | if (wcs == NULL || (cs = calloc(fido_wcslen(wcs) + 1, 1)) == NULL) | ||
31 | return NULL; | ||
32 | |||
33 | for (i = 0; i < fido_wcslen(wcs); i++) { | ||
34 | if (wcs[i] >= 128) { | ||
35 | /* give up on parsing non-ASCII text */ | ||
36 | free(cs); | ||
37 | return strdup("hidapi device"); | ||
38 | } | ||
39 | cs[i] = (char)wcs[i]; | ||
40 | } | ||
41 | |||
42 | return cs; | ||
43 | } | ||
44 | |||
45 | static int | ||
46 | copy_info(fido_dev_info_t *di, const struct hid_device_info *d) | ||
47 | { | ||
48 | memset(di, 0, sizeof(*di)); | ||
49 | |||
50 | if (d->path != NULL) | ||
51 | di->path = strdup(d->path); | ||
52 | else | ||
53 | di->path = strdup(""); | ||
54 | |||
55 | if (d->manufacturer_string != NULL) | ||
56 | di->manufacturer = wcs_to_cs(d->manufacturer_string); | ||
57 | else | ||
58 | di->manufacturer = strdup(""); | ||
59 | |||
60 | if (d->product_string != NULL) | ||
61 | di->product = wcs_to_cs(d->product_string); | ||
62 | else | ||
63 | di->product = strdup(""); | ||
64 | |||
65 | if (di->path == NULL || | ||
66 | di->manufacturer == NULL || | ||
67 | di->product == NULL) { | ||
68 | free(di->path); | ||
69 | free(di->manufacturer); | ||
70 | free(di->product); | ||
71 | return -1; | ||
72 | } | ||
73 | |||
74 | di->product_id = d->product_id; | ||
75 | di->vendor_id = d->vendor_id; | ||
76 | di->io = (fido_dev_io_t) { | ||
77 | &fido_hid_open, | ||
78 | &fido_hid_close, | ||
79 | &fido_hid_read, | ||
80 | &fido_hid_write, | ||
81 | }; | ||
82 | |||
83 | return 0; | ||
84 | } | ||
85 | |||
86 | void * | ||
87 | fido_hid_open(const char *path) | ||
88 | { | ||
89 | return hid_open_path(path); | ||
90 | } | ||
91 | |||
92 | void | ||
93 | fido_hid_close(void *hid_dev_handle) | ||
94 | { | ||
95 | hid_close(hid_dev_handle); | ||
96 | } | ||
97 | |||
98 | int | ||
99 | fido_hid_read(void *hid_dev_handle, unsigned char *buf, size_t len, int ms) | ||
100 | { | ||
101 | return hid_read_timeout(hid_dev_handle, buf, len, ms); | ||
102 | } | ||
103 | |||
104 | int | ||
105 | fido_hid_write(void *hid_dev_handle, const unsigned char *buf, size_t len) | ||
106 | { | ||
107 | return hid_write(hid_dev_handle, buf, len); | ||
108 | } | ||
109 | |||
110 | int | ||
111 | fido_hid_manifest(fido_dev_info_t *devlist, size_t ilen, size_t *olen) | ||
112 | { | ||
113 | struct hid_device_info *hdi; | ||
114 | |||
115 | *olen = 0; | ||
116 | |||
117 | if (ilen == 0) | ||
118 | return FIDO_OK; /* nothing to do */ | ||
119 | if (devlist == NULL) | ||
120 | return FIDO_ERR_INVALID_ARGUMENT; | ||
121 | if ((hdi = hid_enumerate(0, 0)) == NULL) | ||
122 | return FIDO_OK; /* nothing to do */ | ||
123 | |||
124 | for (struct hid_device_info *d = hdi; d != NULL; d = d->next) { | ||
125 | #if defined(_WIN32) || defined(__APPLE__) | ||
126 | if (d->usage_page != 0xf1d0) | ||
127 | continue; | ||
128 | #endif | ||
129 | if (copy_info(&devlist[*olen], d) == 0) { | ||
130 | if (++(*olen) == ilen) | ||
131 | break; | ||
132 | } | ||
133 | } | ||
134 | |||
135 | hid_free_enumeration(hdi); | ||
136 | |||
137 | return FIDO_OK; | ||
138 | } | ||
diff --git a/src/hid_linux.c b/src/hid_linux.c index c7cabc9..99c5afb 100644 --- a/src/hid_linux.c +++ b/src/hid_linux.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <libudev.h> | 13 | #include <libudev.h> |
14 | #include <string.h> | 14 | #include <string.h> |
15 | #include <unistd.h> | 15 | #include <unistd.h> |
16 | #include <errno.h> | ||
16 | 17 | ||
17 | #include "fido.h" | 18 | #include "fido.h" |
18 | 19 | ||
@@ -98,7 +99,6 @@ get_usage_info(const struct hidraw_report_descriptor *hrd, uint32_t *usage_page, | |||
98 | static int | 99 | static int |
99 | get_report_descriptor(const char *path, struct hidraw_report_descriptor *hrd) | 100 | get_report_descriptor(const char *path, struct hidraw_report_descriptor *hrd) |
100 | { | 101 | { |
101 | int r; | ||
102 | int s = -1; | 102 | int s = -1; |
103 | int fd; | 103 | int fd; |
104 | int ok = -1; | 104 | int ok = -1; |
@@ -108,7 +108,7 @@ get_report_descriptor(const char *path, struct hidraw_report_descriptor *hrd) | |||
108 | return (-1); | 108 | return (-1); |
109 | } | 109 | } |
110 | 110 | ||
111 | if ((r = ioctl(fd, HIDIOCGRDESCSIZE, &s)) < 0 || s < 0 || | 111 | if (ioctl(fd, HIDIOCGRDESCSIZE, &s) < 0 || s < 0 || |
112 | (unsigned)s > HID_MAX_DESCRIPTOR_SIZE) { | 112 | (unsigned)s > HID_MAX_DESCRIPTOR_SIZE) { |
113 | fido_log_debug("%s: ioctl HIDIOCGRDESCSIZE", __func__); | 113 | fido_log_debug("%s: ioctl HIDIOCGRDESCSIZE", __func__); |
114 | goto fail; | 114 | goto fail; |
@@ -116,7 +116,7 @@ get_report_descriptor(const char *path, struct hidraw_report_descriptor *hrd) | |||
116 | 116 | ||
117 | hrd->size = s; | 117 | hrd->size = s; |
118 | 118 | ||
119 | if ((r = ioctl(fd, HIDIOCGRDESC, hrd)) < 0) { | 119 | if (ioctl(fd, HIDIOCGRDESC, hrd) < 0) { |
120 | fido_log_debug("%s: ioctl HIDIOCGRDESC", __func__); | 120 | fido_log_debug("%s: ioctl HIDIOCGRDESC", __func__); |
121 | goto fail; | 121 | goto fail; |
122 | } | 122 | } |
@@ -240,7 +240,7 @@ fail: | |||
240 | } | 240 | } |
241 | 241 | ||
242 | int | 242 | int |
243 | fido_dev_info_manifest(fido_dev_info_t *devlist, size_t ilen, size_t *olen) | 243 | fido_hid_manifest(fido_dev_info_t *devlist, size_t ilen, size_t *olen) |
244 | { | 244 | { |
245 | struct udev *udev = NULL; | 245 | struct udev *udev = NULL; |
246 | struct udev_enumerate *udev_enum = NULL; | 246 | struct udev_enumerate *udev_enum = NULL; |
@@ -267,6 +267,12 @@ fido_dev_info_manifest(fido_dev_info_t *devlist, size_t ilen, size_t *olen) | |||
267 | 267 | ||
268 | udev_list_entry_foreach(udev_entry, udev_list) { | 268 | udev_list_entry_foreach(udev_entry, udev_list) { |
269 | if (copy_info(&devlist[*olen], udev, udev_entry) == 0) { | 269 | if (copy_info(&devlist[*olen], udev, udev_entry) == 0) { |
270 | devlist[*olen].io = (fido_dev_io_t) { | ||
271 | fido_hid_open, | ||
272 | fido_hid_close, | ||
273 | fido_hid_read, | ||
274 | fido_hid_write, | ||
275 | }; | ||
270 | if (++(*olen) == ilen) | 276 | if (++(*olen) == ilen) |
271 | break; | 277 | break; |
272 | } | 278 | } |
diff --git a/src/hid_openbsd.c b/src/hid_openbsd.c index 8b92bd6..2b31dba 100644 --- a/src/hid_openbsd.c +++ b/src/hid_openbsd.c | |||
@@ -29,7 +29,7 @@ struct hid_openbsd { | |||
29 | }; | 29 | }; |
30 | 30 | ||
31 | int | 31 | int |
32 | fido_dev_info_manifest(fido_dev_info_t *devlist, size_t ilen, size_t *olen) | 32 | fido_hid_manifest(fido_dev_info_t *devlist, size_t ilen, size_t *olen) |
33 | { | 33 | { |
34 | size_t i; | 34 | size_t i; |
35 | char path[64]; | 35 | char path[64]; |
@@ -101,6 +101,12 @@ fido_dev_info_manifest(fido_dev_info_t *devlist, size_t ilen, size_t *olen) | |||
101 | 101 | ||
102 | di = &devlist[*olen]; | 102 | di = &devlist[*olen]; |
103 | memset(di, 0, sizeof(*di)); | 103 | memset(di, 0, sizeof(*di)); |
104 | di->io = (fido_dev_io_t) { | ||
105 | fido_hid_open, | ||
106 | fido_hid_close, | ||
107 | fido_hid_read, | ||
108 | fido_hid_write, | ||
109 | }; | ||
104 | if ((di->path = strdup(path)) == NULL || | 110 | if ((di->path = strdup(path)) == NULL || |
105 | (di->manufacturer = strdup(udi.udi_vendor)) == NULL || | 111 | (di->manufacturer = strdup(udi.udi_vendor)) == NULL || |
106 | (di->product = strdup(udi.udi_product)) == NULL) { | 112 | (di->product = strdup(udi.udi_product)) == NULL) { |
diff --git a/src/hid_osx.c b/src/hid_osx.c index b705b43..5c40747 100644 --- a/src/hid_osx.c +++ b/src/hid_osx.c | |||
@@ -197,7 +197,7 @@ copy_info(fido_dev_info_t *di, IOHIDDeviceRef dev) | |||
197 | } | 197 | } |
198 | 198 | ||
199 | int | 199 | int |
200 | fido_dev_info_manifest(fido_dev_info_t *devlist, size_t ilen, size_t *olen) | 200 | fido_hid_manifest(fido_dev_info_t *devlist, size_t ilen, size_t *olen) |
201 | { | 201 | { |
202 | IOHIDManagerRef manager = NULL; | 202 | IOHIDManagerRef manager = NULL; |
203 | CFSetRef devset = NULL; | 203 | CFSetRef devset = NULL; |
@@ -240,6 +240,12 @@ fido_dev_info_manifest(fido_dev_info_t *devlist, size_t ilen, size_t *olen) | |||
240 | 240 | ||
241 | for (CFIndex i = 0; i < devcnt; i++) { | 241 | for (CFIndex i = 0; i < devcnt; i++) { |
242 | if (copy_info(&devlist[*olen], devs[i]) == 0) { | 242 | if (copy_info(&devlist[*olen], devs[i]) == 0) { |
243 | devlist[*olen].io = (fido_dev_io_t) { | ||
244 | fido_hid_open, | ||
245 | fido_hid_close, | ||
246 | fido_hid_read, | ||
247 | fido_hid_write, | ||
248 | }; | ||
243 | if (++(*olen) == ilen) | 249 | if (++(*olen) == ilen) |
244 | break; | 250 | break; |
245 | } | 251 | } |
@@ -378,15 +384,18 @@ fido_hid_read(void *handle, unsigned char *buf, size_t len, int ms) | |||
378 | IOHIDDeviceScheduleWithRunLoop(dev->ref, CFRunLoopGetCurrent(), | 384 | IOHIDDeviceScheduleWithRunLoop(dev->ref, CFRunLoopGetCurrent(), |
379 | dev->loop_id); | 385 | dev->loop_id); |
380 | 386 | ||
381 | do | 387 | r = CFRunLoopRunInMode(dev->loop_id, 0.3, true); |
382 | r = CFRunLoopRunInMode(dev->loop_id, 0.003, true); | ||
383 | while (r != kCFRunLoopRunHandledSource); | ||
384 | 388 | ||
385 | IOHIDDeviceRegisterInputReportCallback(dev->ref, buf, len, NULL, NULL); | 389 | IOHIDDeviceRegisterInputReportCallback(dev->ref, buf, len, NULL, NULL); |
386 | IOHIDDeviceRegisterRemovalCallback(dev->ref, NULL, NULL); | 390 | IOHIDDeviceRegisterRemovalCallback(dev->ref, NULL, NULL); |
387 | IOHIDDeviceUnscheduleFromRunLoop(dev->ref, CFRunLoopGetCurrent(), | 391 | IOHIDDeviceUnscheduleFromRunLoop(dev->ref, CFRunLoopGetCurrent(), |
388 | dev->loop_id); | 392 | dev->loop_id); |
389 | 393 | ||
394 | if (r != kCFRunLoopRunHandledSource) { | ||
395 | fido_log_debug("%s: CFRunLoopRunInMode=%d", __func__, (int)r); | ||
396 | return (-1); | ||
397 | } | ||
398 | |||
390 | return (REPORT_LEN - 1); | 399 | return (REPORT_LEN - 1); |
391 | } | 400 | } |
392 | 401 | ||
diff --git a/src/hid_win.c b/src/hid_win.c index 6d93778..f970589 100644 --- a/src/hid_win.c +++ b/src/hid_win.c | |||
@@ -172,7 +172,7 @@ fail: | |||
172 | } | 172 | } |
173 | 173 | ||
174 | int | 174 | int |
175 | fido_dev_info_manifest(fido_dev_info_t *devlist, size_t ilen, size_t *olen) | 175 | fido_hid_manifest(fido_dev_info_t *devlist, size_t ilen, size_t *olen) |
176 | { | 176 | { |
177 | GUID hid_guid = GUID_DEVINTERFACE_HID; | 177 | GUID hid_guid = GUID_DEVINTERFACE_HID; |
178 | HDEVINFO devinfo = INVALID_HANDLE_VALUE; | 178 | HDEVINFO devinfo = INVALID_HANDLE_VALUE; |
@@ -234,6 +234,12 @@ fido_dev_info_manifest(fido_dev_info_t *devlist, size_t ilen, size_t *olen) | |||
234 | } | 234 | } |
235 | 235 | ||
236 | if (copy_info(&devlist[*olen], ifdetail->DevicePath) == 0) { | 236 | if (copy_info(&devlist[*olen], ifdetail->DevicePath) == 0) { |
237 | devlist[*olen].io = (fido_dev_io_t) { | ||
238 | fido_hid_open, | ||
239 | fido_hid_close, | ||
240 | fido_hid_read, | ||
241 | fido_hid_write, | ||
242 | }; | ||
237 | if (++(*olen) == ilen) | 243 | if (++(*olen) == ilen) |
238 | break; | 244 | break; |
239 | } | 245 | } |
@@ -217,6 +217,8 @@ parse_reply_element(const cbor_item_t *key, const cbor_item_t *val, void *arg) | |||
217 | return (cbor_decode_uint64(val, &ci->maxmsgsiz)); | 217 | return (cbor_decode_uint64(val, &ci->maxmsgsiz)); |
218 | case 6: /* pinProtocols */ | 218 | case 6: /* pinProtocols */ |
219 | return (decode_protocols(val, &ci->protocols)); | 219 | return (decode_protocols(val, &ci->protocols)); |
220 | case 14: /* fwVersion */ | ||
221 | return (cbor_decode_uint64(val, &ci->fwversion)); | ||
220 | default: /* ignore */ | 222 | default: /* ignore */ |
221 | fido_log_debug("%s: cbor type", __func__); | 223 | fido_log_debug("%s: cbor type", __func__); |
222 | return (0); | 224 | return (0); |
@@ -226,12 +228,11 @@ parse_reply_element(const cbor_item_t *key, const cbor_item_t *val, void *arg) | |||
226 | static int | 228 | static int |
227 | fido_dev_get_cbor_info_tx(fido_dev_t *dev) | 229 | fido_dev_get_cbor_info_tx(fido_dev_t *dev) |
228 | { | 230 | { |
229 | const unsigned char cbor[] = { CTAP_CBOR_GETINFO }; | 231 | const unsigned char cbor[] = { CTAP_CBOR_GETINFO }; |
230 | const uint8_t cmd = CTAP_FRAME_INIT | CTAP_CMD_CBOR; | ||
231 | 232 | ||
232 | fido_log_debug("%s: dev=%p", __func__, (void *)dev); | 233 | fido_log_debug("%s: dev=%p", __func__, (void *)dev); |
233 | 234 | ||
234 | if (fido_tx(dev, cmd, cbor, sizeof(cbor)) < 0) { | 235 | if (fido_tx(dev, CTAP_CMD_CBOR, cbor, sizeof(cbor)) < 0) { |
235 | fido_log_debug("%s: fido_tx", __func__); | 236 | fido_log_debug("%s: fido_tx", __func__); |
236 | return (FIDO_ERR_TX); | 237 | return (FIDO_ERR_TX); |
237 | } | 238 | } |
@@ -242,8 +243,7 @@ fido_dev_get_cbor_info_tx(fido_dev_t *dev) | |||
242 | static int | 243 | static int |
243 | fido_dev_get_cbor_info_rx(fido_dev_t *dev, fido_cbor_info_t *ci, int ms) | 244 | fido_dev_get_cbor_info_rx(fido_dev_t *dev, fido_cbor_info_t *ci, int ms) |
244 | { | 245 | { |
245 | const uint8_t cmd = CTAP_FRAME_INIT | CTAP_CMD_CBOR; | 246 | unsigned char reply[FIDO_MAXMSG]; |
246 | unsigned char reply[512]; | ||
247 | int reply_len; | 247 | int reply_len; |
248 | 248 | ||
249 | fido_log_debug("%s: dev=%p, ci=%p, ms=%d", __func__, (void *)dev, | 249 | fido_log_debug("%s: dev=%p, ci=%p, ms=%d", __func__, (void *)dev, |
@@ -251,7 +251,8 @@ fido_dev_get_cbor_info_rx(fido_dev_t *dev, fido_cbor_info_t *ci, int ms) | |||
251 | 251 | ||
252 | memset(ci, 0, sizeof(*ci)); | 252 | memset(ci, 0, sizeof(*ci)); |
253 | 253 | ||
254 | if ((reply_len = fido_rx(dev, cmd, &reply, sizeof(reply), ms)) < 0) { | 254 | if ((reply_len = fido_rx(dev, CTAP_CMD_CBOR, &reply, sizeof(reply), |
255 | ms)) < 0) { | ||
255 | fido_log_debug("%s: fido_rx", __func__); | 256 | fido_log_debug("%s: fido_rx", __func__); |
256 | return (FIDO_ERR_RX); | 257 | return (FIDO_ERR_RX); |
257 | } | 258 | } |
@@ -260,7 +261,7 @@ fido_dev_get_cbor_info_rx(fido_dev_t *dev, fido_cbor_info_t *ci, int ms) | |||
260 | parse_reply_element)); | 261 | parse_reply_element)); |
261 | } | 262 | } |
262 | 263 | ||
263 | static int | 264 | int |
264 | fido_dev_get_cbor_info_wait(fido_dev_t *dev, fido_cbor_info_t *ci, int ms) | 265 | fido_dev_get_cbor_info_wait(fido_dev_t *dev, fido_cbor_info_t *ci, int ms) |
265 | { | 266 | { |
266 | int r; | 267 | int r; |
@@ -397,6 +398,12 @@ fido_cbor_info_maxmsgsiz(const fido_cbor_info_t *ci) | |||
397 | return (ci->maxmsgsiz); | 398 | return (ci->maxmsgsiz); |
398 | } | 399 | } |
399 | 400 | ||
401 | uint64_t | ||
402 | fido_cbor_info_fwversion(const fido_cbor_info_t *ci) | ||
403 | { | ||
404 | return (ci->fwversion); | ||
405 | } | ||
406 | |||
400 | const uint8_t * | 407 | const uint8_t * |
401 | fido_cbor_info_protocols_ptr(const fido_cbor_info_t *ci) | 408 | fido_cbor_info_protocols_ptr(const fido_cbor_info_t *ci) |
402 | { | 409 | { |
@@ -33,25 +33,40 @@ struct frame { | |||
33 | #define MIN(x, y) ((x) > (y) ? (y) : (x)) | 33 | #define MIN(x, y) ((x) > (y) ? (y) : (x)) |
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | static size_t | 36 | static int |
37 | tx_preamble(fido_dev_t *d, uint8_t cmd, const void *buf, size_t count) | 37 | tx_empty(fido_dev_t *d, uint8_t cmd) |
38 | { | 38 | { |
39 | struct frame *fp; | 39 | struct frame *fp; |
40 | unsigned char pkt[sizeof(*fp) + 1]; | 40 | unsigned char pkt[sizeof(*fp) + 1]; |
41 | int n; | 41 | int n; |
42 | 42 | ||
43 | if (d->io.write == NULL || (cmd & 0x80) == 0) | 43 | memset(&pkt, 0, sizeof(pkt)); |
44 | return (0); | 44 | fp = (struct frame *)(pkt + 1); |
45 | fp->cid = d->cid; | ||
46 | fp->body.init.cmd = CTAP_FRAME_INIT | cmd; | ||
47 | |||
48 | n = d->io.write(d->io_handle, pkt, sizeof(pkt)); | ||
49 | if (n < 0 || (size_t)n != sizeof(pkt)) | ||
50 | return (-1); | ||
51 | |||
52 | return (0); | ||
53 | } | ||
54 | |||
55 | static size_t | ||
56 | tx_preamble(fido_dev_t *d, uint8_t cmd, const void *buf, size_t count) | ||
57 | { | ||
58 | struct frame *fp; | ||
59 | unsigned char pkt[sizeof(*fp) + 1]; | ||
60 | int n; | ||
45 | 61 | ||
46 | memset(&pkt, 0, sizeof(pkt)); | 62 | memset(&pkt, 0, sizeof(pkt)); |
47 | fp = (struct frame *)(pkt + 1); | 63 | fp = (struct frame *)(pkt + 1); |
48 | fp->cid = d->cid; | 64 | fp->cid = d->cid; |
49 | fp->body.init.cmd = 0x80 | cmd; | 65 | fp->body.init.cmd = CTAP_FRAME_INIT | cmd; |
50 | fp->body.init.bcnth = (count >> 8) & 0xff; | 66 | fp->body.init.bcnth = (count >> 8) & 0xff; |
51 | fp->body.init.bcntl = count & 0xff; | 67 | fp->body.init.bcntl = count & 0xff; |
52 | count = MIN(count, sizeof(fp->body.init.data)); | 68 | count = MIN(count, sizeof(fp->body.init.data)); |
53 | if (count) | 69 | memcpy(&fp->body.init.data, buf, count); |
54 | memcpy(&fp->body.init.data, buf, count); | ||
55 | 70 | ||
56 | n = d->io.write(d->io_handle, pkt, sizeof(pkt)); | 71 | n = d->io.write(d->io_handle, pkt, sizeof(pkt)); |
57 | if (n < 0 || (size_t)n != sizeof(pkt)) | 72 | if (n < 0 || (size_t)n != sizeof(pkt)) |
@@ -61,19 +76,16 @@ tx_preamble(fido_dev_t *d, uint8_t cmd, const void *buf, size_t count) | |||
61 | } | 76 | } |
62 | 77 | ||
63 | static size_t | 78 | static size_t |
64 | tx_frame(fido_dev_t *d, int seq, const void *buf, size_t count) | 79 | tx_frame(fido_dev_t *d, uint8_t seq, const void *buf, size_t count) |
65 | { | 80 | { |
66 | struct frame *fp; | 81 | struct frame *fp; |
67 | unsigned char pkt[sizeof(*fp) + 1]; | 82 | unsigned char pkt[sizeof(*fp) + 1]; |
68 | int n; | 83 | int n; |
69 | 84 | ||
70 | if (d->io.write == NULL || seq < 0 || seq > UINT8_MAX) | ||
71 | return (0); | ||
72 | |||
73 | memset(&pkt, 0, sizeof(pkt)); | 85 | memset(&pkt, 0, sizeof(pkt)); |
74 | fp = (struct frame *)(pkt + 1); | 86 | fp = (struct frame *)(pkt + 1); |
75 | fp->cid = d->cid; | 87 | fp->cid = d->cid; |
76 | fp->body.cont.seq = (uint8_t)seq; | 88 | fp->body.cont.seq = seq; |
77 | count = MIN(count, sizeof(fp->body.cont.data)); | 89 | count = MIN(count, sizeof(fp->body.cont.data)); |
78 | memcpy(&fp->body.cont.data, buf, count); | 90 | memcpy(&fp->body.cont.data, buf, count); |
79 | 91 | ||
@@ -84,52 +96,56 @@ tx_frame(fido_dev_t *d, int seq, const void *buf, size_t count) | |||
84 | return (count); | 96 | return (count); |
85 | } | 97 | } |
86 | 98 | ||
87 | int | 99 | static int |
88 | fido_tx(fido_dev_t *d, uint8_t cmd, const void *buf, size_t count) | 100 | tx(fido_dev_t *d, uint8_t cmd, const unsigned char *buf, size_t count) |
89 | { | 101 | { |
90 | int seq = 0; | 102 | size_t n, sent; |
91 | size_t sent; | ||
92 | |||
93 | fido_log_debug("%s: d=%p, cmd=0x%02x, buf=%p, count=%zu", __func__, | ||
94 | (void *)d, cmd, buf, count); | ||
95 | fido_log_xxd(buf, count); | ||
96 | |||
97 | if (d->io_handle == NULL || count > UINT16_MAX) { | ||
98 | fido_log_debug("%s: invalid argument (%p, %zu)", __func__, | ||
99 | d->io_handle, count); | ||
100 | return (-1); | ||
101 | } | ||
102 | 103 | ||
103 | if ((sent = tx_preamble(d, cmd, buf, count)) == 0) { | 104 | if ((sent = tx_preamble(d, cmd, buf, count)) == 0) { |
104 | fido_log_debug("%s: tx_preamble", __func__); | 105 | fido_log_debug("%s: tx_preamble", __func__); |
105 | return (-1); | 106 | return (-1); |
106 | } | 107 | } |
107 | 108 | ||
108 | while (sent < count) { | 109 | for (uint8_t seq = 0; sent < count; sent += n) { |
109 | if (seq & 0x80) { | 110 | if (seq & 0x80) { |
110 | fido_log_debug("%s: seq & 0x80", __func__); | 111 | fido_log_debug("%s: seq & 0x80", __func__); |
111 | return (-1); | 112 | return (-1); |
112 | } | 113 | } |
113 | const uint8_t *p = (const uint8_t *)buf + sent; | 114 | if ((n = tx_frame(d, seq++, buf + sent, count - sent)) == 0) { |
114 | size_t n = tx_frame(d, seq++, p, count - sent); | ||
115 | if (n == 0) { | ||
116 | fido_log_debug("%s: tx_frame", __func__); | 115 | fido_log_debug("%s: tx_frame", __func__); |
117 | return (-1); | 116 | return (-1); |
118 | } | 117 | } |
119 | sent += n; | ||
120 | } | 118 | } |
121 | 119 | ||
122 | return (0); | 120 | return (0); |
123 | } | 121 | } |
124 | 122 | ||
123 | int | ||
124 | fido_tx(fido_dev_t *d, uint8_t cmd, const void *buf, size_t count) | ||
125 | { | ||
126 | fido_log_debug("%s: d=%p, cmd=0x%02x, buf=%p, count=%zu", __func__, | ||
127 | (void *)d, cmd, (const void *)buf, count); | ||
128 | fido_log_xxd(buf, count); | ||
129 | |||
130 | if (d->transport.tx != NULL) | ||
131 | return (d->transport.tx(d, cmd, buf, count)); | ||
132 | |||
133 | if (d->io_handle == NULL || d->io.write == NULL || count > UINT16_MAX) { | ||
134 | fido_log_debug("%s: invalid argument", __func__); | ||
135 | return (-1); | ||
136 | } | ||
137 | |||
138 | if (count == 0) | ||
139 | return (tx_empty(d, cmd)); | ||
140 | |||
141 | return (tx(d, cmd, buf, count)); | ||
142 | } | ||
143 | |||
125 | static int | 144 | static int |
126 | rx_frame(fido_dev_t *d, struct frame *fp, int ms) | 145 | rx_frame(fido_dev_t *d, struct frame *fp, int ms) |
127 | { | 146 | { |
128 | int n; | 147 | int n; |
129 | 148 | ||
130 | if (d->io.read == NULL) | ||
131 | return (-1); | ||
132 | |||
133 | n = d->io.read(d->io_handle, (unsigned char *)fp, sizeof(*fp), ms); | 149 | n = d->io.read(d->io_handle, (unsigned char *)fp, sizeof(*fp), ms); |
134 | if (n < 0 || (size_t)n != sizeof(*fp)) | 150 | if (n < 0 || (size_t)n != sizeof(*fp)) |
135 | return (-1); | 151 | return (-1); |
@@ -138,7 +154,7 @@ rx_frame(fido_dev_t *d, struct frame *fp, int ms) | |||
138 | } | 154 | } |
139 | 155 | ||
140 | static int | 156 | static int |
141 | rx_preamble(fido_dev_t *d, struct frame *fp, int ms) | 157 | rx_preamble(fido_dev_t *d, uint8_t cmd, struct frame *fp, int ms) |
142 | { | 158 | { |
143 | do { | 159 | do { |
144 | if (rx_frame(d, fp, ms) < 0) | 160 | if (rx_frame(d, fp, ms) < 0) |
@@ -149,66 +165,57 @@ rx_preamble(fido_dev_t *d, struct frame *fp, int ms) | |||
149 | } while (fp->cid == d->cid && | 165 | } while (fp->cid == d->cid && |
150 | fp->body.init.cmd == (CTAP_FRAME_INIT | CTAP_KEEPALIVE)); | 166 | fp->body.init.cmd == (CTAP_FRAME_INIT | CTAP_KEEPALIVE)); |
151 | 167 | ||
168 | fido_log_debug("%s: initiation frame at %p", __func__, (void *)fp); | ||
169 | fido_log_xxd(fp, sizeof(*fp)); | ||
170 | |||
171 | #ifdef FIDO_FUZZ | ||
172 | fp->body.init.cmd = (CTAP_FRAME_INIT | cmd); | ||
173 | #endif | ||
174 | |||
175 | if (fp->cid != d->cid || fp->body.init.cmd != (CTAP_FRAME_INIT | cmd)) { | ||
176 | fido_log_debug("%s: cid (0x%x, 0x%x), cmd (0x%02x, 0x%02x)", | ||
177 | __func__, fp->cid, d->cid, fp->body.init.cmd, cmd); | ||
178 | return (-1); | ||
179 | } | ||
180 | |||
152 | return (0); | 181 | return (0); |
153 | } | 182 | } |
154 | 183 | ||
155 | int | 184 | static int |
156 | fido_rx(fido_dev_t *d, uint8_t cmd, void *buf, size_t count, int ms) | 185 | rx(fido_dev_t *d, uint8_t cmd, unsigned char *buf, size_t count, int ms) |
157 | { | 186 | { |
158 | struct frame f; | 187 | struct frame f; |
159 | uint16_t r; | 188 | uint16_t r, payload_len; |
160 | uint16_t flen; | ||
161 | int seq; | ||
162 | |||
163 | if (d->io_handle == NULL || (cmd & 0x80) == 0) { | ||
164 | fido_log_debug("%s: invalid argument (%p, 0x%02x)", __func__, | ||
165 | d->io_handle, cmd); | ||
166 | return (-1); | ||
167 | } | ||
168 | 189 | ||
169 | if (rx_preamble(d, &f, ms) < 0) { | 190 | if (rx_preamble(d, cmd, &f, ms) < 0) { |
170 | fido_log_debug("%s: rx_preamble", __func__); | 191 | fido_log_debug("%s: rx_preamble", __func__); |
171 | return (-1); | 192 | return (-1); |
172 | } | 193 | } |
173 | 194 | ||
174 | fido_log_debug("%s: initiation frame at %p, len %zu", __func__, | 195 | payload_len = (f.body.init.bcnth << 8) | f.body.init.bcntl; |
175 | (void *)&f, sizeof(f)); | 196 | fido_log_debug("%s: payload_len=%zu", __func__, (size_t)payload_len); |
176 | fido_log_xxd(&f, sizeof(f)); | ||
177 | 197 | ||
178 | #ifdef FIDO_FUZZ | 198 | if (count < (size_t)payload_len) { |
179 | f.cid = d->cid; | 199 | fido_log_debug("%s: count < payload_len", __func__); |
180 | f.body.init.cmd = cmd; | ||
181 | #endif | ||
182 | |||
183 | if (f.cid != d->cid || f.body.init.cmd != cmd) { | ||
184 | fido_log_debug("%s: cid (0x%x, 0x%x), cmd (0x%02x, 0x%02x)", | ||
185 | __func__, f.cid, d->cid, f.body.init.cmd, cmd); | ||
186 | return (-1); | 200 | return (-1); |
187 | } | 201 | } |
188 | 202 | ||
189 | flen = (f.body.init.bcnth << 8) | f.body.init.bcntl; | 203 | if (payload_len < sizeof(f.body.init.data)) { |
190 | if (count < (size_t)flen) { | 204 | memcpy(buf, f.body.init.data, payload_len); |
191 | fido_log_debug("%s: count < flen (%zu, %zu)", __func__, count, | 205 | return (payload_len); |
192 | (size_t)flen); | ||
193 | return (-1); | ||
194 | } | ||
195 | if (flen < sizeof(f.body.init.data)) { | ||
196 | memcpy(buf, f.body.init.data, flen); | ||
197 | return (flen); | ||
198 | } | 206 | } |
199 | 207 | ||
200 | memcpy(buf, f.body.init.data, sizeof(f.body.init.data)); | 208 | memcpy(buf, f.body.init.data, sizeof(f.body.init.data)); |
201 | r = sizeof(f.body.init.data); | 209 | r = sizeof(f.body.init.data); |
202 | seq = 0; | ||
203 | 210 | ||
204 | while ((size_t)r < flen) { | 211 | for (int seq = 0; (size_t)r < payload_len; seq++) { |
205 | if (rx_frame(d, &f, ms) < 0) { | 212 | if (rx_frame(d, &f, ms) < 0) { |
206 | fido_log_debug("%s: rx_frame", __func__); | 213 | fido_log_debug("%s: rx_frame", __func__); |
207 | return (-1); | 214 | return (-1); |
208 | } | 215 | } |
209 | 216 | ||
210 | fido_log_debug("%s: continuation frame at %p, len %zu", | 217 | fido_log_debug("%s: continuation frame at %p", __func__, |
211 | __func__, (void *)&f, sizeof(f)); | 218 | (void *)&f); |
212 | fido_log_xxd(&f, sizeof(f)); | 219 | fido_log_xxd(&f, sizeof(f)); |
213 | 220 | ||
214 | #ifdef FIDO_FUZZ | 221 | #ifdef FIDO_FUZZ |
@@ -216,38 +223,57 @@ fido_rx(fido_dev_t *d, uint8_t cmd, void *buf, size_t count, int ms) | |||
216 | f.body.cont.seq = seq; | 223 | f.body.cont.seq = seq; |
217 | #endif | 224 | #endif |
218 | 225 | ||
219 | if (f.cid != d->cid || f.body.cont.seq != seq++) { | 226 | if (f.cid != d->cid || f.body.cont.seq != seq) { |
220 | fido_log_debug("%s: cid (0x%x, 0x%x), seq (%d, %d)", | 227 | fido_log_debug("%s: cid (0x%x, 0x%x), seq (%d, %d)", |
221 | __func__, f.cid, d->cid, f.body.cont.seq, seq); | 228 | __func__, f.cid, d->cid, f.body.cont.seq, seq); |
222 | return (-1); | 229 | return (-1); |
223 | } | 230 | } |
224 | 231 | ||
225 | uint8_t *p = (uint8_t *)buf + r; | 232 | if ((size_t)(payload_len - r) > sizeof(f.body.cont.data)) { |
226 | 233 | memcpy(buf + r, f.body.cont.data, | |
227 | if ((size_t)(flen - r) > sizeof(f.body.cont.data)) { | 234 | sizeof(f.body.cont.data)); |
228 | memcpy(p, f.body.cont.data, sizeof(f.body.cont.data)); | ||
229 | r += sizeof(f.body.cont.data); | 235 | r += sizeof(f.body.cont.data); |
230 | } else { | 236 | } else { |
231 | memcpy(p, f.body.cont.data, flen - r); | 237 | memcpy(buf + r, f.body.cont.data, payload_len - r); |
232 | r += (flen - r); /* break */ | 238 | r += (payload_len - r); /* break */ |
233 | } | 239 | } |
234 | } | 240 | } |
235 | 241 | ||
236 | fido_log_debug("%s: payload at %p, len %zu", __func__, buf, (size_t)r); | ||
237 | fido_log_xxd(buf, r); | ||
238 | |||
239 | return (r); | 242 | return (r); |
240 | } | 243 | } |
241 | 244 | ||
242 | int | 245 | int |
246 | fido_rx(fido_dev_t *d, uint8_t cmd, void *buf, size_t count, int ms) | ||
247 | { | ||
248 | int n; | ||
249 | |||
250 | fido_log_debug("%s: d=%p, cmd=0x%02x, buf=%p, count=%zu, ms=%d", | ||
251 | __func__, (void *)d, cmd, (const void *)buf, count, ms); | ||
252 | |||
253 | if (d->transport.rx != NULL) | ||
254 | return (d->transport.rx(d, cmd, buf, count, ms)); | ||
255 | |||
256 | if (d->io_handle == NULL || d->io.read == NULL || count > UINT16_MAX) { | ||
257 | fido_log_debug("%s: invalid argument", __func__); | ||
258 | return (-1); | ||
259 | } | ||
260 | |||
261 | if ((n = rx(d, cmd, buf, count, ms)) >= 0) { | ||
262 | fido_log_debug("%s: buf=%p, len=%d", __func__, (void *)buf, n); | ||
263 | fido_log_xxd(buf, n); | ||
264 | } | ||
265 | |||
266 | return (n); | ||
267 | } | ||
268 | |||
269 | int | ||
243 | fido_rx_cbor_status(fido_dev_t *d, int ms) | 270 | fido_rx_cbor_status(fido_dev_t *d, int ms) |
244 | { | 271 | { |
245 | const uint8_t cmd = CTAP_FRAME_INIT | CTAP_CMD_CBOR; | 272 | unsigned char reply[FIDO_MAXMSG]; |
246 | unsigned char reply[2048]; | ||
247 | int reply_len; | 273 | int reply_len; |
248 | 274 | ||
249 | if ((reply_len = fido_rx(d, cmd, &reply, sizeof(reply), ms)) < 0 || | 275 | if ((reply_len = fido_rx(d, CTAP_CMD_CBOR, &reply, sizeof(reply), |
250 | (size_t)reply_len < 1) { | 276 | ms)) < 0 || (size_t)reply_len < 1) { |
251 | fido_log_debug("%s: fido_rx", __func__); | 277 | fido_log_debug("%s: fido_rx", __func__); |
252 | return (FIDO_ERR_RX); | 278 | return (FIDO_ERR_RX); |
253 | } | 279 | } |
diff --git a/src/iso7816.h b/src/iso7816.h index 426cd97..563243f 100644 --- a/src/iso7816.h +++ b/src/iso7816.h | |||
@@ -7,8 +7,15 @@ | |||
7 | #ifndef _ISO7816_H | 7 | #ifndef _ISO7816_H |
8 | #define _ISO7816_H | 8 | #define _ISO7816_H |
9 | 9 | ||
10 | #include <stdint.h> | ||
11 | #include <stdlib.h> | ||
12 | |||
10 | #include "packed.h" | 13 | #include "packed.h" |
11 | 14 | ||
15 | #ifdef __cplusplus | ||
16 | extern "C" { | ||
17 | #endif /* __cplusplus */ | ||
18 | |||
12 | PACKED_TYPE(iso7816_header_t, | 19 | PACKED_TYPE(iso7816_header_t, |
13 | struct iso7816_header { | 20 | struct iso7816_header { |
14 | uint8_t cla; | 21 | uint8_t cla; |
@@ -35,4 +42,8 @@ iso7816_apdu_t *iso7816_new(uint8_t, uint8_t, uint16_t); | |||
35 | size_t iso7816_len(const iso7816_apdu_t *); | 42 | size_t iso7816_len(const iso7816_apdu_t *); |
36 | void iso7816_free(iso7816_apdu_t **); | 43 | void iso7816_free(iso7816_apdu_t **); |
37 | 44 | ||
45 | #ifdef __cplusplus | ||
46 | } /* extern "C" */ | ||
47 | #endif /* __cplusplus */ | ||
48 | |||
38 | #endif /* !_ISO7816_H */ | 49 | #endif /* !_ISO7816_H */ |
@@ -7,57 +7,86 @@ | |||
7 | #include <stdarg.h> | 7 | #include <stdarg.h> |
8 | #include <stdio.h> | 8 | #include <stdio.h> |
9 | #include <stdlib.h> | 9 | #include <stdlib.h> |
10 | #include <string.h> | ||
11 | |||
10 | #include "fido.h" | 12 | #include "fido.h" |
11 | 13 | ||
12 | #ifndef FIDO_NO_DIAGNOSTIC | 14 | #ifndef FIDO_NO_DIAGNOSTIC |
13 | 15 | ||
16 | #define XXDLEN 32 | ||
17 | #define XXDROW 128 | ||
18 | #define LINELEN 256 | ||
19 | |||
14 | #ifndef TLS | 20 | #ifndef TLS |
15 | #define TLS | 21 | #define TLS |
16 | #endif | 22 | #endif |
17 | 23 | ||
18 | static TLS int logging; | 24 | static TLS int logging; |
25 | static TLS fido_log_handler_t *log_handler; | ||
26 | |||
27 | static void | ||
28 | log_on_stderr(const char *str) | ||
29 | { | ||
30 | fprintf(stderr, "%s", str); | ||
31 | } | ||
19 | 32 | ||
20 | void | 33 | void |
21 | fido_log_init(void) | 34 | fido_log_init(void) |
22 | { | 35 | { |
23 | logging = 1; | 36 | logging = 1; |
37 | log_handler = log_on_stderr; | ||
24 | } | 38 | } |
25 | 39 | ||
26 | void | 40 | void |
27 | fido_log_xxd(const void *buf, size_t count) | 41 | fido_log_debug(const char *fmt, ...) |
28 | { | 42 | { |
29 | const uint8_t *ptr = buf; | 43 | char line[LINELEN]; |
30 | size_t i; | 44 | va_list ap; |
45 | int r; | ||
31 | 46 | ||
32 | if (!logging) | 47 | if (!logging || log_handler == NULL) |
33 | return; | 48 | return; |
34 | 49 | ||
35 | fprintf(stderr, " "); | 50 | va_start(ap, fmt); |
36 | 51 | r = vsnprintf(line, sizeof(line) - 1, fmt, ap); | |
37 | for (i = 0; i < count; i++) { | 52 | va_end(ap); |
38 | fprintf(stderr, "%02x ", *ptr++); | 53 | if (r < 0 || (size_t)r >= sizeof(line) - 1) |
39 | if ((i + 1) % 16 == 0 && i + 1 < count) | 54 | return; |
40 | fprintf(stderr, "\n "); | 55 | strlcat(line, "\n", sizeof(line)); |
41 | } | 56 | log_handler(line); |
42 | |||
43 | fprintf(stderr, "\n"); | ||
44 | fflush(stderr); | ||
45 | } | 57 | } |
46 | 58 | ||
47 | void | 59 | void |
48 | fido_log_debug(const char *fmt, ...) | 60 | fido_log_xxd(const void *buf, size_t count) |
49 | { | 61 | { |
50 | va_list ap; | 62 | const uint8_t *ptr = buf; |
63 | char row[XXDROW]; | ||
64 | char xxd[XXDLEN]; | ||
51 | 65 | ||
52 | if (!logging) | 66 | if (!logging || log_handler == NULL || count == 0) |
53 | return; | 67 | return; |
54 | 68 | ||
55 | va_start(ap, fmt); | 69 | *row = '\0'; |
56 | vfprintf(stderr, fmt, ap); | ||
57 | va_end(ap); | ||
58 | 70 | ||
59 | fprintf(stderr, "\n"); | 71 | for (size_t i = 0; i < count; i++) { |
60 | fflush(stderr); | 72 | *xxd = '\0'; |
73 | if (i % 16 == 0) | ||
74 | snprintf(xxd, sizeof(xxd), "%04zu: %02x", i, *ptr++); | ||
75 | else | ||
76 | snprintf(xxd, sizeof(xxd), " %02x", *ptr++); | ||
77 | strlcat(row, xxd, sizeof(row)); | ||
78 | if (i % 16 == 15 || i == count - 1) { | ||
79 | fido_log_debug("%s", row); | ||
80 | *row = '\0'; | ||
81 | } | ||
82 | } | ||
83 | } | ||
84 | |||
85 | void | ||
86 | fido_set_log_handler(fido_log_handler_t *handler) | ||
87 | { | ||
88 | if (handler != NULL) | ||
89 | log_handler = handler; | ||
61 | } | 90 | } |
62 | 91 | ||
63 | #endif /* !FIDO_NO_DIAGNOSTIC */ | 92 | #endif /* !FIDO_NO_DIAGNOSTIC */ |
@@ -5,6 +5,7 @@ | |||
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <string.h> | 7 | #include <string.h> |
8 | |||
8 | #include "fido.h" | 9 | #include "fido.h" |
9 | #include "fido/es256.h" | 10 | #include "fido/es256.h" |
10 | 11 | ||
@@ -23,6 +24,14 @@ parse_pintoken(const cbor_item_t *key, const cbor_item_t *val, void *arg) | |||
23 | return (fido_blob_decode(val, token)); | 24 | return (fido_blob_decode(val, token)); |
24 | } | 25 | } |
25 | 26 | ||
27 | #ifdef FIDO_UVTOKEN | ||
28 | static int | ||
29 | parse_uvtoken(const cbor_item_t *key, const cbor_item_t *val, void *arg) | ||
30 | { | ||
31 | return (parse_pintoken(key, val, arg)); | ||
32 | } | ||
33 | #endif /* FIDO_UVTOKEN */ | ||
34 | |||
26 | static int | 35 | static int |
27 | fido_dev_get_pin_token_tx(fido_dev_t *dev, const char *pin, | 36 | fido_dev_get_pin_token_tx(fido_dev_t *dev, const char *pin, |
28 | const fido_blob_t *ecdh, const es256_pk_t *pk) | 37 | const fido_blob_t *ecdh, const es256_pk_t *pk) |
@@ -51,8 +60,8 @@ fido_dev_get_pin_token_tx(fido_dev_t *dev, const char *pin, | |||
51 | goto fail; | 60 | goto fail; |
52 | } | 61 | } |
53 | 62 | ||
54 | if (cbor_build_frame(CTAP_CBOR_CLIENT_PIN, argv, 6, &f) < 0 || | 63 | if (cbor_build_frame(CTAP_CBOR_CLIENT_PIN, argv, nitems(argv), |
55 | fido_tx(dev, CTAP_FRAME_INIT | CTAP_CMD_CBOR, f.ptr, f.len) < 0) { | 64 | &f) < 0 || fido_tx(dev, CTAP_CMD_CBOR, f.ptr, f.len) < 0) { |
56 | fido_log_debug("%s: fido_tx", __func__); | 65 | fido_log_debug("%s: fido_tx", __func__); |
57 | r = FIDO_ERR_TX; | 66 | r = FIDO_ERR_TX; |
58 | goto fail; | 67 | goto fail; |
@@ -67,13 +76,47 @@ fail: | |||
67 | return (r); | 76 | return (r); |
68 | } | 77 | } |
69 | 78 | ||
79 | #ifdef FIDO_UVTOKEN | ||
80 | static int | ||
81 | fido_dev_get_uv_token_tx(fido_dev_t *dev, const es256_pk_t *pk) | ||
82 | { | ||
83 | fido_blob_t f; | ||
84 | cbor_item_t *argv[3]; | ||
85 | int r; | ||
86 | |||
87 | memset(&f, 0, sizeof(f)); | ||
88 | memset(argv, 0, sizeof(argv)); | ||
89 | |||
90 | if ((argv[0] = cbor_build_uint8(1)) == NULL || | ||
91 | (argv[1] = cbor_build_uint8(6)) == NULL || | ||
92 | (argv[2] = es256_pk_encode(pk, 0)) == NULL) { | ||
93 | fido_log_debug("%s: cbor encode", __func__); | ||
94 | r = FIDO_ERR_INTERNAL; | ||
95 | goto fail; | ||
96 | } | ||
97 | |||
98 | if (cbor_build_frame(CTAP_CBOR_CLIENT_PIN, argv, nitems(argv), | ||
99 | &f) < 0 || fido_tx(dev, CTAP_CMD_CBOR, f.ptr, f.len) < 0) { | ||
100 | fido_log_debug("%s: fido_tx", __func__); | ||
101 | r = FIDO_ERR_TX; | ||
102 | goto fail; | ||
103 | } | ||
104 | |||
105 | r = FIDO_OK; | ||
106 | fail: | ||
107 | cbor_vector_free(argv, nitems(argv)); | ||
108 | free(f.ptr); | ||
109 | |||
110 | return (r); | ||
111 | } | ||
112 | #endif /* FIDO_UVTOKEN */ | ||
113 | |||
70 | static int | 114 | static int |
71 | fido_dev_get_pin_token_rx(fido_dev_t *dev, const fido_blob_t *ecdh, | 115 | fido_dev_get_pin_token_rx(fido_dev_t *dev, const fido_blob_t *ecdh, |
72 | fido_blob_t *token, int ms) | 116 | fido_blob_t *token, int ms) |
73 | { | 117 | { |
74 | const uint8_t cmd = CTAP_FRAME_INIT | CTAP_CMD_CBOR; | ||
75 | fido_blob_t *aes_token = NULL; | 118 | fido_blob_t *aes_token = NULL; |
76 | unsigned char reply[2048]; | 119 | unsigned char reply[FIDO_MAXMSG]; |
77 | int reply_len; | 120 | int reply_len; |
78 | int r; | 121 | int r; |
79 | 122 | ||
@@ -82,7 +125,8 @@ fido_dev_get_pin_token_rx(fido_dev_t *dev, const fido_blob_t *ecdh, | |||
82 | goto fail; | 125 | goto fail; |
83 | } | 126 | } |
84 | 127 | ||
85 | if ((reply_len = fido_rx(dev, cmd, &reply, sizeof(reply), ms)) < 0) { | 128 | if ((reply_len = fido_rx(dev, CTAP_CMD_CBOR, &reply, sizeof(reply), |
129 | ms)) < 0) { | ||
86 | fido_log_debug("%s: fido_rx", __func__); | 130 | fido_log_debug("%s: fido_rx", __func__); |
87 | r = FIDO_ERR_RX; | 131 | r = FIDO_ERR_RX; |
88 | goto fail; | 132 | goto fail; |
@@ -107,15 +151,69 @@ fail: | |||
107 | return (r); | 151 | return (r); |
108 | } | 152 | } |
109 | 153 | ||
154 | #ifdef FIDO_UVTOKEN | ||
155 | static int | ||
156 | fido_dev_get_uv_token_rx(fido_dev_t *dev, const fido_blob_t *ecdh, | ||
157 | fido_blob_t *token, int ms) | ||
158 | { | ||
159 | fido_blob_t *aes_token = NULL; | ||
160 | unsigned char reply[FIDO_MAXMSG]; | ||
161 | int reply_len; | ||
162 | int r; | ||
163 | |||
164 | if ((aes_token = fido_blob_new()) == NULL) { | ||
165 | r = FIDO_ERR_INTERNAL; | ||
166 | goto fail; | ||
167 | } | ||
168 | |||
169 | if ((reply_len = fido_rx(dev, CTAP_CMD_CBOR, &reply, sizeof(reply), | ||
170 | ms)) < 0) { | ||
171 | fido_log_debug("%s: fido_rx", __func__); | ||
172 | r = FIDO_ERR_RX; | ||
173 | goto fail; | ||
174 | } | ||
175 | |||
176 | if ((r = cbor_parse_reply(reply, (size_t)reply_len, aes_token, | ||
177 | parse_uvtoken)) != FIDO_OK) { | ||
178 | fido_log_debug("%s: parse_uvtoken", __func__); | ||
179 | goto fail; | ||
180 | } | ||
181 | |||
182 | if (aes256_cbc_dec(ecdh, aes_token, token) < 0) { | ||
183 | fido_log_debug("%s: aes256_cbc_dec", __func__); | ||
184 | r = FIDO_ERR_RX; | ||
185 | goto fail; | ||
186 | } | ||
187 | |||
188 | r = FIDO_OK; | ||
189 | fail: | ||
190 | fido_blob_free(&aes_token); | ||
191 | |||
192 | return (r); | ||
193 | } | ||
194 | #endif /* FIDO_UVTOKEN */ | ||
195 | |||
110 | static int | 196 | static int |
111 | fido_dev_get_pin_token_wait(fido_dev_t *dev, const char *pin, | 197 | fido_dev_get_pin_token_wait(fido_dev_t *dev, const char *pin, |
112 | const fido_blob_t *ecdh, const es256_pk_t *pk, fido_blob_t *token, int ms) | 198 | const fido_blob_t *ecdh, const es256_pk_t *pk, fido_blob_t *token, int ms) |
113 | { | 199 | { |
114 | int r; | 200 | int r; |
115 | 201 | ||
202 | #ifdef FIDO_UVTOKEN | ||
203 | if (getenv("FIDO_UVTOKEN") != NULL) { | ||
204 | if ((r = fido_dev_get_uv_token_tx(dev, pk)) != FIDO_OK || | ||
205 | (r = fido_dev_get_uv_token_rx(dev, ecdh, token, ms)) != FIDO_OK) | ||
206 | return (r); | ||
207 | } else { | ||
208 | if ((r = fido_dev_get_pin_token_tx(dev, pin, ecdh, pk)) != FIDO_OK || | ||
209 | (r = fido_dev_get_pin_token_rx(dev, ecdh, token, ms)) != FIDO_OK) | ||
210 | return (r); | ||
211 | } | ||
212 | #else | ||
116 | if ((r = fido_dev_get_pin_token_tx(dev, pin, ecdh, pk)) != FIDO_OK || | 213 | if ((r = fido_dev_get_pin_token_tx(dev, pin, ecdh, pk)) != FIDO_OK || |
117 | (r = fido_dev_get_pin_token_rx(dev, ecdh, token, ms)) != FIDO_OK) | 214 | (r = fido_dev_get_pin_token_rx(dev, ecdh, token, ms)) != FIDO_OK) |
118 | return (r); | 215 | return (r); |
216 | #endif | ||
119 | 217 | ||
120 | return (FIDO_OK); | 218 | return (FIDO_OK); |
121 | } | 219 | } |
@@ -196,8 +294,8 @@ fido_dev_change_pin_tx(fido_dev_t *dev, const char *pin, const char *oldpin) | |||
196 | goto fail; | 294 | goto fail; |
197 | } | 295 | } |
198 | 296 | ||
199 | if (cbor_build_frame(CTAP_CBOR_CLIENT_PIN, argv, 6, &f) < 0 || | 297 | if (cbor_build_frame(CTAP_CBOR_CLIENT_PIN, argv, nitems(argv), |
200 | fido_tx(dev, CTAP_FRAME_INIT | CTAP_CMD_CBOR, f.ptr, f.len) < 0) { | 298 | &f) < 0 || fido_tx(dev, CTAP_CMD_CBOR, f.ptr, f.len) < 0) { |
201 | fido_log_debug("%s: fido_tx", __func__); | 299 | fido_log_debug("%s: fido_tx", __func__); |
202 | r = FIDO_ERR_TX; | 300 | r = FIDO_ERR_TX; |
203 | goto fail; | 301 | goto fail; |
@@ -249,8 +347,8 @@ fido_dev_set_pin_tx(fido_dev_t *dev, const char *pin) | |||
249 | goto fail; | 347 | goto fail; |
250 | } | 348 | } |
251 | 349 | ||
252 | if (cbor_build_frame(CTAP_CBOR_CLIENT_PIN, argv, 5, &f) < 0 || | 350 | if (cbor_build_frame(CTAP_CBOR_CLIENT_PIN, argv, nitems(argv), |
253 | fido_tx(dev, CTAP_FRAME_INIT | CTAP_CMD_CBOR, f.ptr, f.len) < 0) { | 351 | &f) < 0 || fido_tx(dev, CTAP_CMD_CBOR, f.ptr, f.len) < 0) { |
254 | fido_log_debug("%s: fido_tx", __func__); | 352 | fido_log_debug("%s: fido_tx", __func__); |
255 | r = FIDO_ERR_TX; | 353 | r = FIDO_ERR_TX; |
256 | goto fail; | 354 | goto fail; |
@@ -338,8 +436,8 @@ fido_dev_get_retry_count_tx(fido_dev_t *dev) | |||
338 | goto fail; | 436 | goto fail; |
339 | } | 437 | } |
340 | 438 | ||
341 | if (cbor_build_frame(CTAP_CBOR_CLIENT_PIN, argv, 2, &f) < 0 || | 439 | if (cbor_build_frame(CTAP_CBOR_CLIENT_PIN, argv, nitems(argv), |
342 | fido_tx(dev, CTAP_FRAME_INIT | CTAP_CMD_CBOR, f.ptr, f.len) < 0) { | 440 | &f) < 0 || fido_tx(dev, CTAP_CMD_CBOR, f.ptr, f.len) < 0) { |
343 | fido_log_debug("%s: fido_tx", __func__); | 441 | fido_log_debug("%s: fido_tx", __func__); |
344 | r = FIDO_ERR_TX; | 442 | r = FIDO_ERR_TX; |
345 | goto fail; | 443 | goto fail; |
@@ -356,14 +454,14 @@ fail: | |||
356 | static int | 454 | static int |
357 | fido_dev_get_retry_count_rx(fido_dev_t *dev, int *retries, int ms) | 455 | fido_dev_get_retry_count_rx(fido_dev_t *dev, int *retries, int ms) |
358 | { | 456 | { |
359 | const uint8_t cmd = CTAP_FRAME_INIT | CTAP_CMD_CBOR; | 457 | unsigned char reply[FIDO_MAXMSG]; |
360 | unsigned char reply[512]; | ||
361 | int reply_len; | 458 | int reply_len; |
362 | int r; | 459 | int r; |
363 | 460 | ||
364 | *retries = 0; | 461 | *retries = 0; |
365 | 462 | ||
366 | if ((reply_len = fido_rx(dev, cmd, &reply, sizeof(reply), ms)) < 0) { | 463 | if ((reply_len = fido_rx(dev, CTAP_CMD_CBOR, &reply, sizeof(reply), |
464 | ms)) < 0) { | ||
367 | fido_log_debug("%s: fido_rx", __func__); | 465 | fido_log_debug("%s: fido_rx", __func__); |
368 | return (FIDO_ERR_RX); | 466 | return (FIDO_ERR_RX); |
369 | } | 467 | } |
diff --git a/src/reset.c b/src/reset.c index 4b2c88a..ebda1cd 100644 --- a/src/reset.c +++ b/src/reset.c | |||
@@ -10,10 +10,9 @@ | |||
10 | static int | 10 | static int |
11 | fido_dev_reset_tx(fido_dev_t *dev) | 11 | fido_dev_reset_tx(fido_dev_t *dev) |
12 | { | 12 | { |
13 | const unsigned char cbor[] = { CTAP_CBOR_RESET }; | 13 | const unsigned char cbor[] = { CTAP_CBOR_RESET }; |
14 | const uint8_t cmd = CTAP_FRAME_INIT | CTAP_CMD_CBOR; | ||
15 | 14 | ||
16 | if (fido_tx(dev, cmd, cbor, sizeof(cbor)) < 0) { | 15 | if (fido_tx(dev, CTAP_CMD_CBOR, cbor, sizeof(cbor)) < 0) { |
17 | fido_log_debug("%s: fido_tx", __func__); | 16 | fido_log_debug("%s: fido_tx", __func__); |
18 | return (FIDO_ERR_TX); | 17 | return (FIDO_ERR_TX); |
19 | } | 18 | } |
@@ -125,11 +125,10 @@ authdata_fake(const char *rp_id, uint8_t flags, uint32_t sigcount, | |||
125 | static int | 125 | static int |
126 | send_dummy_register(fido_dev_t *dev, int ms) | 126 | send_dummy_register(fido_dev_t *dev, int ms) |
127 | { | 127 | { |
128 | const uint8_t cmd = CTAP_FRAME_INIT | CTAP_CMD_MSG; | ||
129 | iso7816_apdu_t *apdu = NULL; | 128 | iso7816_apdu_t *apdu = NULL; |
130 | unsigned char challenge[SHA256_DIGEST_LENGTH]; | 129 | unsigned char challenge[SHA256_DIGEST_LENGTH]; |
131 | unsigned char application[SHA256_DIGEST_LENGTH]; | 130 | unsigned char application[SHA256_DIGEST_LENGTH]; |
132 | unsigned char reply[2048]; | 131 | unsigned char reply[FIDO_MAXMSG]; |
133 | int r; | 132 | int r; |
134 | 133 | ||
135 | #ifdef FIDO_FUZZ | 134 | #ifdef FIDO_FUZZ |
@@ -150,13 +149,13 @@ send_dummy_register(fido_dev_t *dev, int ms) | |||
150 | } | 149 | } |
151 | 150 | ||
152 | do { | 151 | do { |
153 | if (fido_tx(dev, cmd, iso7816_ptr(apdu), | 152 | if (fido_tx(dev, CTAP_CMD_MSG, iso7816_ptr(apdu), |
154 | iso7816_len(apdu)) < 0) { | 153 | iso7816_len(apdu)) < 0) { |
155 | fido_log_debug("%s: fido_tx", __func__); | 154 | fido_log_debug("%s: fido_tx", __func__); |
156 | r = FIDO_ERR_TX; | 155 | r = FIDO_ERR_TX; |
157 | goto fail; | 156 | goto fail; |
158 | } | 157 | } |
159 | if (fido_rx(dev, cmd, &reply, sizeof(reply), ms) < 2) { | 158 | if (fido_rx(dev, CTAP_CMD_MSG, &reply, sizeof(reply), ms) < 2) { |
160 | fido_log_debug("%s: fido_rx", __func__); | 159 | fido_log_debug("%s: fido_rx", __func__); |
161 | r = FIDO_ERR_RX; | 160 | r = FIDO_ERR_RX; |
162 | goto fail; | 161 | goto fail; |
@@ -179,11 +178,10 @@ static int | |||
179 | key_lookup(fido_dev_t *dev, const char *rp_id, const fido_blob_t *key_id, | 178 | key_lookup(fido_dev_t *dev, const char *rp_id, const fido_blob_t *key_id, |
180 | int *found, int ms) | 179 | int *found, int ms) |
181 | { | 180 | { |
182 | const uint8_t cmd = CTAP_FRAME_INIT | CTAP_CMD_MSG; | ||
183 | iso7816_apdu_t *apdu = NULL; | 181 | iso7816_apdu_t *apdu = NULL; |
184 | unsigned char challenge[SHA256_DIGEST_LENGTH]; | 182 | unsigned char challenge[SHA256_DIGEST_LENGTH]; |
185 | unsigned char rp_id_hash[SHA256_DIGEST_LENGTH]; | 183 | unsigned char rp_id_hash[SHA256_DIGEST_LENGTH]; |
186 | unsigned char reply[8]; | 184 | unsigned char reply[FIDO_MAXMSG]; |
187 | uint8_t key_id_len; | 185 | uint8_t key_id_len; |
188 | int r; | 186 | int r; |
189 | 187 | ||
@@ -217,12 +215,13 @@ key_lookup(fido_dev_t *dev, const char *rp_id, const fido_blob_t *key_id, | |||
217 | goto fail; | 215 | goto fail; |
218 | } | 216 | } |
219 | 217 | ||
220 | if (fido_tx(dev, cmd, iso7816_ptr(apdu), iso7816_len(apdu)) < 0) { | 218 | if (fido_tx(dev, CTAP_CMD_MSG, iso7816_ptr(apdu), |
219 | iso7816_len(apdu)) < 0) { | ||
221 | fido_log_debug("%s: fido_tx", __func__); | 220 | fido_log_debug("%s: fido_tx", __func__); |
222 | r = FIDO_ERR_TX; | 221 | r = FIDO_ERR_TX; |
223 | goto fail; | 222 | goto fail; |
224 | } | 223 | } |
225 | if (fido_rx(dev, cmd, &reply, sizeof(reply), ms) != 2) { | 224 | if (fido_rx(dev, CTAP_CMD_MSG, &reply, sizeof(reply), ms) != 2) { |
226 | fido_log_debug("%s: fido_rx", __func__); | 225 | fido_log_debug("%s: fido_rx", __func__); |
227 | r = FIDO_ERR_RX; | 226 | r = FIDO_ERR_RX; |
228 | goto fail; | 227 | goto fail; |
@@ -285,10 +284,9 @@ static int | |||
285 | do_auth(fido_dev_t *dev, const fido_blob_t *cdh, const char *rp_id, | 284 | do_auth(fido_dev_t *dev, const fido_blob_t *cdh, const char *rp_id, |
286 | const fido_blob_t *key_id, fido_blob_t *sig, fido_blob_t *ad, int ms) | 285 | const fido_blob_t *key_id, fido_blob_t *sig, fido_blob_t *ad, int ms) |
287 | { | 286 | { |
288 | const uint8_t cmd = CTAP_FRAME_INIT | CTAP_CMD_MSG; | ||
289 | iso7816_apdu_t *apdu = NULL; | 287 | iso7816_apdu_t *apdu = NULL; |
290 | unsigned char rp_id_hash[SHA256_DIGEST_LENGTH]; | 288 | unsigned char rp_id_hash[SHA256_DIGEST_LENGTH]; |
291 | unsigned char reply[128]; | 289 | unsigned char reply[FIDO_MAXMSG]; |
292 | int reply_len; | 290 | int reply_len; |
293 | uint8_t key_id_len; | 291 | uint8_t key_id_len; |
294 | int r; | 292 | int r; |
@@ -326,14 +324,14 @@ do_auth(fido_dev_t *dev, const fido_blob_t *cdh, const char *rp_id, | |||
326 | } | 324 | } |
327 | 325 | ||
328 | do { | 326 | do { |
329 | if (fido_tx(dev, cmd, iso7816_ptr(apdu), | 327 | if (fido_tx(dev, CTAP_CMD_MSG, iso7816_ptr(apdu), |
330 | iso7816_len(apdu)) < 0) { | 328 | iso7816_len(apdu)) < 0) { |
331 | fido_log_debug("%s: fido_tx", __func__); | 329 | fido_log_debug("%s: fido_tx", __func__); |
332 | r = FIDO_ERR_TX; | 330 | r = FIDO_ERR_TX; |
333 | goto fail; | 331 | goto fail; |
334 | } | 332 | } |
335 | if ((reply_len = fido_rx(dev, cmd, &reply, sizeof(reply), | 333 | if ((reply_len = fido_rx(dev, CTAP_CMD_MSG, &reply, |
336 | ms)) < 2) { | 334 | sizeof(reply), ms)) < 2) { |
337 | fido_log_debug("%s: fido_rx", __func__); | 335 | fido_log_debug("%s: fido_rx", __func__); |
338 | r = FIDO_ERR_RX; | 336 | r = FIDO_ERR_RX; |
339 | goto fail; | 337 | goto fail; |
@@ -575,10 +573,9 @@ fail: | |||
575 | int | 573 | int |
576 | u2f_register(fido_dev_t *dev, fido_cred_t *cred, int ms) | 574 | u2f_register(fido_dev_t *dev, fido_cred_t *cred, int ms) |
577 | { | 575 | { |
578 | const uint8_t cmd = CTAP_FRAME_INIT | CTAP_CMD_MSG; | ||
579 | iso7816_apdu_t *apdu = NULL; | 576 | iso7816_apdu_t *apdu = NULL; |
580 | unsigned char rp_id_hash[SHA256_DIGEST_LENGTH]; | 577 | unsigned char rp_id_hash[SHA256_DIGEST_LENGTH]; |
581 | unsigned char reply[2048]; | 578 | unsigned char reply[FIDO_MAXMSG]; |
582 | int reply_len; | 579 | int reply_len; |
583 | int found; | 580 | int found; |
584 | int r; | 581 | int r; |
@@ -634,14 +631,14 @@ u2f_register(fido_dev_t *dev, fido_cred_t *cred, int ms) | |||
634 | } | 631 | } |
635 | 632 | ||
636 | do { | 633 | do { |
637 | if (fido_tx(dev, cmd, iso7816_ptr(apdu), | 634 | if (fido_tx(dev, CTAP_CMD_MSG, iso7816_ptr(apdu), |
638 | iso7816_len(apdu)) < 0) { | 635 | iso7816_len(apdu)) < 0) { |
639 | fido_log_debug("%s: fido_tx", __func__); | 636 | fido_log_debug("%s: fido_tx", __func__); |
640 | r = FIDO_ERR_TX; | 637 | r = FIDO_ERR_TX; |
641 | goto fail; | 638 | goto fail; |
642 | } | 639 | } |
643 | if ((reply_len = fido_rx(dev, cmd, &reply, sizeof(reply), | 640 | if ((reply_len = fido_rx(dev, CTAP_CMD_MSG, &reply, |
644 | ms)) < 2) { | 641 | sizeof(reply), ms)) < 2) { |
645 | fido_log_debug("%s: fido_rx", __func__); | 642 | fido_log_debug("%s: fido_rx", __func__); |
646 | r = FIDO_ERR_RX; | 643 | r = FIDO_ERR_RX; |
647 | goto fail; | 644 | goto fail; |
@@ -687,6 +684,12 @@ u2f_authenticate_single(fido_dev_t *dev, const fido_blob_t *key_id, | |||
687 | goto fail; | 684 | goto fail; |
688 | } | 685 | } |
689 | 686 | ||
687 | if (fido_blob_set(&fa->stmt[idx].id, key_id->ptr, key_id->len) < 0) { | ||
688 | fido_log_debug("%s: fido_blob_set", __func__); | ||
689 | r = FIDO_ERR_INTERNAL; | ||
690 | goto fail; | ||
691 | } | ||
692 | |||
690 | if (fa->up == FIDO_OPT_FALSE) { | 693 | if (fa->up == FIDO_OPT_FALSE) { |
691 | fido_log_debug("%s: checking for key existence only", __func__); | 694 | fido_log_debug("%s: checking for key existence only", __func__); |
692 | r = FIDO_ERR_USER_PRESENCE_REQUIRED; | 695 | r = FIDO_ERR_USER_PRESENCE_REQUIRED; |
@@ -699,8 +702,7 @@ u2f_authenticate_single(fido_dev_t *dev, const fido_blob_t *key_id, | |||
699 | goto fail; | 702 | goto fail; |
700 | } | 703 | } |
701 | 704 | ||
702 | if (fido_blob_set(&fa->stmt[idx].id, key_id->ptr, key_id->len) < 0 || | 705 | if (fido_assert_set_authdata(fa, idx, ad.ptr, ad.len) != FIDO_OK || |
703 | fido_assert_set_authdata(fa, idx, ad.ptr, ad.len) != FIDO_OK || | ||
704 | fido_assert_set_sig(fa, idx, sig.ptr, sig.len) != FIDO_OK) { | 706 | fido_assert_set_sig(fa, idx, sig.ptr, sig.len) != FIDO_OK) { |
705 | fido_log_debug("%s: fido_assert_set", __func__); | 707 | fido_log_debug("%s: fido_assert_set", __func__); |
706 | r = FIDO_ERR_INTERNAL; | 708 | r = FIDO_ERR_INTERNAL; |
@@ -724,6 +726,7 @@ fail: | |||
724 | int | 726 | int |
725 | u2f_authenticate(fido_dev_t *dev, fido_assert_t *fa, int ms) | 727 | u2f_authenticate(fido_dev_t *dev, fido_assert_t *fa, int ms) |
726 | { | 728 | { |
729 | int nfound = 0; | ||
727 | int nauth_ok = 0; | 730 | int nauth_ok = 0; |
728 | int r; | 731 | int r; |
729 | 732 | ||
@@ -739,20 +742,30 @@ u2f_authenticate(fido_dev_t *dev, fido_assert_t *fa, int ms) | |||
739 | } | 742 | } |
740 | 743 | ||
741 | for (size_t i = 0; i < fa->allow_list.len; i++) { | 744 | for (size_t i = 0; i < fa->allow_list.len; i++) { |
742 | if ((r = u2f_authenticate_single(dev, &fa->allow_list.ptr[i], | 745 | switch ((r = u2f_authenticate_single(dev, |
743 | fa, nauth_ok, ms)) == FIDO_OK) { | 746 | &fa->allow_list.ptr[i], fa, nfound, ms))) { |
747 | case FIDO_OK: | ||
744 | nauth_ok++; | 748 | nauth_ok++; |
745 | } else if (r != FIDO_ERR_CREDENTIAL_EXCLUDED) { | 749 | /* FALLTHROUGH */ |
746 | fido_log_debug("%s: u2f_authenticate_single", __func__); | 750 | case FIDO_ERR_USER_PRESENCE_REQUIRED: |
747 | return (r); | 751 | nfound++; |
752 | break; | ||
753 | default: | ||
754 | if (r != FIDO_ERR_CREDENTIAL_EXCLUDED) { | ||
755 | fido_log_debug("%s: u2f_authenticate_single", | ||
756 | __func__); | ||
757 | return (r); | ||
758 | } | ||
759 | /* ignore credentials that don't exist */ | ||
748 | } | 760 | } |
749 | /* ignore credentials that don't exist */ | ||
750 | } | 761 | } |
751 | 762 | ||
752 | fa->stmt_len = nauth_ok; | 763 | fa->stmt_len = nfound; |
753 | 764 | ||
754 | if (nauth_ok == 0) | 765 | if (nfound == 0) |
755 | return (FIDO_ERR_NO_CREDENTIALS); | 766 | return (FIDO_ERR_NO_CREDENTIALS); |
767 | if (nauth_ok == 0) | ||
768 | return (FIDO_ERR_USER_PRESENCE_REQUIRED); | ||
756 | 769 | ||
757 | return (FIDO_OK); | 770 | return (FIDO_OK); |
758 | } | 771 | } |
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 4b8ef32..274a799 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt | |||
@@ -8,7 +8,7 @@ list(APPEND COMPAT_SOURCES | |||
8 | ../openbsd-compat/strlcat.c | 8 | ../openbsd-compat/strlcat.c |
9 | ) | 9 | ) |
10 | 10 | ||
11 | if(WIN32) | 11 | if(WIN32 AND NOT CYGWIN AND NOT MSYS) |
12 | list(APPEND COMPAT_SOURCES | 12 | list(APPEND COMPAT_SOURCES |
13 | ../openbsd-compat/bsd-getline.c | 13 | ../openbsd-compat/bsd-getline.c |
14 | ../openbsd-compat/explicit_bzero_win32.c | 14 | ../openbsd-compat/explicit_bzero_win32.c |
@@ -49,7 +49,6 @@ add_executable(fido2-token | |||
49 | ${COMPAT_SOURCES} | 49 | ${COMPAT_SOURCES} |
50 | ) | 50 | ) |
51 | 51 | ||
52 | |||
53 | target_link_libraries(fido2-cred ${CRYPTO_LIBRARIES} fido2_shared) | 52 | target_link_libraries(fido2-cred ${CRYPTO_LIBRARIES} fido2_shared) |
54 | target_link_libraries(fido2-assert ${CRYPTO_LIBRARIES} fido2_shared) | 53 | target_link_libraries(fido2-assert ${CRYPTO_LIBRARIES} fido2_shared) |
55 | target_link_libraries(fido2-token ${CRYPTO_LIBRARIES} fido2_shared) | 54 | target_link_libraries(fido2-token ${CRYPTO_LIBRARIES} fido2_shared) |
diff --git a/tools/bio.c b/tools/bio.c index b8f9b38..135b055 100644 --- a/tools/bio.c +++ b/tools/bio.c | |||
@@ -253,11 +253,10 @@ void | |||
253 | bio_info(fido_dev_t *dev) | 253 | bio_info(fido_dev_t *dev) |
254 | { | 254 | { |
255 | fido_bio_info_t *i = NULL; | 255 | fido_bio_info_t *i = NULL; |
256 | int r; | ||
257 | 256 | ||
258 | if ((i = fido_bio_info_new()) == NULL) | 257 | if ((i = fido_bio_info_new()) == NULL) |
259 | errx(1, "fido_bio_info_new"); | 258 | errx(1, "fido_bio_info_new"); |
260 | if ((r = fido_bio_dev_get_info(dev, i)) != FIDO_OK) { | 259 | if (fido_bio_dev_get_info(dev, i) != FIDO_OK) { |
261 | fido_bio_info_free(&i); | 260 | fido_bio_info_free(&i); |
262 | return; | 261 | return; |
263 | } | 262 | } |
diff --git a/tools/credman.c b/tools/credman.c index 08c9eb8..6eda245 100644 --- a/tools/credman.c +++ b/tools/credman.c | |||
@@ -37,7 +37,7 @@ credman_get_metadata(fido_dev_t *dev, const char *path) | |||
37 | 37 | ||
38 | printf("existing rk(s): %u\n", | 38 | printf("existing rk(s): %u\n", |
39 | (unsigned)fido_credman_rk_existing(metadata)); | 39 | (unsigned)fido_credman_rk_existing(metadata)); |
40 | printf("possible rk(s): %u\n", | 40 | printf("remaining rk(s): %u\n", |
41 | (unsigned)fido_credman_rk_remaining(metadata)); | 41 | (unsigned)fido_credman_rk_remaining(metadata)); |
42 | 42 | ||
43 | fido_credman_metadata_free(&metadata); | 43 | fido_credman_metadata_free(&metadata); |
diff --git a/tools/extern.h b/tools/extern.h index e79e6f0..be01046 100644 --- a/tools/extern.h +++ b/tools/extern.h | |||
@@ -7,6 +7,12 @@ | |||
7 | #ifndef _EXTERN_H_ | 7 | #ifndef _EXTERN_H_ |
8 | #define _EXTERN_H_ | 8 | #define _EXTERN_H_ |
9 | 9 | ||
10 | #include <stddef.h> | ||
11 | #include <stdio.h> | ||
12 | |||
13 | #include <openssl/ec.h> | ||
14 | #include <fido.h> | ||
15 | |||
10 | struct blob { | 16 | struct blob { |
11 | unsigned char *ptr; | 17 | unsigned char *ptr; |
12 | size_t len; | 18 | size_t len; |
diff --git a/tools/include_check.sh b/tools/include_check.sh new file mode 100755 index 0000000..9958c9a --- /dev/null +++ b/tools/include_check.sh | |||
@@ -0,0 +1,21 @@ | |||
1 | #!/bin/bash | ||
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 | |||
7 | check() { | ||
8 | for f in $(find $1 -maxdepth 1 -name '*.h'); do | ||
9 | echo "#include \"$f\"" | \ | ||
10 | cc $CFLAGS -Isrc -xc -c - -o /dev/null 2>&1 | ||
11 | echo $f $CFLAGS $? | ||
12 | done | ||
13 | } | ||
14 | |||
15 | check examples | ||
16 | check fuzz | ||
17 | check openbsd-compat | ||
18 | CFLAGS=-D_FIDO_INTERNAL check src | ||
19 | check src/fido.h | ||
20 | check src/fido | ||
21 | check tools | ||
diff --git a/tools/macos_pkg.sh b/tools/macos_pkg.sh new file mode 100755 index 0000000..4313c27 --- /dev/null +++ b/tools/macos_pkg.sh | |||
@@ -0,0 +1,44 @@ | |||
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 | if [[ "$#" -ne 2 ]]; then | ||
7 | echo usage: $0 version directory 1>&2 | ||
8 | exit 1 | ||
9 | fi | ||
10 | |||
11 | V=$1 | ||
12 | D=$2 | ||
13 | |||
14 | FIDO_PATH=$(realpath ${D}/lib/libfido2.${V}.dylib) | ||
15 | CBOR_PATH=$(otool -L "${FIDO_PATH}" | grep cbor | awk '{ print $1 }') | ||
16 | CRYPTO_PATH=$(otool -L "${FIDO_PATH}" | grep crypto | awk '{ print $1 }') | ||
17 | |||
18 | cp -p "${CBOR_PATH}" "${CRYPTO_PATH}" "${D}/lib" | ||
19 | chmod 755 "${D}/lib/"*dylib | ||
20 | rm "${D}/lib/pkgconfig/libfido2.pc" | ||
21 | rmdir "${D}/lib/pkgconfig" | ||
22 | |||
23 | CBOR_NAME=$(echo "${CBOR_PATH}" | grep -o 'libcbor.*dylib') | ||
24 | CRYPTO_NAME=$(echo "${CRYPTO_PATH}" | grep -o 'libcrypto.*dylib') | ||
25 | FIDO_NAME="libfido2.${V}.dylib" | ||
26 | |||
27 | install_name_tool -id "@loader_path/${CBOR_NAME}" "${D}/lib/${CBOR_NAME}" | ||
28 | install_name_tool -id "@loader_path/${CRYPTO_NAME}" "${D}/lib/${CRYPTO_NAME}" | ||
29 | install_name_tool -id "@loader_path/libfido2.${V}.dylib" "${FIDO_PATH}" | ||
30 | |||
31 | install_name_tool -change "${CBOR_PATH}" "@loader_path/${CBOR_NAME}" \ | ||
32 | "${FIDO_PATH}" | ||
33 | install_name_tool -change "${CRYPTO_PATH}" "@loader_path/${CRYPTO_NAME}" \ | ||
34 | "${FIDO_PATH}" | ||
35 | |||
36 | for f in $(find "${D}/bin" -type f); do | ||
37 | FIDO_PATH=$(otool -L "${f}" | grep libfido2 | awk '{ print $1 }') | ||
38 | install_name_tool -change "${CBOR_PATH}" \ | ||
39 | "@executable_path/../lib/${CBOR_NAME}" "${f}" | ||
40 | install_name_tool -change "${CRYPTO_PATH}" \ | ||
41 | "@executable_path/../lib/${CRYPTO_NAME}" "${f}" | ||
42 | install_name_tool -change "${FIDO_PATH}" \ | ||
43 | "@executable_path/../lib/${FIDO_NAME}" "${f}" | ||
44 | done | ||
diff --git a/tools/token.c b/tools/token.c index b149208..e65f09f 100644 --- a/tools/token.c +++ b/tools/token.c | |||
@@ -112,6 +112,12 @@ print_maxmsgsiz(uint64_t maxmsgsiz) | |||
112 | } | 112 | } |
113 | 113 | ||
114 | static void | 114 | static void |
115 | print_fwversion(uint64_t fwversion) | ||
116 | { | ||
117 | printf("fwversion: 0x%x\n", (int)fwversion); | ||
118 | } | ||
119 | |||
120 | static void | ||
115 | print_byte_array(const char *label, const uint8_t *ba, size_t len) | 121 | print_byte_array(const char *label, const uint8_t *ba, size_t len) |
116 | { | 122 | { |
117 | if (len == 0) | 123 | if (len == 0) |
@@ -166,7 +172,7 @@ token_info(int argc, char **argv, char *path) | |||
166 | return (credman_print_rk(dev, path, rp_id, cred_id)); | 172 | return (credman_print_rk(dev, path, rp_id, cred_id)); |
167 | if (cred_id || rp_id) | 173 | if (cred_id || rp_id) |
168 | usage(); | 174 | usage(); |
169 | 175 | ||
170 | print_attr(dev); | 176 | print_attr(dev); |
171 | 177 | ||
172 | if (fido_dev_is_fido2(dev) == false) | 178 | if (fido_dev_is_fido2(dev) == false) |
@@ -196,11 +202,14 @@ token_info(int argc, char **argv, char *path) | |||
196 | /* print maximum message size */ | 202 | /* print maximum message size */ |
197 | print_maxmsgsiz(fido_cbor_info_maxmsgsiz(ci)); | 203 | print_maxmsgsiz(fido_cbor_info_maxmsgsiz(ci)); |
198 | 204 | ||
205 | /* print firmware version */ | ||
206 | print_fwversion(fido_cbor_info_fwversion(ci)); | ||
207 | |||
199 | /* print supported pin protocols */ | 208 | /* print supported pin protocols */ |
200 | print_byte_array("pin protocols", fido_cbor_info_protocols_ptr(ci), | 209 | print_byte_array("pin protocols", fido_cbor_info_protocols_ptr(ci), |
201 | fido_cbor_info_protocols_len(ci)); | 210 | fido_cbor_info_protocols_len(ci)); |
202 | 211 | ||
203 | if ((r = fido_dev_get_retry_count(dev, &retrycnt)) != FIDO_OK) | 212 | if (fido_dev_get_retry_count(dev, &retrycnt) != FIDO_OK) |
204 | printf("pin retries: undefined\n"); | 213 | printf("pin retries: undefined\n"); |
205 | else | 214 | else |
206 | printf("pin retries: %d\n", retrycnt); | 215 | printf("pin retries: %d\n", retrycnt); |
diff --git a/udev/70-u2f.rules b/udev/70-u2f.rules index 3932270..22b47c9 100644 --- a/udev/70-u2f.rules +++ b/udev/70-u2f.rules | |||
@@ -35,11 +35,8 @@ KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="2abe", ATTRS{idProduct | |||
35 | # Thetis Key | 35 | # Thetis Key |
36 | KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="1ea8", ATTRS{idProduct}=="f025", TAG+="uaccess", GROUP="plugdev", MODE="0660" | 36 | KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="1ea8", ATTRS{idProduct}=="f025", TAG+="uaccess", GROUP="plugdev", MODE="0660" |
37 | 37 | ||
38 | # Nitrokey FIDO U2F, Nitrokey FIDO2 | 38 | # Nitrokey FIDO U2F, Nitrokey FIDO2, Safetech SafeKey |
39 | KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="20a0", ATTRS{idProduct}=="4287|42b1", TAG+="uaccess", GROUP="plugdev", MODE="0660" | 39 | KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="20a0", ATTRS{idProduct}=="4287|42b1|42b3", TAG+="uaccess", GROUP="plugdev", MODE="0660" |
40 | |||
41 | # Safetech SafeKey | ||
42 | KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="20a0", ATTRS{idProduct}=="42b3", TAG+="uaccess", GROUP="plugdev", MODE="0660" | ||
43 | 40 | ||
44 | # Google Titan U2F | 41 | # Google Titan U2F |
45 | KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="5026", TAG+="uaccess", GROUP="plugdev", MODE="0660" | 42 | KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="5026", TAG+="uaccess", GROUP="plugdev", MODE="0660" |
@@ -72,4 +69,7 @@ KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="311f", ATTRS{idProduct | |||
72 | # OnlyKey (FIDO2 / U2F) | 69 | # OnlyKey (FIDO2 / U2F) |
73 | KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="1d50", ATTRS{idProduct}=="60fc", TAG+="uaccess", GROUP="plugdev", MODE="0660" | 70 | KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="1d50", ATTRS{idProduct}=="60fc", TAG+="uaccess", GROUP="plugdev", MODE="0660" |
74 | 71 | ||
72 | # GoTrust Idem Key | ||
73 | KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="1fc9", ATTRS{idProduct}=="f143", TAG+="uaccess", GROUP="plugdev", MODE="0660" | ||
74 | |||
75 | LABEL="u2f_end" | 75 | LABEL="u2f_end" |