roll: third_party/pigweed/src fba14dc..9cffd07 (59 commits) 9cffd07:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/471305 roll: gn e60850e:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/471125 roll: luci 7a7046b:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/471085 roll: fuchsia-infra-bazel-rules fefa9ba..f31d055 (2 commits) 179d4e9:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/471045 roll: rust-analyzer 9ea53da:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/466825 pw_toolchain: Add constraint facades for compiler warning flags 3cba8ab:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/470505 pw_multibuf, pw_thread_freertos: Export backend headers 883913a:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/470287 pw_interrupt_*: Switch "impl" back to "context" 0f1cb10:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/470286 zephyr: Remove pw_zephyr_platform.bzl helper 79c3ff6:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/470265 third_party/fuchsia: Copybara import 6d91afb:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/467025 pw_interrupt_zephyr: Allow Bazel builds to configure this backend b484558:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/469505 pw_async2: Expand SKILL with guidance on designing async flows 98a5726:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/468565 roll: toolchain-integration 246e37a:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/381038 pw_allocator: Add ForwardingAllocator de1b241:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/469605 pw_bluetooth_sapphire: Fix and suppress unused variable warnings a855316:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/464145 pw_toolchain: Suppress unused-variable warnings for json.hpp 1d683db:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/469425 pw_assert: Remove unnecessary rust clippy allows bdd975a:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/469525 skills: Use hypens instead of underscores for presubmit checks skill a50d5e7:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/416912 pw_bluetooth_sapphire: (Un)register created CISes bf0398b:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/468625 pw_presubmit: Add npm_test to _LINTFORMAT with path filtering 088116a:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/468805 pw_sys_io_zephyr: Fix Zephyr linkage a5c3c2c:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/468945 .bazelrc: Add cxx20/cxx26 configs 845ed4e:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/383936 pw_allocator: Add reallocating flag to Metrics 85eeb5c:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/457565 pw_assert: Support swappable backend implementations in Rust 521d29f:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/467545 pw_async2: Fix documentation and doc comment errors a66abff:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/346834 pw_build: Remove pigweed_upstream_build 73e7a6c:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/464066 pw_toolchain: Suppress warning in Fuchsia SDK binding_set.h d3d67e8:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/468605 .rgignore: Have rg exclude lockfiles 818348f:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/383935 pw_allocator: Make DoResize pure virtual 2b5a8ee:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/450252 pw_unit_test: Add Rust unit test support 7d1b483:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/463068 third_party/freertos: Add missing headers to targets 6674e33:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/463067 third_party/googletest: Disable sandboxing 6b33d87:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/464766 pw_presubmit: Enable ccache for gn_gen when available 90fb23c:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/464065 pw_build: Prune redundant non-host targets from host workflows 825603e:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/467486 pw_buf: Clarify nullness with nullptr comparisons and assignment 4e60456:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/463026 pw_build: Use toplevel remote_download_outputs for remote_cache 923bc46:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/468345 pw_tokenizer: Fix ts detokenizer breakage 88966b4:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/468145 zephyr: Fix SDK version tag 4728b9d:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/466905 pw_tokenizer: Replace base64ToBinaryString() with decode() in ts 79c2915:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/462885 pw_build, pw_log_zephyr, pw_assert_zephyr: Fix Zephyr linkage and generated header dependencies 52e6169:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/466585 pw_build: Use prebuilt protoc toolchain in workflows launcher 0cd7111:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/463705 pw_bluetooth_sapphire: Use fuchsia bt service b079275:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/466805 pw_ide: Fix kzip merge flags for CIPD compatibility b14af4f:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/466866 pw_bluetooth_sapphire: Avoid redundant property updates in Inspectable cf23bb2:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/466725 pw_bluetooth_sapphire: Safely handle malformed LE advertising reports 03ab020:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/466546 pw_bluetooth_proxy: Sync persistent state on recombined PDU and refunds 5f30249:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/466545 pw_bluetooth_proxy: Protect snapshot restoration pointers with mutexes 09f39e5:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/463845 pw_bluetooth_proxy: Add crash recovery guide and align recovery API ca243ad:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/466425 pw_bluetooth_proxy: Emit updates for new L2CAP channels during recovery ceb8515:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/459046 pw_bluetooth_proxy: Add RFCOMM snapshot recovery b578dca:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/461226 pw_bluetooth_proxy: Consolidate basic L2CAP config into struct 3300d50:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/462065 pw_bluetooth_sapphire: Normalize restored encryption key sizes 0b14c78:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/458905 pw_fuzzer: Remove GN support for FuzzTest and OSS-Fuzz d9955ac:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/459565 pw_bluetooth_proxy: Support allow_data_loss in basic L2CAP interception f2ad5b9:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/461805 pw_bluetooth_proxy: Update ACL unit tests and state updates 314f25f:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/466285 pw_ide: Optimize Kythe extractor with transitive includes and caching c7b1a7b:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/442072 pw_base64, pw_tokenizer: Add TS base64 module and browser fallback 8d51077:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/462987 pw_allocator: Split async_pool into separate Android.bp target 15b7579:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/458686 pw_async_basic: Fix flaky RepostRaceCondition test a8621d9:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/458685 pw_bluetooth_sapphire: Make files writable without sudo when deploying Rolled-Repo: https://pigweed.googlesource.com/pigweed/pigweed Rolled-Commits: fba14dcfb55265..9cffd077bfd5ff Roll-Count: 1 Roller-URL: https://cr-buildbucket.appspot.com/build/8671362259057933681 GitWatcher: ignore CQ-Do-Not-Cancel-Tryjobs: true Change-Id: I14a8ec217ec748e039905c939ac3222dbf17d93d Reviewed-on: https://pigweed-review.googlesource.com/c/open-dice/+/471425
This repository contains the specification for the Open Profile for DICE along with production-quality code. This profile is a specialization of the Hardware Requirements for a Device Identifier Composition Engine and DICE Layering Architecture specifications published by the Trusted Computing Group (TCG). For readers already familiar with those specs, notable distinctives of this profile include:
You can find us (and join us!) at https://groups.google.com/g/open-profile-for-dice. We're happy to answer questions and discuss proposed changes or features.
The specification can be found here. It is versioned using a major.minor scheme. Compatibility is maintained across minor versions but not necessarily across major versions.
Production quality, portable C code is included. The main code is in dice.h and dice.c. Cryptographic and certificate generation operations are injected via a set of callbacks. Multiple implementations of these operations are provided, all equally acceptable. Integrators should choose just one of these, or write their own.
Tests are included for all code and the build files in this repository can be used to build and run these tests.
Disclaimer: This is not an officially supported Google product.
Different implementations use different third party libraries. The third_party directory contains build files and git submodules for each of these. The submodules must be initialized once after cloning the repo, using git submodule update --init, and updated after pulling commits that roll the submodules using git submodule update.
To setup the build environment the first time:
$ git submodule update --init --recursive $ source bootstrap.sh $ gn gen out
To build and run tests:
$ ninja -C out
The easiest way, and currently the only supported way, to build and run tests is from a Pigweed environment on Linux. Pigweed does support other host platforms so it shouldn't be too hard to get this running on Windows for example, but we use Linux.
There are two scripts to help set this up:
bootstrap.sh will initialize submodules, bootstrap a Pigweed environment, and generate build files. This can take some time and may download on the order of 1GB of dependencies so the normal workflow is to just do this once.
activate.sh quickly reactivates an environment that has been previously bootstrapped.
These scripts must be sourced into the current session: source activate.sh.
In the environment, from the base directory of the dice-profile checkout, run ninja -C out to build everything and run all tests. You can also run pw watch which will build, run tests, and continue to watch for changes.
This will build and run tests on the host using the clang toolchain. Pigweed makes it easy to configure other targets and toolchains. See toolchains/BUILD.gn and the Pigweed documentation.
The code is designed to be portable and should work with a variety of modern toolchains and in a variety of environments. The main code in dice.h and dice.c is C99; it uses uint8_t, size_t, and memcpy from the C standard library. The various ops implementations are as portable as their dependencies (often not C99 but still very portable). Notably, this code uses designated initializers for readability. This is a feature available in C since C99 but missing from C++ until C++20 where it appears in a stricter form.
The Google C++ Style Guide is used. A .clang-format file is provided for convenience.
To incorporate the code into another project, there are a few options:
Copy only the necessary code. For example:
Take the main code as is: include/dice/dice.h, src/dice.c
Choose an implementation for crypto and certificate generation or choose to write your own. If you choose the boringssl implementation, for example, take include/dice/utils.h, include/dice/boringssl_ops.h, src/utils.c, and src/boringssl_ops.c. Taking a look at the library targets in BUILD.gn may be helpful.
Add this repository as a git submodule and integrate into the project build, optionally using the gn library targets provided.
Integrate into a project already using Pigweed using the gn build files provided.
The build reports code size using Bloaty McBloatface via the pw_bloat Pigweed module. There are two reports generated:
Library sizes - This report includes just the library code in this repository. It shows the baseline DICE code with no ops selected, and it shows the delta introduced by choosing various ops implementations. This report does not include the size of the third party dependencies.
Executable sizes - This report includes sizes for the library code in this repository plus all dependencies linked into a simple main function which makes a single DICE call with all-zero input. It shows the baseline DICE code with no ops (and therefore no dependencies other than libc), and it shows the delta introduced by choosing various ops implementations. This report does include the size of the third party dependencies. Note that rows specialized from ‘Boringssl Ops’ use that as a baseline for sizing.
The reports will be in the build output, but you can also find the reports in .txt files in the build output. For example, cat out/host_optimized/gen/*.txt | less will display all reports.
This code does not itself use mutable global variables, or any other type of shared data structure so there is no thread-safety concerns. However, additional care is needed to ensure dependencies are configured to be thread-safe. For example, the current boringssl configuration defines OPENSSL_NO_THREADS_CORRUPT_MEMORY_AND_LEAK_SECRETS_IF_THREADED, and that would need to be changed before running in a threaded environment.
This code makes a reasonable effort to clear memory holding sensitive data. This may help with a broader strategy to clear sensitive data but it is not sufficient on its own. Here are a few things to consider.