Skip to content

feat: support "verify" with FIPS crypto backend#233

Open
domodwyer wants to merge 1 commit intorusticata:masterfrom
domodwyer:dom/fips
Open

feat: support "verify" with FIPS crypto backend#233
domodwyer wants to merge 1 commit intorusticata:masterfrom
domodwyer:dom/fips

Conversation

@domodwyer
Copy link

Hi there! First off, thanks for this library and the careful thought put into the security aspects.

I'm working on a system that is deployed in FedRAMP environments, which requires FIPS certified crypto backends, and fortunately the aws-lc-rs crate used by x509-parser is already supported! However it's configured to use the non-FIPS backend when enabling the verify-aws feature today.

This PR adds a new feature flag verify-aws-fips to go alongside the existing verify-aws feature flag, enabling the FIPS-approved aws-lc-rs backend.

There's no code changes, just feature flag toggling 👍


  • feat: support "verify" with FIPS crypto backend (8f355a0)

    Allow verifying cryptographic signatures using the AWS-LC's FIPS crypto
    backend.
    
    This change allows this library to be used in FedRAMP / US Gov
    deployments, which have a hard requirement on using FIPS-approved crypto
    modules only.
    
    The "verify-aws-fips" feature flag is functionally identical to using
    "verify-aws", but it selects the FIPS backend in aws-lc-rs.
    

Allow verifying cryptographic signatures using the AWS-LC's FIPS crypto
backend.

This change allows this library to be used in FedRAMP / US Gov
deployments, which have a hard requirement on using FIPS-approved crypto
modules only.

The "verify-aws-fips" feature flag is functionally identical to using
"verify-aws", but it selects the FIPS backend in aws-lc-rs.
Comment on lines -8 to +12
#[cfg(any(feature = "verify", feature = "verify-aws"))]
#[cfg(any(
feature = "verify",
feature = "verify-aws",
feature = "verify-aws-fips"
))]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is basically all the source code changes in this PR: adding a new feature flag in the same place as verify-aws.

default = []
verify-aws = ["aws-lc-rs"]
verify-aws = ["aws-lc-rs/aws-lc-sys"] # Non-FIPS backend
verify-aws-fips = ["aws-lc-rs/fips"] # FIPS crypto backend
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the new feature flag which switches on the fips feature of the aws-lc-rs crate.

It's either / or for the backends though, and the non-FIPS backend is enabled by default, so I've disabled the default features for aws-lc-rs and let the x509-parser feature flags enable the relevant crypto backend.

Comment on lines +82 to +92
test_fips:
name: verify-aws-fips dependency on FIPS backend only
needs: check-all-features
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
- run: "if cargo tree --features=verify-aws-fips -i aws-lc-sys; then false; else [ $? -eq 101 ]; fi"
- run: "cargo tree --features=verify-aws-fips -i aws-lc-fips-sys"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figured it was a good idea to add a CI step to verify the FIPS backend is used when the fips flag is provided.

Specifically:

  • The non-FIPS backend is not used (aws-lc-sys)
  • The FIPS backend is used (aws-lc-fips-sys)

@cpu
Copy link
Collaborator

cpu commented Feb 11, 2026

Thanks for the PR (& self-review), I will try to review it soon but I'm supportive of the general direction.

Security audit / security_audit (pull_request) - Failing after 3m

FWIW you can ignore this failing CI job, it's being addressed in #223

@domodwyer
Copy link
Author

domodwyer commented Feb 11, 2026

Awesome! No rush.

Thanks for the link - I see you're keeping support for a MSRV of 1.67.1 in the linked PR, but aws-lc-rs wants at least 1.70:

error: package aws-lc-fips-sys v0.13.11 cannot be built because it requires rustc 1.70.0 or newer, while the currently active rustc version is 1.67.1

Should I gate the CI checks agains the FIPS backend with if: matrix.rust != '1.67.1'?

@cpu
Copy link
Collaborator

cpu commented Feb 11, 2026

Thanks for the link - I see you're keeping support for a MSRV of 1.67.1 in the linked PR, but aws-lc-rs wants at least 1.70

I think this will ultimately come down to @chifflier's preference. IMHO I think an MSRV of 1.67 is too stale and many crates in the ecosystem with larger use have more aggressive MSRVs (e.g. Tokio at 1.71, aws-lc-rs at 1.70, rustls at 1.83).

I would personally be in favour of taking an MSRV increase that was more in-line with those projects. 1.71 seems like an OK target and was a rust version released ~2 years ago.

@domodwyer
Copy link
Author

It's a shame there's no way of getting hold of rust version metadata for downloads from crates.io in order to make an informed decision - I agree it's quite a low MSRV and I doubt there's a meaningful fraction of users on <1.71 these days.

I will leave it as-is for now, and make any changes after review / when there's a MSRV plan 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants