commit | 58b5e2b2f1bc28e79dbb64b635d4914c36eaec1f | [log] [tgz] |
---|---|---|
author | pigweed-roller <pigweed-roller@pigweed-service-accounts.iam.gserviceaccount.com> | Mon Oct 09 00:51:12 2023 +0000 |
committer | CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> | Mon Oct 09 00:51:12 2023 +0000 |
tree | 08eb990ad6a26577cfe290082a4b6ca746f20f0e | |
parent | bf8fca5e5cf6fbb3c5faaf6c30daa4c51d5c7056 [diff] |
[third_party/pigweed/src] Roll 61 commits 04e61c8160c5a6b roll: host_tools b663ff0695d2ac6 roll: absolute_uploader, incremental_uploader f51c449ae232b26 roll: cmake 5f37617f520fb5f roll: clang ac5f02adcf813e3 docs: Update changelog e0c65d59049bd7b pw_bluetooth: Fix size reports 2d8176eb33654dd pw_package: Update Emboss commit 6c8f0837d6607b5 pw_build: Update pw_linker_script docs 9b452455f7a4dda pw_function: Move pw_function_CONFIG to .gni 5e54acdf5551998 pw_toolchain: Exclude googletest from static analy 6009bb6a3b7fa0b third_party/fuchsia: Copybara import 0e0d92c028ce885 third_party/fuchsia: Update copybara with fit/defe 006513d01a260ea pw_async_basic: Fix build error when using pw_asyn 0431f5cf0934387 pw_build: Move pw_linker_script rule definition 0239a30bc8bf4a2 roll: clang cf7a170f1a920a8 pw_web: Enable manual color scheme setting a9e391c891ce200 Android.bp: Use C++20 everywhere 3863c372e6e9e86 pw_kvs: Add FlashPartitionWithLogicalSectors 8907ff856f1877b pw_transfer: Start the API reference 77e861a611c7afa pw_digital_io_rp2040: Implementation 7bffcc0fce84684 pw_sys_io_rp2040: Renamed from pw_sys_io_pico b5d99012ee4c59b pw_chrono_rp2040: System clock backend 0b52882d5ec5152 pw_unit_test: Do not print contents of unknown obj e0e17bf5022bd2a docs: Add docs on rollers 102c7316fb0d579 docs: Remove redundant auto-submit section c0701fa3e55fffd docs: Reformat CI/CQ Intro 6dc2f78f5e9a9b8 docs: Move CI/CQ Intro to infra/ cec0875b5d3dada pw_bluetooth: Format Emboss files bd20e21439b57f2 SEED-0112: Fix link 911d518409677ec pw_watch: Add link to served docs 19fa3bf9556ca54 build: Fix extended default group cc0d1d919b2d7b4 pw_build: Fix path in Bazel pw_linker_script 65045ddc71cb4f8 pw_build: Expose pw_linker_script in Bazel f19fddabf2f9622 pw_bloat: Update API to allow verbose json content 6174c052a8100df pw_perf_test: Gate on pw_chrono_SYSTEM_TIMER_BACKE 92e75196ab4c840 pw_rpc: Generate DynamicClient that dynamically al 7d7c50141287325 pw_chrono: Add clarification to is_nmi_safe 0d99018632a825c pw_allocator: Add Android.bp 7af170cf0a962a5 pw_build: Define empty configs 5cb3190fa53cc98 docs: Address comments on CI/CQ intro ff64979e3c64eea docs: Tidy up build system docs 789285f7b34c5f8 pw_web: Make ongoing transfers accessible downstre 78951d3fbfb9617 pigweed.json: Exclude patches.json from formatting 94ba2a7415536f3 pw_presubmit: Allow dots in module part of commit 3149fcb78151518 pw_minimal_cpp_stdlib: Update to compile with stdc fe4e19347954e08 pw_unit_test: Add more pw_unit_test_TESTONLY args 05da9e4d990bcdb pw_containers: Add missing <utility> include for s a5494a210108a59 pw_tokenizer: Support nested hashing tokenization 92b5c996d184d0d pw_cli: Update requires script b39ca9212a85e18 pw_bluetooth: Update comments in HCI event defs 272e12409b28ca9 docs: Fix typo bcf89442f7eb3c7 pw_build: Add bazel implementation of pw_cc_blob_l 406106bd94039fb pw_presubmit: Use autodoc for context classes 9e20d2f98b6a279 pw_i2c: Fix docs to use MakeExpectedTransactionArr 63654dacc3016d2 docs: Add CI/CQ Intro b51aab259be2aa3 pw_rpc_transport: Add a test loopback service regi 1f1c44a90fb0d73 pw_presubmit: Allow passing kwargs to build.bazel 97a92fc373e9035 pw_presubmit: No env_with_clang_vars with bazel f480cb2249645c5 pw_minimal_cpp_stdlib: Namespace public/internal t 57241beb10eab85 pw_build: Clean up build_target.gni 107b4ff1ee635d7 pw_toolchain: Add libc stub for gettimeofday, upda https://pigweed.googlesource.com/pigweed/pigweed third_party/pigweed/src Rolled-Commits: 36cb582c288cba0..04e61c8160c5a6b Roller-URL: https://ci.chromium.org/b/8767757431117457329 GitWatcher: ignore CQ-Do-Not-Cancel-Tryjobs: true Change-Id: Iac74a877391981a6015b178930aaeca652cb707d Reviewed-on: https://pigweed-review.googlesource.com/c/open-dice/+/175098 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.