Repository navigation
Conversation
mfield4
force-pushed
the
mutask-graft
branch
from
November 10, 2026 00:12
47d3113 to
22af3be
Compare
mfield4
marked this pull request as ready for review
November 10, 2026 00:42
mfield4
force-pushed
the
mutask-graft
branch
2 times, most recently
from
November 12, 2026 00:59
0be927a to
fcea675
Compare
korran
reviewed
Nov 12, 2026
| @@ -32,6 +30,13 @@ static K: [u32; 64] = [ | |||
| const BLOCK_SIZE_BYTES: usize = 64; | |||
| const BLOCK_SIZE_WORDS: usize = BLOCK_SIZE_BYTES / 4; | |||
|
|
|||
| /// Sets byte `i` of `block`, viewed as native-endian bytes. | |||
| const fn set_block_byte(block: &mut [u32; BLOCK_SIZE_WORDS], i: usize, byte: u8) { | |||
Collaborator
There was a problem hiding this comment.
Remove this function. You can accomplish the same thing by using transmut_mut!():
let block_bytes: &mut [u8; BLOCK_SIZE_BYTES] = transmute_mut!(&mut self.block);
block_bytes[5] = 42;
korran
reviewed
Nov 12, 2026
| } | ||
|
|
||
| let mut out = String::new(); | ||
| out.push_str("// Copyright 2026 Google LLC\n"); |
Collaborator
There was a problem hiding this comment.
I don't think we should hard-code this. Can we add a attr to the build rule (and flag to the binary), something like file_prefix=":apache2_header.txt"
mfield4
force-pushed
the
mutask-graft
branch
from
November 13, 2026 19:05
fcea675 to
0fe3be3
Compare
mfield4
force-pushed
the
mutask-graft
branch
from
November 13, 2026 19:28
0fe3be3 to
403f84f
Compare
This reorders the entire hash to be little-endian.
The old libraries weren't taking advantage of the crate_name attribute.
Unfortunately, crate_universe repo names are global, so this change makes collisions less likely.
This makes it easier for other repos to reference the exact same crates as mutask.
This provides a macro for comparing arbitrary text data to a golden file, and allowing a person running a test to automatically set the golden data to the "actual" data by setting a flag when running the unit test.
include_bytes!() is relative to the current source file, not the crate root, so use that when computing the full path with UPDATE_GOLDEN=1.
This can be used to assert golden-data for the generated rust code for a distro.
These clippy warnings are introduced in a new version of the compiler.
Encode/decode TLV structs to/from byte buffers
Will be used for proto -> TLV encoding
Adds: - TLV Code generator: Generate TLV struct from proto files - TLV Converter: Encode TLV annotated proto to TLV buffer
Mostly generated by Gemini from the implementation, but I checked it for correctness.
contrib/tlv depends on U64Aligned4 to optimize load/stores in generated code. This adds an unnecessary dependency on mutask types to contrib/tlv. Move the type to it's own contrib/aligned crate. Side benefit of having a nice spot to add other aligned types if it comes up.
TlvItem::header and TlvItem::payload are moved into a new DST type, TlvContainer. This makes it possible to get a reference to all the bytes of a TLV item with `item.container.as_bytes()`, which is useful when verifying signatures.
TLV codegen currently naively regenerates rust bindings for all imported proto dependencies, causing code duplication. Add a deps field to bazel rule that will import tlv crates in generated rust code.
Tag TLV update targets with "tlv_update" and query them in fix.sh to automatically regenerate checked-in TLV structs.
This was causing `ci.sh` to fail on my machine.
Add new trait + impls to calculate Sha256 digest on public key materials.
With opt=s, LLVM often makes poor inlining decisions that can double the size of the generated machine code. Force it to always inline these simple functions.
Also, improve the rustdoc for this type.
When tlv_codegen is invoked from an external repository (such as a downstream firmware repo), plain string labels like "//contrib/aligned" resolve relative to the caller's repository rather than @mutask. Wrap them in Label() so they always resolve relative to @mutask.
Define ChipFamily enum and ChipId TLV message (tag "C_ID") in contrib/openprot/proto/chipid.proto.
sha256_sw used mutask_subtle::as_mut_bytes() to write single bytes into the u32 block from const fns. Write them through a small const helper instead, so the crate only depends on zerocopy and stays no_std.
- golden: take argh from //third_party instead of @crates_mutask. - MODULE.bazel.lock: record protobuf's crate resolution, now that Rust protobuf is built.
The TLV libraries now live outside mutask. Rename the mutask_* crates to openprot_* and the mutask.* proto packages to openprot.*, and regenerate the checked-in TLV code.
libhoth's CI checks .proto files with clang-format. These are whitespace and wrapping changes only, and the generated TLV code is unchanged.
shared/ holds code that is shared between host tools and firmware. Update the Bazel labels, proto import paths and descriptor names that depend on the location, and regenerate the checked-in TLV code.
mfield4
force-pushed
the
mutask-graft
branch
from
November 13, 2026 19:46
403f84f to
67e89dc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 2 of 3 (#324, #327, #328).
This PR imports the TLV and protobuf libraries from mutask with their commit history intact, gets them building in libhoth, and moves them to
shared/. They stayno_stdsinceshared/is used by both firmware and host tools.Please merge with "Rebase and merge" (not squash) to keep the imported commit history. Intermediate commits won't build on their own, only the PR head.
What to review
Commits 1-31 are imported history from mutask with original authors, dates, and commit messages preserved. They were already reviewed in mutask, so there's no need to review them line by line.
Commits 32-36 are new in libhoth:
crypto: Decouple sha256_sw from mutask: replacesmutask_subtle::as_mut_bytes()with a small const helper (the only logic change).tlv: Build in libhoth: updates one dependency label ingolden/BUILD.bazel; the rest of the diff isMODULE.bazel.lock.Rename mutask crates and proto packages to openprot: renamesmutask_*/mutask.*toopenprot_*/openprot.*, mostly in regenerated*_tlv.rsfiles.Format the imported protos with clang-format: whitespace and wrapping only; generated TLV code doesn't change.Move TLV libraries to shared/: moves the directories and updates Bazel labels, import paths, and descriptor names.History import
The imported commits come from mutask
3a5aa8d, filtered tocontrib/{proto,aligned,tlv,openprot,crypto,fingerprints,golden}with empty commits dropped. Two commits (Add SHAKE256 software libandcontrib/crypto: Add mldsa_sw Rust wrapper for ML-DSA-44) were left out because they depend on a vendored PQC library being reviewed separately. The filter script also scrubs a few internal names from files and four commit messages, stripsChange-Id:andBug:footers, and adds Apache-2.0 headers to.rs,.proto,.bzl, andBUILD.bazelfiles (including intlv/codegen.rs, so checked-in generated code still matches the generator at every commit).Googlers with mutask access can reproduce the import and check that commits 1-31 match byte-for-byte (files, authors, dates, and messages) using
contrib/libhoth_graft/in mutask: