golang/go · error
FIPS 140-3 mode is incompatible with GOEXPERIMENT=boringcryp
Error message
FIPS 140-3 mode is incompatible with GOEXPERIMENT=boringcrypto
What it means
Returned by fips140.Supported() when the binary was built with GOEXPERIMENT=boringcrypto (the legacy BoringCrypto module). FIPS 140-3 mode and the older BoringCrypto GOEXPERIMENT are mutually exclusive cryptographic stacks; only one can be authoritative at a time.
Source
Thrown at src/crypto/internal/fips140/fips140.go:62
// before reading it, but it is unclear whether that would then cause
// false negatives. For now, FIPS+ASAN doesn't need to work.
if asanEnabled {
return errors.New("FIPS 140-3 mode is incompatible with ASAN")
}
// See EnableFIPS in cmd/internal/obj/fips.go for commentary.
// Also, js/wasm and windows/386 don't have good enough timers
// for the CPU jitter entropy source.
switch {
case runtime.GOARCH == "wasm",
runtime.GOOS == "windows" && runtime.GOARCH == "386",
runtime.GOOS == "openbsd", // due to -fexecute-only, see #70880
runtime.GOOS == "aix":
return errors.New("FIPS 140-3 mode is not supported on " + runtime.GOOS + "-" + runtime.GOARCH)
}
if boringEnabled {
return errors.New("FIPS 140-3 mode is incompatible with GOEXPERIMENT=boringcrypto")
}
return nil
}
func Name() string {
return "Go Cryptographic Module"
}
// Version returns the formal version (such as "v1.0.0") if building against a
// frozen module with GOFIPS140. Otherwise, it returns "latest".
func Version() string {
// This return value is replaced by mkzip.go, it must not be changed or
// moved to a different file.
return "latest" //mkzip:version
}
View on GitHub (pinned to b6b368adc5)
Solutions
- Choose one crypto stack: drop GOEXPERIMENT=boringcrypto when enabling GOFIPS140=1, or vice versa.
- Audit the build environment (env, Dockerfile, CI matrix, go env GOEXPERIMENT) for stale boringcrypto settings.
- For new deployments prefer the native FIPS 140-3 module (no GOEXPERIMENT) over BoringCrypto.
Example fix
# before GOEXPERIMENT=boringcrypto GOFIPS140=1 go build ./... # after GOFIPS140=1 go build ./...
Defensive patterns
Strategy: validation
Validate before calling
if err := fips140.Supported(); err != nil {
if strings.Contains(err.Error(), "boringcrypto") {
log.Fatal("FIPS 140-3 mode conflicts with GOEXPERIMENT=boringcrypto; pick one")
}
log.Fatalf("FIPS unsupported: %v", err)
} Try / catch
if err := fips140.Supported(); err != nil {
return fmt.Errorf("FIPS startup check failed: %w", err)
} Prevention
- Audit go env GOEXPERIMENT and CI image env for boringcrypto.
- Migrate fully to native FIPS 140-3 (drop GOEXPERIMENT) before enabling GOFIPS140=1.
- Document the chosen crypto stack in the project README.
When it happens
Trigger: Building with GOEXPERIMENT=boringcrypto set (env or go build flags) and then enabling GOFIPS140=1 or calling fips140.Supported().
Common situations: Migrating from BoringCrypto to the new native FIPS module and forgetting to drop GOEXPERIMENT; CI images baked with BoringCrypto globally; corporate base images that set both.
Related errors
- FIPS 140-3 mode is incompatible with the purego build tag
- FIPS 140-3 mode is incompatible with ASAN
- FIPS 140-3 mode is not supported on {GOOS}-{GOARCH}
- crypto/ecdh: invalid private key
- crypto/aes: GCM tag and nonce sizes can't be non-standard at
AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12).
Data as JSON: /api/errors/90b29cc2241e896d.
Report an issue: GitHub.