commit | e1036b9b41442313b93e0a9cc72550955c03eb4d | [log] [tgz] |
---|---|---|
author | pigweed-roller <pigweed-roller@pigweed-service-accounts.iam.gserviceaccount.com> | Mon May 13 00:44:28 2024 +0000 |
committer | CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> | Mon May 13 00:44:28 2024 +0000 |
tree | 9192459ba45a6e95cac0c69ec0ad942bba545830 | |
parent | c96094aacd4a75b2cbe9b9a8d38b9f8bbb38f86b [diff] |
[third_party/pigweed/src] Roll 51 commits 8fefe0c2a5a34c8 roll: gn f8ccffa43290479 [fuchsia_infra] Roll 15 commits 253204ef5bcda85 roll: cmake 33da8baecc1cd8d roll: bazel eed9f3c4cb733f7 pw_digital_io_linux: Add test_utils.h for ASSERT_O 56f740f4aa97088 pw_digital_io_linux: Minor updates to OwnedFd 4d868e624a68d16 pw_log: Make TODO actionable 47018e2757e4c2c pw_boot_cortex_m: Emit pw_boot_Entry without prolo d533f317b8719a8 pw_presubmit: Add repo tool API f4fef042cd11cb1 pw_toolchain: Add clang-apply-replacements plugin 12fda3bfe435881 pw_rpc: Update docs for channel ID remapping 56b3cbf0ec8010a pw_bluetooth: Add a constant for max controller de cbb3917c36a4f77 emboss: Use absolute paths in source dependencies 0594139badff8c9 pw_ide: Add .pw_ide.user.yaml to .gitignore e6d8fb860af22d8 pw_bluetooth_proxy: Removing trailing comma in PW_ 84853afa7c9be8e pw_bluetooth: Put cmake tests in modules group 5533f4333cf9f54 pw_format: Add Rust support for field width and ze d9e14eb3cfffbe8 pw_i2c_mcuxpresso: Fix Clang compilation bfccb2d8fb8e32f pw_bluetooth_proxy: Allow setting the # of credits 99192e42561f7d0 pw_tokenizer: Clean up rust docs 20da4adc3966443 pw_protobuf_compiler: Disable layering check less 7ef9f7009731d11 [fuchsia_infra] Roll 152 commits ffab718375f979c pw_assert: Ensure condition does not contain stray a3d96bad3957c08 pw_protobuf_compiler: Fix name collisions 1409f882b06e9e5 OWNERS: Add roller as WORKSPACE owner 1b8054b032804a9 pw_presubmit: Exclude all OWNERS from copyright 258066a475ea2cf pw_libcxx: Minimal implementation 188876aa96f12be pw_format: Add Rust support for formatting integer 95093534642cccc pw_bluetooth_proxy: Add cmake build rules 8cdcad7cc37aefa pw_{rpc,trace_tokenized}: Build compatibility fixe a1802f8bb4e2c92 pw_protobuf_compiler: Disable layering_check 4f0b1a7c4cd2ee2 pw_format: Add test for escaped curly brackets 6942dd5c53c11b4 pw_format: Refactor format string parsing for bett 2d4292592c08ffd *: Run clang-format ef655533be05a36 SEED-0116: Set status to On Hold 1dc4b07e46688fe pw_sys_io_stm32cube: Fix build for f1xx family 51bf763e5a99803 pw_stm32cube_build: Fix a label flag name in docum 807b25704367768 bazel: Remove unnecessary .bazelrc flag 55a0e49ae0aae5d pw_build_mcuxpresso: Support multiple cores 4f238babeb357b7 pw_sys_io_stdio: Expand allowed uses beyond host d60a7315d676b9d bazel: Re-enable sandbox_hermetic_tmp 15660a9a2d0102e pw_i2c_mcuxpresso: Add i3c initiator 8dfb6ef0937612f pw_bluetooth: Disable emboss enum traits 8741fcf0a55d5bb pw_i2c_mcuxpresso: Remove swatiwagh from OWNERS 8a4d92baabb5a1a pw_i2c: Update OWNERS 480bffe656da23d pw_bluetooth_proxy: Update tests to remove RVNO as 436fcd614e916bf roll: clang 87d207a71a5d3bd pigweed: Add additional owners for emboss d176d28ac80b3af pw_multibuf: Remove deprecated Chunk::DiscardFront 917922749ee0a18 pw_allocator: Fix data race 6dc5adea0df071c pw_allocator: Add BucketBlockAllocator https://pigweed.googlesource.com/pigweed/pigweed third_party/pigweed/src Rolled-Commits: 825f89f0c2fd45d..8fefe0c2a5a34c8 Roller-URL: https://ci.chromium.org/b/8748097889143072977 GitWatcher: ignore CQ-Do-Not-Cancel-Tryjobs: true Change-Id: I23ef6cd2a726800bcd32c0bb889232c1f6a773e9 Reviewed-on: https://pigweed-review.googlesource.com/c/open-dice/+/209711 Lint: Lint 🤖 <android-build-ayeaye@system.gserviceaccount.com> Bot-Commit: Pigweed Roller <pigweed-roller@pigweed-service-accounts.iam.gserviceaccount.com> Commit-Queue: Pigweed Roller <pigweed-roller@pigweed-service-accounts.iam.gserviceaccount.com>
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:
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.
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.
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.
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
.
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
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.
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.
The Google C++ Style Guide is used. A .clang-format
file is provided for convenience.
To incorporate the code into another project, there are a few options:
Copy only the necessary code. For example:
Take the main code as is: include/dice/dice.h, src/dice.c
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.
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.
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.
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.