roll: third_party/pigweed/src 4cdf74f..fba14dc (55 commits)

fba14dc:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/465705 roll: gn
e55b672:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/465505 roll: luci
8fe6407:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/465445 roll: fuchsia-infra-bazel-rules 57bd03e..fefa9ba (4 commits)
70aae18:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/465346 roll: rust-analyzer
a193600:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/462725 bazel: Update rules_python from 1.8.5 to 1.9.1
c46fb08:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/464125 pw_kernel: Format syscall_user assembly veneers
0530187:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/464765 pw_buf: Clarify ConstBuf role and update conversions
deb713a:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/463725 pw_env_setup: Fix pigweed.json resolution under Bzlmod
65db43a:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/463985 pw_buf: Set package visibility in examples BUILD
d52d1bd:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/463846 pw_buf: Expose the base() pointer in pw::Buf
b9f6b1b:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/463605 pw_web: Update package-lock.json dependencies
dc61f63:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/462985 agents: Add oncall skill with CIPD roll subskill
761fea0:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/463706 pw_bluetooth_sapphire: Remove unused kUuids variable
a1aa0c5:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/459045 pw_bluetooth_proxy: Add silent channel creation to Acquire APIs
42f94ef:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/459466 pw_web/log-viewer: Fix LogSource import path and handle missing Shoelace
d0868da:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/462125 pw_memory, pw_async2: Handle nullptr in ContainerOf
d813d3a:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/463005 pw_env_setup: Roll cipd
497eac9:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/462965 pw_ide: Separate bazel_args and rust_check_args in compilation generator
b5252cb:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/455905 pw_kernel: Add build-only veer target
7a6742a:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/458826 third_party/boringssl: Remove CMake support
51cbaa4:https://pigweed.googlesource.com/pigweed/pigweed/+/51cbaa48ad880bb0b348b113b93666e4d858cae2 cmake: Disable sandbox for targets with generated sources
06b82ef:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/463065 pw_build: Isolate workflows launcher into sub-workspace
8b196f5:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/457426 pw_bluetooth_proxy: Add CommandMultiplexer snapshot recovery
aab9354:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/454647 pw_bluetooth_proxy: Unify ACL and L2CAP recovery APIs
64ff6e6:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/453772 pw_bluetooth_proxy: Add ACL connection removal state update
4d1833a:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/450133 pw_bluetooth_proxy: Add Sniff hardware resynchronization
b1aaeb3:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/450132 pw_bluetooth_proxy: Implement per-connection Sniff snapshot recovery
3bd5a4c:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/449412 pw_bluetooth_proxy: Add global Sniff subsystem snapshot recovery
c2353d5:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/449032 pw_bluetooth_proxy: Add L2CAP state mutation update support
2523522:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/448192 pw_bluetooth_proxy: Add L2CAP channel recovery rejection support
0222dae:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/463025 pw_bluetooth_proxy: Pass sniff state update callback in constructor
20898d8:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/458185 pw_snapshot: Add core_name field to Metadata proto
11fccc9:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/457445 pw_buf: Add module
4e39a60:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/447415 pw_bluetooth_proxy: Add per-connection Sniff snapshots & state updates
5142754:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/451112 pw_ide: Update C++ code intelligence doc link
6cb7c45:https://pigweed.googlesource.com/pigweed/pigweed/+/6cb7c45a2d304817d6248675031ff47311f3f1ea agents: Add pw_async2 skill
7023a4b:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/461945 pw_bluetooth: Add EventPayload struct to BT emboss
8cb19ef:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/461085 pw_ide: Add Kythe kzip generation module
1435aa7:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/461485 pw_clock_tree_mcuxpresso: Set divider to 0 on disable
c3bb851:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/451832 pw_log_zephyr: Add support for LOG_HEXDUMP_*
d6220b5:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/461225 pw_bluetooth_proxy: Harden state update callback lifetimes
adaa451:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/459827 crates_io: Update object to 0.40.0
b50aeeb:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/461106 crates_io: Update cortex-m-semihosting to 0.6.0
d5fef7a:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/459828 crates_io: Update syn to 3.0.3
7666f7d:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/459826 crates_io: Update nom to 8.0.0
769b8bb:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/459825 crates_io: Update nix to 0.31.3
d48c1f5:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/459745 crates_io: Freshen crate versions
8492819:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/459545 crates_io: Remove unused crates
0911625:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/459485 crates_io: Sync toml file with lockfile
dcffc3b:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/455665 pw_kernel: Remove golden file verification from tracing tests
473df42:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/460685 roll: go
f5291dd:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/447232 pw_bluetooth_proxy: Sweep abandoned L2CAP channels
dfd3ded:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/442053 pw_bluetooth_proxy: Implement L2CAP recovery
d7bfdaf:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/442052 pw_bluetooth_proxy: Wire L2CAP snapshot APIs
e00b4cc:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/444553 pw_bluetooth_proxy: Add global Sniff recovery snapshot support

Rolled-Repo: https://pigweed.googlesource.com/pigweed/pigweed
Rolled-Commits: 4cdf74f6d5aac7..fba14dcfb55265
Roll-Count: 1
Roller-URL: https://cr-buildbucket.appspot.com/build/8671996437448120193
GitWatcher: ignore
CQ-Do-Not-Cancel-Tryjobs: true
Change-Id: Id2da56d6efe6a63b11efc0d89713ae6549fc9a04
Reviewed-on: https://pigweed-review.googlesource.com/c/open-dice/+/465865
1 file changed
tree: dc1a47e873204cf740617f7b6c42d1e066a4c68e
  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.