sources: add bottlerocket-crypto-provider crate#935
Open
sky1122 wants to merge 1 commit into
Open
Conversation
a7aa14d to
d825cab
Compare
Add a centralized CryptoProvider crate that provides runtime FIPS detection and TLS algorithm selection for Bottlerocket Rust binaries. When the kernel FIPS flag is enabled (/proc/sys/crypto/fips_enabled = 1), the provider restricts TLS to FIPS-approved algorithms only (AES-GCM cipher suites, P-256/P-384 key exchange). On non-FIPS systems, the full algorithm set is available. This crate exposes three public functions: * fips_enabled() - detect kernel FIPS mode * provider() - return the appropriate CryptoProvider based on runtime detection * install_provider() - install the provider as the rustls global default Signed-off-by: Jingwei Wang <jweiw@amazon.com>
d825cab to
e5af7ed
Compare
Contributor
Author
|
forced pushed to rebase to the latest and regenerated the Cargo.lock file |
ginglis13
reviewed
May 29, 2026
Comment on lines
+76
to
+78
| let mode = if fips_enabled() { "FIPS" } else { "default" }; | ||
| info!("Installing {} CryptoProvider", mode); | ||
| let _ = provider().install_default(); |
Contributor
There was a problem hiding this comment.
nit: fips_enabled is called twice here - once just for the log message, then again inside the provider() method.
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 of changes:
Add a centralized CryptoProvider crate that provides runtime FIPS detection and TLS algorithm selection for Bottlerocket Rust binaries.
When the kernel FIPS flag is enabled (/proc/sys/crypto/fips_enabled = 1), the provider restricts TLS to FIPS-approved algorithms only (AES-GCM cipher suites, P-256/P-384 key exchange). On non-FIPS systems, the full algorithm set is available.
This crate exposes three public functions:
Testing done:
Testing with this PR and these two code chunks running on both fips/non-fips fedora host and test pass on both
Terms of contribution:
By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.