roll: third_party/pigweed/src 449c1c7..ecf027d (54 commits)

ecf027d:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/339755 pw_async2: Refactor channel management
bd5e1ca:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/340112 pw_allocator: Support deleting from derived pointers with virtual dtors
9d0be0a:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/340052 Revert "pw_bluetooth_proxy: Don't register channels for unknown connections"
45437e9:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/339313 third_party/mbedtls: Remove unneeded config_default.h symlink
7310bc5:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/336154 roll: toolchain
73305f2:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/339754 pw_kernel: Fix clippy lints with new rust compiler
1f925e2:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/339132 pw_trace_tokenized: Make transfer handler faster
61792ff:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/328972 pw_multibuf: Update IFTTT lint comments
f5d0797:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/339733 pw_async2: Fix allocation of dynamic channel
76c8809:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/337312 pw_async2: Channel documentation
3cee297:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/337197 pw_async2: ReserveSend API
758155d:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/339752 pw_rpc: Remove unnecessary <ranges> include and std::vector use
d3eaeb2:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/339114 pw_trace_tokenized: Use InlineVarLenEntryQueue for trace buffer
1ca5537:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/338892 boostrap.sh: Check if in git project before running git command
7ba1703:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/337272 pw_env_setup: Upgrade black to 24.10.0
2e8738c:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/315092 pw_tokenizer: Data driven detokenizer test for Python and C++
30d9b4a:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/330473 pw_build: Update pw_build.generated_tests
4db0933:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/339472 pw_i2c_mcuxpresso: Remove transfer error message
39729c6:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/339152 pw_console: Fix Python 3.13 issue from patching time.time()
0deb8fc:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/339036 pw_build: Add CRC32 checksum to cc_blob_library
7d26c70:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/337553 pw_async2: Prevent races in channel
182a101:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/339113 pw_trace_tokenized: Improve TraceBufferReader's partial reads
3a949c5:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/339312 third_party/mbedtls: Symlink removed file for backwards compatibility
6d02518:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/338775 pw_string: Docs improvements
5ebb2b4:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/336813 pw_async2: Support static and dynamic channels
835e78f:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/339392 pw_kernel: Fix target_codegen for downstream use
e82c557:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/336162 pw_kernel: Reload the PMP upon entry/exit of kernel
1d0c07f:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/337792 pw_bluetooth_proxy: Don't register channels for unknown connections
7a1ea2e:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/338656 pw_kernel: Make target_linker_script use config directly
71bff24:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/338633 pw_kernel: Change target_codegen to be a rust_library rather than src
67a1e06:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/339112 pw_trace_tokenized: Clean up build files
5282cf3:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/336161 pw_kernel: Move memory region abstration into its own crate
d0c3443:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/338599 pw_kernel: Fix `app_package` for downstream repos
7776f6f:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/338556 pw_trace_tokenized: Add transfer_handler tests
968ae1b:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/337352 third_party/crates_io: Make Pigweed's crates hub work out of the box
0b0932a:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/338152 pw_module: Fix create script metadata path
f260753:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/334712 pw_digital_io_zephyr: Refactor interrupt handling
3f30afb:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/338943 pw_web: Ignore Uint8Array<ArrayBufferLike> assignment error
2b4d6d0:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/338974 pw_presubmit: Allow internal namespaces under pw_*
13901b5:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/334735 pw_snapshot: Display metrics in processor
f9dad19:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/338752 pw_snapshot: Add tokenized log message to processor_test
129b3e6:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/338598 pw_kernel: Fix `channel_transact` parameters
4edac8b:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/338013 pw_bluetooth_sapphire: Support tracking scan type in FakeController
55f0ea9:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/338012 pw_bluetooth_sapphire: Test if adapter selects the correct advertiser
cd1320a:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/338773 pw_grpc: Return Unimplemented by default
2bc32d0:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/337552 pw_containers: Rework FixedDeque to support owned or unowned storage
d89db65:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/338681 Revert "pw_async2: Add websocket upgrade support to the codelab"
d901ac7:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/338597 pw_containers: Adds IntrusiveForwardListItem
fb8325f:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/338654 pw_work_queue: Add Android.bp
9f6d175:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/328194 pw_async2: Add websocket upgrade support to the codelab
cc91dbf:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/311353 pw_crypto: Update MbedTLS build with BCR version
f40abea:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/328193 pw_async2: Serve the webui from the codelab
ea90565:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/338592 Revert "pw_trace_tokenized: Use InlineVarLenEntryQueue for trace buffer"
c679abd:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/337572 pw_thread_zephyr: Resolve incomplete definition error

Rolled-Repo: https://pigweed.googlesource.com/pigweed/pigweed
Rolled-Commits: 449c1c74950083..ecf027d02d7347
Roll-Count: 1
Roller-URL: https://cr-buildbucket.appspot.com/build/8699266123114122529
GitWatcher: ignore
CQ-Do-Not-Cancel-Tryjobs: true
Change-Id: I826b2e78610208e47bfec1d9bb0ad67d75f2f5f0
Reviewed-on: https://pigweed-review.googlesource.com/c/open-dice/+/340472
Lint: Lint 🤖 <[email protected]>
Bot-Commit: Pigweed Roller <[email protected]>
Commit-Queue: Pigweed Roller <[email protected]>
1 file changed
tree: d37c53da9103e1b659cf41bc390d186ae4565f38
  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.