[third_party/pigweed/src] Roll 68 commits

f4d0b3563c09d94 roll: host_tools
dddcf1136a6dcfc roll: gn
8ae32795107eb43 roll: absolute_uploader
62578b6cafa5c30 roll: incremental_uploader
25298587ecf571e SEED-0108: Claim SEED number
f9a61ef49e9ffa9 pw_containers: Improve FlatMap doc example
137ed20b3599180 pw_tokenizer: Update tagline, restore missing info
522841069ef9ace pw_presubmit: Add Rust docs to docs site
e74b4d0b4e9ac8c pw_async_basic: Remove debug logging
1ebae570a259744 pw_digital_io: Doxygenify Enable() and Disable()
d67fa5ede854ea3 pw_sys_io: Add android to alias as host system
20e20c218d14cfa pw_system: Update IPython init API
64526a833c4b918 docs: pigweed.dev feature grid
d613643060f27c1 pw_fuzzer: Update fuzzers to use Pigweed domains
0fc84fd8c982fb3 pw_build: Avoid extra newlines for docs in generat
157ea64e8d8813a pw_build: pip install GN args
a712de7e0273c99 pw_unit_test: Update metadata test type for unit t
5ea607ffef8f3e6 pw_sync: Add lock traits
d6cad3cf1776a31 pw_ring_buffer: Conversion warning cleanups
2157b49553b7aac docs: Mention SEED-0102 in module_structure.rst
30381584bf789eb pw_tokenizer: Migrate the proto docs (SEED-0102)
43dfeb82765d48c pw_rust: Add combined Rust doc support
cd1bc6cfd4146c3 pw_env_setup: Upgrade Python cryptography to 41.0.
f481e6455177b14 pw_env_setup: Upgrade ipython to 8.12.2
db10e1a0ef57f8e pw_toolchain: Support conditionally creating mapfi
f1ee73c16ce39b9 pw_env_setup: Upgrade PyYAML to 6.0.1
a4fd44bd4568de9 pw_hdlc: Add target to Bazel build
a43abffec2d1eaa pw_watch: Trigger build only on file modifications
e333641e8ccc3aa pw_stream: Add read_exact() an write_all() to Rust
07a458360607d2e pw_build: pw_python_venv generate_hashes option
fee64ced624d035 pw_tokenizer: Remove stub sections and add guides
80fde591d803dd5 pw_rpc: Provide way to populate response callbacks
de9cf6040d4748f pw_status: Add Clone and Copy to Rust `Error` enum
c29f7e48112d66f third_party: Remove now unused rules_proto_grpc
926891a85b2bd33 pw_protobuf_compiler: Disable legacy namespace
4c3bd7683d0f5b5 pw_protobuf_compiler: Transition to our own proto
0cecbe0263d5e46 docs: Remove outdated Homebrew info in getting_sta
c756b10e7477d52 targets/rp2040_pw_system: Fix references to STM32
634b5e1c561cd93 pw_stream: Clean up rustdoc warnings
8481017cd5104f8 pw_tokenizer: Migrate the custom macro example (SE
cb88bf3791ecf7c pw_package: Handle windows Zephyr SDK setup
9f7c583ea74e7b9 SEED-0107: Claim SEED number
a86a3ece5c7991c pw_env_setup: Add Python constraints with hashes
ed4a2a52130ba58 pw_web: Update theme token values and usage
11f94356ad6f28c pw_async: Fill in bazel build rules
60012df2b9051d6 zephyr: Add project name to unit test root
4cb8e20663f29e6 pw_web: Add disconnect() method to WebSerialTransp
710c74a28e98257 zephyr: Add pigweed root as module
c6ca138b583b401 pw_ide: Support multiple comp DB search paths
b3c696eae268a2c pw_containers: Update FlatMap doc example so it co
376018c32f5f57b docs: Fix "gn args" examples which reference pw_en
fa54fc66949487c pw_env_setup: Bump pip and pip-tools
bf017dec0fbf1a9 pw_tokenizer: Migrate the Base64 docs (SEED-0102)
b520a4d0ea798e9 pw_trace_tokenized: Replace singletons with depend
c2b54056a2772ea zephyr: Fix setup.sh call
b08a8ad097d5d48 pw_stream: Add Rust varint reading and writing sup
1ea4e1ecdbba8a7 pw_varint: Update Rust API to return number of byt
05d4532e72b5d42 pw_package: Run Zephyr SDK setup.sh after syncing
c3cf6fdf6805149 pw_stream: Refactor Rust cursor to reduce monomorp
0454e7cd19419c7 pw_stream: Add Rust integer reading support
52ffa6bc27ca274 pw_stream: Move Rust Cursor to it's own sub-module
35caee12f9a7906 pw_rust: Update @rust_crates sha
29a2140fcebf8b0 pw_web: Add docs section for log viewer component
9deeaa745e2ff42 pw_rpc: Add Soong rule for pwpb echo service
47ab4a849aced3c pw_rpc_transport: Add more Soong rules
17684877853edeb docs: Consolidate contributing docs in site nav
2c3d12c8ac0dac9 pw_tokenizer: Migrate token collision docs (SEED-0
60aae298d04f430 pw_digital_io: Add digital_io rpc service

https://pigweed.googlesource.com/pigweed/pigweed
third_party/pigweed/src Rolled-Commits: 24432905b8f8de6..f4d0b3563c09d94
Roller-URL: https://ci.chromium.org/b/8774733395657368801
GitWatcher: ignore
CQ-Do-Not-Cancel-Tryjobs: true
Change-Id: I2baf8151206dd921046f322b8277cea46445862a
Reviewed-on: https://pigweed-review.googlesource.com/c/open-dice/+/157624
Bot-Commit: Pigweed Roller <pigweed-roller@pigweed-service-accounts.iam.gserviceaccount.com>
Commit-Queue: Pigweed Roller <pigweed-roller@pigweed-service-accounts.iam.gserviceaccount.com>
1 file changed
tree: fcf8d64ded9c89b2824694275261dee2795b1dd4
  1. build_overrides/
  2. docs/
  3. images/
  4. include/
  5. src/
  6. third_party/
  7. toolchains/
  8. tools/
  9. .clang-format
  10. .gitignore
  11. .gitmodules
  12. .gn
  13. banner.txt
  14. bootstrap.sh
  15. BUILD.gn
  16. BUILDCONFIG.gn
  17. generate_test_values.py
  18. LICENSE
  19. navbar.md
  20. OWNERS
  21. pigweed.json
  22. pyproject.toml
  23. README.md
  24. run_fuzzer.sh
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 bootstrap script will automatically initialize all submodules.

Building and Running Tests

$ source bootstrap.sh
$ 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.

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.