roll: third_party/pigweed/src cd7eb5e..9927c81 (54 commits)

9927c81:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/403212 roll: luci
380c364:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/403132 roll: fuchsia-infra-bazel-rules, MODULE.bazel.lock
ebb41d0:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/403033 roll: rust-analyzer
1dcbcf8:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/402972 roll: cmake
dc2b034:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/386992 pw_chre: Update backend to support latest CHRE version
2c54393:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/399292 docs: Update code analysis target names
5c525a3:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/402652 zephyr: Add type and default to Kconfig value
f333415:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/401072 pw_async_basic: Make buildable in Android
4a53e75:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/401614 pw_kernel: Work around init order flake in process_termination test
336d0ca:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/402372 pw_allocator: Add unit tests for FallbackAllocator::DoGetInfo
67563b4:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/401974 pw_kernel: Allow unprivileged writes to MMIO regions
a992fa2:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/401972 pw_bluetooth_sapphire: Re-enable offloaded advertising packet filtering
261701b:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/398252 pw_containers: Add std::variant support to pw::Hash
32c6eae:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/402092 pw_env_setup: Roll cipd
1e8e584:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/401613 pw_kernel: Add sleep_until to userpace library
fef29bb:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/401612 pw_kernel: Add better error messages to process termination tests
6dce4a9:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/400593 pw_kernel: Rename userspace Clock to SystemClock
e27d98f:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/400592 pw_kernel: Update uses of time in userspace time to be idiomatic
912c1b9:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/402012 pw_env_setup: Conditionally return repo_metadata
abe2ce3:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/401592 pw_kernel: Add //pw_kernel/userspace:no_userspace_support constraint
592c017:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/316015 pw_stream_shmem_mcuxpresso: Remove unused module
987afa4:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/399412 pw_bluetooth_sapphire: HciCommandTimeout config
e43f573:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/401472 pw_symbolizer: Handle EOF when reading llvm-symbolizer output
789ce85:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/400236 pw_toolchain: Introduce Zephyr LLVM Toolchain
c5f145e:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/400235 pw_toolchain: Zephyr SDK v1.0.0 Migration (GCC)
e5dfd3f:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/399512 pw_toolchain: Show compiler in toolchain filepath
b7438df:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/362056 docs: Adds C++ Type Equivalence Classes page
79b25db:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/399313 pw_toolchain: Add m85 variant for zephyr
e81ad16:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/399312 pw_build: Add m85 constraint value
ae30084:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/401234 pw_chre: Add some CHRE team members as OWNERS
61a1600:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/401132 pw_bluetooth_proxy: Fix CMake deps and include
30d116a:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/401032 bazel: Roll versions for Bazel 9 compatibility
83d9b37:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/401292 clang-tidy: Remove a deprecated check
31908d2:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/376072 pw_kernel: Implement object_set_peer_user_signal syscall
9f7355a:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/398632 pw_bluetooth_proxy: Refactor GATT to use DynamicMap
3ae3f71:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/399572 agents: Add reStructuredText (reST) skill
ed7049a:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/400895 pw_bluetooth_sapphire: Revert re-enable offloaded advertising packet fil
c52fcd8:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/397796 CMake: Fix various dependency issues found with sandboxing
f9a5f26:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/400952 pw_snapshot: Build a rust snapshot.proto in Android
5a4dc9c:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/400253 pw_presubmit: Move code to private/ to limit the public API
c95989a:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/280772 pw_bluetooth_sapphire: Migrate size report to bazel & mbedtls
4cd18c7:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/399573 pw_bluetooth_sapphire: Configurable LE advertising and scan parameters
4ccac8a:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/395252 pw_module: Templatize GN and C++
9bcf55f:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/393352 pw_module: Allow default build systems / languages config
84fc32f:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/400153 pw_presubmit: Remove failure_summary_log in favor of ctx.fail
ebd66a2:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/397795 pw_build: Support external sources in CMake sandboxing
360f7be:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/398212 pw_bluetooth_proxy: Handle HCI Reset command in hci module
5a5b2b0:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/398232 pw_bluetooth_proxy: Fix multiplexer stall from intercepted credit events
20b6ca7:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/399576 pw_snapshot: Add MemoryRegion field
9323377:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/397432 pw_module: Fix CLI entrypoint
761fe48:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/399192 pw_presubmit: Clean up and reorganize presubmit core
58363e8:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/396752 pw_env_setup: Setup a new cipd module extension
9d28043:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/400152 targets: Create rp2040_size_report toolchain
01b2426:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/390612 skills: Add skill for creating RPC services

Rolled-Repo: https://pigweed.googlesource.com/pigweed/pigweed
Rolled-Commits: cd7eb5eb29ae07..9927c81cfba3cd
Roll-Count: 1
Roller-URL: https://cr-buildbucket.appspot.com/build/8683411655028105441
GitWatcher: ignore
CQ-Do-Not-Cancel-Tryjobs: true
Change-Id: If7d2f0d6bb3cad06cf4ce0ebb107435bd05bf195
Reviewed-on: https://pigweed-review.googlesource.com/c/open-dice/+/403312
1 file changed
tree: 7da0152084a1a3535017a50b7a9fabd5228bad29
  1. build_overrides/
  2. docs/
  3. dpe-rs/
  4. images/
  5. include/
  6. src/
  7. third_party/
  8. toolchains/
  9. tools/
  10. .clang-format
  11. .gitignore
  12. .gitmodules
  13. .gn
  14. banner.txt
  15. bootstrap.sh
  16. BUILD.gn
  17. BUILDCONFIG.gn
  18. generate_test_values.py
  19. LICENSE
  20. navbar.md
  21. OWNERS
  22. pigweed.json
  23. pyproject.toml
  24. README.md
  25. run_fuzzer.sh
  26. rustfmt.toml
README.md

Open Profile for DICE

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:

  • Separate CDIs for attestation and sealing use cases
  • Categorized inputs, including values related to verified boot
  • Certified UDS values
  • X.509 or CBOR certificates

Mailing List

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.

Specification

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.

Code

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.

Thirdparty Dependencies

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.

Building and Running Tests

Quick setup

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

More details

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.

Porting

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.

Style

The Google C++ Style Guide is used. A .clang-format file is provided for convenience.

Incorporating

To incorporate the code into another project, there are a few options:

  • Copy only the necessary code. For example:

    1. Take the main code as is: include/dice/dice.h, src/dice.c

    2. 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.

Size Reports

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.

Thread Safety

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.

Clearing Sensitive Data

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.

  • The caller of this code is responsible for buffers they own (of course).
  • The ops implementations need to clear any copies they make of sensitive data. Both boringssl and mbedtls attempt to zeroize but this may need additional care to integrate correctly. For example, boringssl skips optimization prevention when OPENSSL_NO_ASM is defined (and it is currently defined).
  • Sensitive data may remain in cache.
  • Sensitive data may have been swapped out.
  • Sensitive data may be included in a crash dump.