fix: parse ima-modsig d-modsig as d-ng like structured digest#8
Merged
Merged
Conversation
8b21059 to
0f38b28
Compare
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com> Signed-off-by: Takuma IMAMURA <209989118+hyperfinitism@users.noreply.github.com>
0f38b28 to
4c36386
Compare
d-modsig as d-ng structured digest and adjust encoding/fieldsd-modsig as d-ng like structured digest
There was a problem hiding this comment.
Code Review
This pull request refactors the ima-modsig template handling by transitioning the modsig_digest field from a raw Vec<u8> to a structured Option<Digest>. This change affects the ASCII and binary parsers, template definitions, and hashing logic. A review comment identifies a non-idiomatic semicolon placement in src/log/ascii.rs that should be corrected for better code style.
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.
Motivation
d-modsigas a structured digest (hash algorithm + digest) analogous tod-ng, not as opaque bytes, so parsing and encoding must follow that format.ima-modsigrepresentation able to express an absentd-modsigdistinctly from an all-zero/empty blob.Description
d-modsigasOption<Digest>inImaModsigEntryand keepmodsigas raw PKCS#7 DER bytes (Vec<u8>).parse_ima_modsig()to parse the optionald-modsigwithparse_prefixed_digest()instead of hex-decoding opaque bytes.decode_ima_modsig()to decodefields[3]usingdecode_d_ng()when non-empty and map an empty field toNone.collect_fields()to emitd-modsigusingencode_d_ng()when present or an empty field when absent, and update theima-modsigroundtrip test to use a reald-ng-encodedd-modsigvalue.Testing
cargo test -qwhich executed the unit test suite and all tests passed.parse_ima_modsig_roundtriptest validates decoding of ad-modsigwith a real hash algorithm and digest and passed under the test run.References