make the module-integrity self-test honest#63
Merged
Conversation
CheckModuleIntegrity hardcoded Verified: true with a "Simplified - always passes" comment and a placeholder expected hash, so it claimed a self-test it never ran. It is not called in production, but docs/FIPS.md presents it as a feature, which overclaims in FIPS mode. Pin the real SHA-256 of the embedded KAT vectors and set Verified to the actual comparison, so the comparison earns the true value. Scope it precisely in the type, the function, and FIPS.md: it checks that the KAT vectors were not altered in the binary, NOT the .text section. A real binary/.text HMAC that fails hard in FIPS mode stays future work. The test now asserts the comparison passes, so a future KAT or pinned-hash drift fails loudly. Verified across the default and -tags fips builds.
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.
What
crypto.CheckModuleIntegrityreturnedVerified: trueunconditionally (// Simplified - always passes) against a placeholder expected hash - it claimed a self-test it never performed. Nothing calls it in production, butdocs/FIPS.md:228documents it as a FIPS feature, so the claim leaks into the FIPS story.Change
0aa6a0d6...c1ad1868) and setVerified = (actualHash == expectedHash)- the comparison now earns thetruevalue.docs/FIPS.md: it confirms the KAT vectors were not altered in the binary, NOT the.textsection. The notes flag a real binary/.textHMAC (failing hard in FIPS mode) as future work.TestCheckModuleIntegritynow asserts the comparison passes, so a future KAT-vector or pinned-hash drift fails loudly.Verification
go test ./pkg/crypto/...andgo test -tags fips ./pkg/crypto/...pass; full suite green. No production caller, so no live path changes behavior.