eBPF-based security platform
proofs: run tpm-public once per parser, with the formula sliced
Daniel Borkmannc6fa5325278a
diff --git a/Documentation/contribute/testing/proof-coverage.rst b/Documentation/contribute/testing/proof-coverage.rstindex 29b0511c..2483f33e 100644--- a/Documentation/contribute/testing/proof-coverage.rst+++ b/Documentation/contribute/testing/proof-coverage.rst@@ -780,7 +780,7 @@ or shorter, and "lengths 0 to 6" every input of each of those lengths.2048 bytes* - ``tpm-public``- ``tpm_public_parse()``, ``tpm_ecc_public_parse()``- - Every input; takes about 5 minutes and 7 GB+ - Every input- Accepts only the key shapes shirudo uses, P-256 or RSA-2048 with a256-byte modulus, each spanning exactly the input* - ``tpm-digest``diff --git a/testing/proofs/cbmc/ci-skip.list b/testing/proofs/cbmc/ci-skip.listindex 6cb4331b..489a62ed 100644--- a/testing/proofs/cbmc/ci-skip.list+++ b/testing/proofs/cbmc/ci-skip.list@@ -12,4 +12,3 @@ upatch-prog-uprobes 12 GB at its peakbpm-tree-state-match 11 GB at its peak, for labels read from /etcbpm-tree-state-pending 10 GB at its peakconfig-evidence-collect 7 GB at its peak-tpm-public 7 GB at its peakdiff --git a/testing/proofs/cbmc/proofs.list b/testing/proofs/cbmc/proofs.listindex 24590a7e..c35b92cd 100644--- a/testing/proofs/cbmc/proofs.list+++ b/testing/proofs/cbmc/proofs.list@@ -36,7 +36,7 @@ bpm-upatch-member --unwind 30 LEN=0-18tpm-reader --unwind 1tpm-signature --unwind 1 --unwindset bytes_at.0:33tpm-attest --unwind 1 --unwindset memcpy.0:35-tpm-public --unwind 1+tpm-public --slice-formula --unwind 1 LEN=0-1tpm-digest --unwind 2 --object-bits 12tpm-kdf --unwind 3 --unwindset strlen.0:68 --object-bits 12 -DLABEL_MAX=66 -DOUT_MAX=64attest-fields --unwind 18 LEN=0-16diff --git a/testing/proofs/cbmc/tpm-public.c b/testing/proofs/cbmc/tpm-public.cindex 780c6ebe..7e94fd7f 100644--- a/testing/proofs/cbmc/tpm-public.c+++ b/testing/proofs/cbmc/tpm-public.c@@ -14,6 +14,12 @@/* The longest: a policy, a protector, a scheme and an RSA modulus. */#define PUBLIC_MAX (14 + 32 + 4 + 2 + 8 + 256)+/*+ * LEN picks the parser: 0 tpm_public_parse(), 1 tpm_ecc_public_parse(),+ * which calls it. Both in one run take 7 GB, more than CI gives a proof.+ */+#define ECC_PARSE (LEN == 1)+static bool shape(const struct tpm_public *p){return (p->policy_len == 0 || p->policy_len == 32) &&@@ -45,9 +51,12 @@ void harness(void)size_t len;buf = any_input(len, PUBLIC_MAX);- if (!tpm_public_parse(buf, len, &p))- __CPROVER_assert(shape(&p) && len == wire_len(&p),- "a key of the shapes it names, the whole input");+ if (!ECC_PARSE) {+ if (!tpm_public_parse(buf, len, &p))+ __CPROVER_assert(shape(&p) && len == wire_len(&p),+ "a key of the shapes it names, the whole input");+ return;+ }if (!tpm_ecc_public_parse(buf, len, &ecc))__CPROVER_assert(ecc.curve == TPM_ECC_NIST_P256 &&ecc.scheme == TPM_ALG_ECDSA &&