summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorHoward Yang <hcyang@google.com>2021-09-16 16:06:45 +0800
committerCommit Bot <commit-bot@chromium.org>2021-10-13 02:35:56 +0000
commite805689eacb082f252a25b7a9b07a44d8809442f (patch)
tree8c415a702ad638ae07245fea237b4a66411b0dca /include
parent0b7ad4919624241ba3f6ed4be304213d3e356657 (diff)
downloadchrome-ec-e805689eacb082f252a25b7a9b07a44d8809442f.tar.gz
Reland "cr50_fuzz: Add fuzzer for u2f commands"
This is a reland of 3cac98670745fc5ca82a058fab512567f8444759 The structure of u2f command related types are updated before the original CL lands. Update the fuzzer to correctly fuzz the new code, and ignore the profdata generated by fuzzers in .gitignore. Original change's description: > cr50_fuzz: Add fuzzer for u2f commands > > Currently there's only one fuzzer for Pinweaver and one for host > commands in cr50. Add a fuzzer for the u2f commands (generate, sign, > attest) used in the WebAuthn flow to ensure its security. Most regions > of the concerning functions are covered except for pure error code > returns and unreachable regions (currently auth secret is not used in > sign and attest command yet). > > Rename old cr50_fuzz namings to pinweaver_fuzz, since they only cover > Pinweaver commands. > > BUG=b:172367435 > TEST=make buildall -j > TEST=make host-u2f_fuzz && \ > ./build/host/u2f_fuzz/u2f_fuzz.exe -timeout=10 \ > -ignore_ooms=false -ignore_timeouts=false -fork=71; \ > llvm-profdata merge -sparse default.profraw -o default.profdata; \ > llvm-cov show ./build/host/u2f_fuzz/u2f_fuzz.exe \ > -object ./build/host/u2f_fuzz/RO/board/cr50/dcrypto/u2f.o \ > --instr-profile default.profdata \ > board/cr50/dcrypto/u2f.c common/u2f.c > report > > Cq-Depend: chromium:3162473 > Change-Id: I02b820cf03f7b46ccad7c3bc7b82e73ff45217c6 > Signed-off-by: Howard Yang <hcyang@google.com> > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3162469 > Reviewed-by: Andrey Pronin <apronin@chromium.org> > Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> > Reviewed-by: Leo Lai <cylai@google.com> Bug: b:172367435 Change-Id: I279e20b21a11e0ec957b6a5c3e95bc9a3b9df196 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3217474 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Tested-by: Howard Yang <hcyang@google.com> Commit-Queue: Howard Yang <hcyang@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/common.h2
-rw-r--r--include/u2f_cmds.h5
2 files changed, 6 insertions, 1 deletions
diff --git a/include/common.h b/include/common.h
index 2bbc24d684..def017e214 100644
--- a/include/common.h
+++ b/include/common.h
@@ -134,7 +134,7 @@
#define __warn_unused_result __attribute__((warn_unused_result))
#endif
-#ifdef TEST_CR50_FUZZ
+#ifdef TEST_PINWEAVER_FUZZ
/**
* Workaround: Clang incorrectly handles profiling information
* used for fuzzing with __attribute__((always_inline)).
diff --git a/include/u2f_cmds.h b/include/u2f_cmds.h
index 00a12af808..0f441e5855 100644
--- a/include/u2f_cmds.h
+++ b/include/u2f_cmds.h
@@ -39,6 +39,11 @@ enum vendor_cmd_rc u2f_generate_cmd(enum vendor_cmd_cc code, void *buf,
enum vendor_cmd_rc u2f_sign_cmd(enum vendor_cmd_cc code, void *buf,
size_t input_size, size_t *response_size);
+/**
+ * U2F_ATTEST command handler.
+ */
+enum vendor_cmd_rc u2f_attest_cmd(enum vendor_cmd_cc code, void *buf,
+ size_t input_size, size_t *response_size);
/* Maximum size in bytes of G2F attestation certificate. */
#define G2F_ATTESTATION_CERT_MAX_LEN 315