Move FIPS Known Answer Tests in a single file#411
Merged
simo5 merged 3 commits intolatchset:mainfrom Feb 2, 2026
Merged
Conversation
f4e279f to
f630c87
Compare
Jakuje
approved these changes
Feb 2, 2026
Move the Known Answer Test (KAT) for HMAC-SHA256 under the fips module. This test is executed once on the first HMAC operation when the `fips` feature is enabled. The test logic is encapsulated in a new `fips::kats` module, moving it out of the `native::hmac` implementation for better code organization. If the KAT fails, the library enters a FIPS error state, and subsequent cryptographic operations will be blocked. Co-authored-by: Gemini <gemini@google.com> Signed-off-by: Simo Sorce <simo@redhat.com>
Relocate the FIPS Known Answer Test (KAT) for the TLS Pseudo-Random Function (PRF) from `native/tlskdf.rs` to the centralized `fips/kats.rs` module. This change consolidates all FIPS self-tests into a single location for better code organization and consistency. To enable this, the `TLSPRF` struct and its methods were made crate-public so they can be accessed from the tests module. The KAT implementation now uses the common `FIPSSelftest` framework. Co-authored-by: Gemini <gemini@google.com> Signed-off-by: Simo Sorce <simo@redhat.com>
The TLS PRF Known Answer Test (KAT) is refactored to improve robustness and readability. A new `secret_key_object` helper function is introduced to create the secret key object used in the test. This change, along with converting hex-decoded test vectors to static byte arrays, removes all `unwrap()` calls from the test's initialization logic. This ensures that any potential errors during setup will cause the self-test to fail gracefully rather than causing a panic. Signed-off-by: Simo Sorce <simo@redhat.com>
Member
Author
|
thanks for the review! |
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.
Description
Makes maintenance of FIPS KATs easier.
Checklist
Reviewer's checklist: