roll: third_party/pigweed/src df58c74..da751aa (84 commits) da751aa:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/494073 roll: gn 56543fa:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/493833 roll: luci 2d6719b:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/493713 roll: rust-analyzer a5c9e66:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/477645 pw_status: Introduce StatusBase and rework Status 1e94d08:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/492552 pw_kernel: Add AtomicOne trait de2d1e0:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/492551 pw_assert: Expand disabled Rust debug_* macros to if false blocks 0c4e99d:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/488289 pw_kernel: Initialize ARMv8-M MSPLIM and PSPLIM registers in early_init 56ca06b:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/490931 pw_ghish: Add multi-repo git, issue, and wt flows 3816264:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/489489 docs: Fix pw_kernel rustdoc build 3c3f0cc:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/482667 pw_bluetooth_sapphire: Stop scan in destructor, allow window == interval 346c561:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/482665 pw_bluetooth_sapphire: Copy tx_power_ in LowEnergyScanResult::operator= 4388546:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/482663 pw_bluetooth_sapphire: Guard batch scan reads with WeakPtr 6ba1b48:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/482662 pw_bluetooth_sapphire: Set ApcfAction::ADD explicitly in APCF builders ac6ac56:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/482658 pw_bluetooth_sapphire: Validate APCF local name length before offloading 24c267c:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/492091 pw_bluetooth_sapphire: Add DestroyingServerClosesUnderlyingStream test 7a65abc:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/491971 pw_enum: Fix PwEnumToString detection on GCC 10 d3e6fc1:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/483829 pw_kernel: Harden disable_interrupts_atomic f56d4b2:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/490911 pw_ghish: Add declarative config and dynamic Gerrit gates d12a98f:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/491511 pw_bluetooth_sapphire: Fix UAF in IsoStreamImpl::OnCisEstablished e99adc5:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/483691 pw_kernel: Add CLINT IPI helpers 5767574:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/484391 pw_rpc2: Add C++ server and related code 68ebbec:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/491691 agents: Add Saleae skill 51e8dd2:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/491131 pw_log_zephyr: Panic on PW_LOG_LEVEL_FATAL 80baa1e:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/490851 pw_ghish: Support cross-project hosts and URLs a9e370f:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/482661 pw_bluetooth_sapphire: Remove dead declarations and open_slots_ in APCF 4e39cf8:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/482660 pw_bluetooth_sapphire: Fix error and pause handling in StartScan a79c9ab:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/482659 pw_bluetooth_sapphire: Prevent uint8_t overflow in APCF slot counting 0f5c008:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/479005 pw_bluetooth_sapphire: Clean up batch scanning logs eecd223:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/477294 pw_bluetooth_sapphire: Reduce verbosity of logs in advertising packet filter 2a932cc:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/490175 pw_bluetooth_sapphire: Use SplitMix64 for DeviceAddress hashing bc46325:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/486309 pw_bluetooth_sapphire: Remove redundant this capture in GATT Client 1cd3689:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/490176 pw_bluetooth_sapphire: Guard closed bearer in Bearer::ReplyWithError cbf1831:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/490174 pw_bluetooth_sapphire: Guard null callback in AcknowledgeRead 427f22a:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/491411 pw_tokenizer: Avoid endian.h in tokenize.h 3dd1f47:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/491333 docs: Restore source code link in header a4c51ff:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/455247 pw_format: Clean up documentation 1292a28:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/490173 pw_bluetooth_sapphire: Cap pending BR/EDR Remote_Name_Request commands 3dca9ae:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/485429 pw_kernel: Clean up InterruptGuard memory ordering a3dd2e0:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/486329 docs: Update pw_rust_docs.bzl to accept rust_doc targets bdca3b6:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/478805 pw_tokenizer: Add C++ and Rust detokenize performance tests 586256d:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/491371 docs: Fix external link cards b652bd2:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/489490 pw_async2: Add time_provider.cc to pw_async2 Android.bp 55c8d25:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/489649 pw_ghish: Include builds from equivalent earlier patchsets 2e7bb9a:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/490172 pw_bluetooth_sapphire: Disconnect non-SSP peer without legacy pairing df38b55:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/479085 docs: Update and expand toolchain documentation 91bc8ab:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/427212 pw_tokenizer: Avoid <string_view> in headers d453aad:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/490391 pw_bluetooth: Add CommandPacket emboss definition 3ada25a:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/381043 pw_allocator: Make buckets iterable 578e9b0:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/381042 pw_allocator: Add OriginAllocator 1568e48:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/488970 pw_async2: Delete CoroOrElseTask 288d450:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/490531 pw_time: Drop board_deps from Zephyr Rust helper d0d713b:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/483329 pw_async2: Update CoroTask and FallibleCoroTask as FutureTask aliases 1e59ffb:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/489790 pw_ghish: Add first-class draft comment support 65e01a7:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/489849 pw_ghish: Add Change-Id retention and stack push guards 351c34a:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/488949 pw_ghish: Tighten docs and CLI comparison df7bdbe:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/488409 pw_ghish: Add gh hook subcommand for agent and Git hooks 8cbe2be:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/490232 pw_enum: Move ToString to EnumTraits and add has_enum_to_string_v c8fe560:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/490179 pw_async2: Use PW_NO_INLINE to prevent coroutine stack allocation 8564288:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/489209 pw_rpc2: Add why doc and RPC1 vs RPC2 comparison fba6e89:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/490211 pw_async2: Fix value_type of TimeoutOrClosed(SendFuture<T>) f7e1f53:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/465205 pw_build: Streamline host workflow group by removing duplicate docs dd53b95:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/480066 pw_allocator_zephyr: Fix Zephyr build dependencies and avoid libc malloc/free 39aac07:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/381041 pw_allocator: Add TaggingAllocator 5ab1a3a:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/485509 pw_ghish: Update AI agent rules, skills, and integration docs 6b65912:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/381040 pw_allocator: Refactor GuardedAllocator to use FramingAllocator 93ef09e:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/488969 pw_async2: Support default construction and assignment in FutureTask 3b5529e:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/488549 pw_ghish: Add gh auth status and googler/community auth modes adc516f:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/489169 pw_hil: Add initial pw_hil module e3fe82d:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/486149 pw_kernel: Decouple ClintConfigInterface from being just a timer bda8c2d:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/486129 pw_async2: Fallible Coro<> support via Coro::MakeFallible 5fcecf5:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/488709 pw_hal: Add initial pw_hal module 9ce0fc6:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/487453 pw_bluetooth_sapphire: Reject oversized codec configs e6a63b7:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/484390 pw_rpc2: Add method metadata and update payload serialization 13fe924:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/479685 pw_presubmit: Clean up deprecated git_repo calls ee6e345:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/486190 pw_protobuf: Support encoding to exact-fit buffers db45da2:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/488329 pw_toolchain: Expose all_tools alias in host_clang 29975bd:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/487452 pw_bluetooth_sapphire: Fix uninitialized trace_id_ variables b967219:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/487451 pw_bluetooth_sapphire: Check address type in LE connection matching f68d7c1:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/487450 pw_bluetooth_sapphire: Don't assert on short events in CommandChannel fdc6eed:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/487449 pw_bluetooth_sapphire: Fix PDU records calculation f9f00d5:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/488330 pw_time: Read Zephyr tick rate from Kconfig in Rust backend 076009a:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/479605 pw_build: Define kernel_device_mac workflow group 519bfbd:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/486130 docs: Fix public_overrides module structure 4d1288e:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/488089 roll: buildifier Rolled-Repo: https://pigweed.googlesource.com/pigweed/pigweed Rolled-Commits: df58c746c940e7..da751aaa4421d1 Roll-Count: 1 Roller-URL: https://cr-buildbucket.appspot.com/build/8668825542535960529 GitWatcher: ignore CQ-Do-Not-Cancel-Tryjobs: true Change-Id: Ibdeb27511af4843d4da2024e7457e50cfcfb9ac3 Reviewed-on: https://pigweed-review.googlesource.com/c/open-dice/+/494174
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.