roll: third_party/pigweed/src c1dd510..cd7eb5e (49 commits) cd7eb5e:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/399952 roll: luci f181198:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/390432 pw_env_setup: Update Windows to GCC 15.2.0 b06f436:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/399532 workflows.json: Split sanitizer programs 33dbb38:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/396334 pw_presubmit: Move Check-related classes to check.py c1f2b61:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/394012 pw_presubmit: Move UI code behind a PresubmitEvents interface aec957d:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/399395 pw_presubmit: Check for either `bazel run` or `bazel test` 75db3d3:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/399052 workflows.json: Split "host" (2/2) 599c42f:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/399394 pw_kernel: Enable userspace build by default c3ece5a:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/396932 bazel: Add license to root BUILD.bazel 6e8a3c3:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/397336 pw_protobuf: Fix strict aliasing for enums and int32_t 760967a:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/399352 pw_chrono: Add pw_numeric to Android.bp 227214a:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/398914 workflows.json: Split "host" (1/2) 1fdaa85:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/399053 Revert "pw_kernel: Enable userspace build by default" 8e7c7e4:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/398572 pw_bluetooth_proxy: Use cmd complete for Android vendor cmd errors 55b0ca5:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/398952 pw_presubmit: Remove unused functions from presubmit.py 6b8a191:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/398912 pw_kernel: Enable userspace build by default 60e7e2d:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/398773 pw_presubmit: Apply formatting after clang roll 0d298f2:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/393557 pw_kernel: Add process termination stress test 3c6bc69:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/393874 pw_kernel: Add process restart to process_termination test bc849bf:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/393873 pw_kernel: Consistantly check for thread termination in interrupts 6eee154:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/398913 pw_async2: Allow Select to hold void futures 92653ce:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/393872 pw_kernel: Properly reset process/thread object state on restart cab992b:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/393555 pw_kernel: Add system dump on failure and clean up boot logging 0988911:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/393554 pw_kernel: Add #[interrupt] macro and update handler signature e27a9f8:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/398832 roll: toolchain-integration 7dc9109:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/373554 pw_i2c_mcuxpresso: Use hardware TIMEOUT registers for deadlines 712b56b:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/398752 pw_kernel: Fix clock test manifests b383300:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/397992 CMake: Skip nanopb targets if nanopb is unavailable b22084e:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/396832 pw_kernel: Move ram_size config from app to process 4387de7:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/398472 pw_protobuf: Add status.proto support on Android b9d9d2b:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/396272 pw_kernel: Decouple codegen app and process handling f3fe0d8:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/398392 Revert "pw_bluetooth_sapphire: Configurable LE advertising and scan parameters" 498ec27:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/377736 pw_kernel: Add support for getting time from userspace f6eccd5:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/395875 pw_kernel: Add manifest validation to the system generator e1d17d0:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/397972 workflows.json: Split up "default" e2f9440:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/389792 pw_containers: Add deque / queue overwrite support 1806063:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/386532 pw_containers: Add size reports for DynamicHashMap & std::unordered_map 5e715d0:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/398013 pw_build: Allow groups to include groups 9b7272c:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/397753 pw_bluetooth: Allow zero sniff offload parameters a8d14b1:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/395832 roll: toolchain-integration fa24fca:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/389273 pw_bluetooth_sapphire: Configurable LE advertising and scan parameters 68d11dd:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/397752 pw_bluetooth_proxy: Use CommandComplete for SniffSubrating 281a164:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/386552 pw_containers: Add size reports for DynamicMap & std::map ab5884a:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/392732 pw_bluetooth_sapphire: Apply code cleanups to LowEnergyConnectionManager 3b4ff91:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/388415 pw_ide: Add more tests for compile commands 4d71425:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/397433 pw_bluetooth_sapphire: Increase pw::StringBuffer size 01301cc:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/395933 pw_work_queue: Correctly set min_queue_remaining_ bd6d9b3:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/381034 pw_allocator: Refactor BucketAllocator 361db13:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/397312 roll: go Rolled-Repo: https://pigweed.googlesource.com/pigweed/pigweed Rolled-Commits: c1dd5106fde1f9..cd7eb5eb29ae07 Roll-Count: 1 Roller-URL: https://cr-buildbucket.appspot.com/build/8684045824087861681 GitWatcher: ignore CQ-Do-Not-Cancel-Tryjobs: true Change-Id: Ie215e8c1f3ec161d747f1532d5cd6b80c0785054 Reviewed-on: https://pigweed-review.googlesource.com/c/open-dice/+/400113
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.