Set FIPS-approved TLS curve preferences when the FIPS module is active - #3499
Merged
Merged
Conversation
The default transport left CurvePreferences unset, so Go's defaults applied. Those lead with X25519, which crypto/ecdh rejects under GODEBUG=fips140=only, failing every SDK request on Go 1.25+ with: crypto/ecdh: use of X25519 is not allowed in FIPS 140-only mode Restrict to the NIST curves only when crypto/fips140.Enabled() reports the FIPS module is active. Outside FIPS mode the preferences stay unset so Go's defaults, including the post-quantum X25519MLKEM768 hybrid, are preserved. Fixes aws#3345
lucix-aws
approved these changes
Jul 31, 2026
wty-Bryant
reviewed
Aug 4, 2026
wty-Bryant
left a comment
Collaborator
There was a problem hiding this comment.
Codegen and integ tests failed because pr is from fork repo branch, merged since other go tests passed
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.
Fixes #3345
Problem
Every SDK request fails on Go 1.25+ under
GODEBUG=fips140=only:defaultHTTPTransport()built itstls.Configwith onlyMinVersionset, leavingCurvePreferencesempty so Go's defaults applied. Those lead with X25519, whichcrypto/ecdhrejects outright in FIPS 140-only mode, so the handshake dies before any AWS call is made. Go 1.24 introducedfips140=onlybut did not enforce the X25519 rejection; 1.25 does, which is why this surfaced now.Approach
The issue suggested either setting FIPS-safe
CurvePreferencesoutright or detecting FIPS at runtime. I went with the second: setting them unconditionally would strip X25519 and the Go 1.24+ post-quantumX25519MLKEM768hybrid from every SDK user, the overwhelming majority of whom are not in FIPS mode. That is a real downgrade to pay for a FIPS-only bug.Instead,
defaultTLSCurvePreferencesreturnsnilnormally — Go's defaults, completely unchanged — and the NIST curves only whencrypto/fips140.Enabled()reports the module is active. The module targetsgo 1.24, socrypto/fips140is available without build tags.This also covers
fips140=on, where X25519 is permitted but not approved; restricting to approved curves there matches FIPS intent rather than leaving a second inconsistent mode.Verification
Behavior of the default transport, using a small program that reads
NewBuildableClient().GetTransport().TLSClientConfigagainst this branch:Before (
origin/main)After (this branch)
The normal-mode line is identical before and after, which is the point: non-FIPS users keep X25519 and the post-quantum hybrid.
Unit tests cover both branches of the selection, assert no non-approved curve can appear under FIPS, and check the transport's own TLS config. They pass in both modes:
Also clean:
go build ./...,go vet ./aws/transport/http/,gofmt -l(no output), and the full./aws/transport/http/...package tests.I did not run the issue's end-to-end STS reproduction, since it needs live AWS credentials against a FIPS endpoint. The transport-level output above isolates the same root cause.
Per CONTRIBUTING, no
.changelogentry is included.