roll: third_party/pigweed/src 4bf11f1..7680a4e (85 commits)

7680a4e:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/207894 pw_bluetooth: Remove now unnecessary aliases from hci_common.emb
1e7b1e9:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/256352 roll: fuchsia-infra-bazel-rules 5c63ca8..a6893c6 (50 commits)
4f536c6:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/242214 pw_thread: Thread priority class
03acee9:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/256213 pw_bluetooth_proxy: Lookup l2cap channel by remote cid from host
34224ad:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/256086 pw_bluetooth_proxy: Standardize on local/remote for l2cap cid names
8b1d112:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/256052 pw_bluetooth_sapphire: Do not scan during LE connection procedure
2c90975:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/256115 bazel: Get Java proto library rules from protobuf
01eb800:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/256212 bazel: Fail tests on sanitizer findings
eca19a7:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/256093 pw_build: Update uses of $(location :foo)
e144241:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/256113 pw_unit_test: Make PW_TEST_EXPECT_OK compatible with PW_CONSTEXPR_TEST
2797f74:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/254135 bazel: Load proto_library, ProtoInfo from protobuf
a3011fb:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/256198 pw_unit_test: Rename macro to avoid checks that prevent submission
37845ac:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/256114 pw_bluetooth_proxy: Fix ubsan finding in L2capCoc
d69cd4a:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/255970 pw_bluetooth_proxy: Fix wrong cid lookup on l2cap disconnect
982b225:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/256172 pw_bluetooth_sapphire: Don't lose pairing delegate during connection
983119e:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/255968 pw_bluetooth_proxy: Remove incorrect field comment
49ca810:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/256132 pw_bluetooth: Define Poll/Final variants in RfcommFrameType enum
330670b:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/256152 pw_bluetooth_proxy: Initialize arrays
d78f076:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/255964 pw_tokenizer: Fix undefined return values in TS
5356fe8:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/253515 pw_thread: Remove unnecessary thread_core.h include and dep
17c85f7:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/255963 pw_hdlc: Remove/rename PW_RPC_MAX_PACKET_SIZE
c13d91e:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/242213 pw_unit_test: Test framework for constexpr unit tests
d965f34:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/182900 pw_bluetooth_sapphire: Use size calculation for reports_size in Emboss
d6827c1:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/253172 pw_numeric: Add checked_arithmetic.h
999adb1:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/250434 pw_containers: Add explicit constexpr constructors for deques/queues
cf93680:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/255813 pw_bluetooth_sapphire: Fix buffer overflow in advertising data
9e9628d:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/255812 pw_bluetooth_sapphire: Add missing macos selection for l2cap
0f0b4a8:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/255792 pw_bluetooth_sapphire: Add legacy pairing test
a198d71:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/255892 pw_multibuf: IWYU mutex in allocator_async.cc
def1dea:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/254772 pw_bluetooth_proxy: L2capCocWrite::Write that accepts multibufs
2db41fe:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/253432 pw_bluetooth: Implement rx packet reassembly
89395f2:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/255712 pw_ide: Decouple VS Code logger from pure logic
ef5c858:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/254532 pw_bluetooth_sapphire: Generate fragmented SDUs
caf0021:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/253752 pw_bluetooth_sapphire: Add more options to ISO test packet generation
9fff267:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/254953 pw_thread_stl: Remove unnecessary include
8f3c17f:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/255554 pw_ide: Modularize clangd TS modules
8269056:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/254673 pw_bluetooth_proxy: Use LE_ACL_Data_Packet_Length
48dfcf5:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/251892 pw_tokenizer: Fix CSV database parsing in TS
935559e:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/254554 pw_bluetooth_proxy: L2capCoc reassembly
090c437:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/255063 pw_build: Remove and refactor //pw_build/platforms
8ebf76d:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/255294 pw_bluetooth_proxy: Move L2capCoc tests to separate file
e1736b9:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/254432 pw_toolchain: Transition flag to update rules_cc
3e5208e:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/254476 zephyr: Update to support 4.0
d7fcaef:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/255392 pw_rust: Allow override proc_macro toolchain
8fddf43:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/188727 pw_bluetooth: Correct some Emboss fields names
5db08a5:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/201989 pw_bluetooth: Convert LEAdvertisingEventProperties into a struct
c8d7bb1:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/182901 pw_bluetooth: Update all commands and events to the correct address type
c57a73b:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/254612 pw_bluetooth_proxy: L2capCoc takes client-provided multibuf allocator
dfdcdb9:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/255061 pw_protobuf: Support file-level presence option
42962f4:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/254413 docs: Bazel integration: bzlmod, Bazel versions
c79f042:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/254475 pw_bluetooth_sapphire: Fix Host::Pair dual mode behavior
54a7d97:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/255013 pw_build: Correct pw_python_distribution file overwrite logic
5da1b33:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/255017 pw_bluetooth_proxy: Finish event_fn migration
2181498:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/254955 pw_bluetooth_proxy: Add ability for BasicL2capChannel to forward to host
de5cccc:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/255293 docs: Remove obsolete TODOs
0638a77:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/255112 bazel: Remove rules_python override
9f70d95:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/254021 pw_bluetooth_sapphire: Implement Central scan stopping
ee6f997:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/254952 pw_build: Add pw_rust_crates_extension
ac4e444:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/255019 pw_multibuf: Add move tests for alloc future
81652cf:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/255059 pw_multibuf: Fix alloc future desired_size()
66ac324:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/255018 pw_multibuf: Android.bp for multibuf allocator
2b84a1d:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/255016 pw_multibuf: Split async alloc out into its own target
b439dd3:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/255015 pw_multibuf: Move async to new MultiBufAllocatorAsync
aaaac0a:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/255014 pw_multibuf: Introduce supertype for alloc futures
2d063e1:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/254828 pw_multibuf: Move mem notify functionality inside alloc future
0a85225:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/254827 pw_multibuf: Remove unneeded PW_NO_LOCK_SAFETY_ANALYSIS
a2459e9:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/255012 pw_kvs: Initialize memory for span in test
21d015f:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/255172 pw_bluetooth_proxy: Update TODOs for ACL fragmentation
e165669:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/253072 pw_rpc_transport: Introduce PacketQueued/Processed for LocalRpcEgress
1b13258:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/254975 pw_bluetooth_proxy: Remove 'queue_space_available_fn' in favor of event
9337002:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/254954 pw_presubmit: Only run no_includes check when Bazel files are involved
9ef342d:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/254934 pw_{hex_dump, kvs, ring_buffer, string}: rm UB
0a0160e:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/254553 pw_build: Use plain action name variables
d08f106:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/254052 pw_bluetooth_sapphire: Update Fuchsia SDK API level to 25
c88d23a:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/254976 pw_i2c: Add amarkov to OWNERS
99290f8:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/254632 docs: Fix literalinclude in the Bazel build
b8d3b57:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/254519 pw_bluetooth_proxy: Rename to l2cap_channel_common.h
8c376c4:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/254693 pw_bluetooth_proxy: Move BuildL2capCoc functions to test fixture
9f042fe:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/254692 pw_bluetooth_proxy: Move to using test fixtures
4f14d74:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/252314 pw_toolchain_bazel: Move CPU constraints
f909776:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/247192 docs: Build Doxygen docs with Bazel
13446e5:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/254474 pw_toolchain: Add Cortex M3 support
f3fb838:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/254833 pw_bluetooth_sapphire: Revert removal of LowEnergyDiscoverySession::Stop
2081503:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/254412 bazel: Add targets to Fuchsia compile commands
509d006:https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/254832 docs: Fix target name

Rolled-Repo: https://pigweed.googlesource.com/pigweed/pigweed
Rolled-Commits: 4bf11f142443b7..7680a4e143633b
Roll-Count: 1
Roller-URL: https://cr-buildbucket.appspot.com/build/8727804168464423777
GitWatcher: ignore
CQ-Do-Not-Cancel-Tryjobs: true
Change-Id: I9fe29b0ef8a0c31b20fde720b46eb9473676f0da
Reviewed-on: https://pigweed-review.googlesource.com/c/open-dice/+/256374
Bot-Commit: Pigweed Roller <pigweed-roller@pigweed-service-accounts.iam.gserviceaccount.com>
Commit-Queue: Pigweed Roller <pigweed-roller@pigweed-service-accounts.iam.gserviceaccount.com>
Lint: Lint 🤖 <android-build-ayeaye@system.gserviceaccount.com>
1 file changed
tree: 2078e95840c3243b950c233c2f9e113f15ccd71d
  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
$ 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.