{"record":{"id":"90b29cc2241e896d","repo":"golang/go","slug":"fips-140-3-mode-is-incompatible-with-goexperiment","errorCode":null,"errorMessage":"FIPS 140-3 mode is incompatible with GOEXPERIMENT=boringcrypto","messagePattern":"FIPS 140-3 mode is incompatible with GOEXPERIMENT=boringcrypto","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/crypto/internal/fips140/fips140.go","lineNumber":62,"sourceCode":"\t// before reading it, but it is unclear whether that would then cause\n\t// false negatives. For now, FIPS+ASAN doesn't need to work.\n\tif asanEnabled {\n\t\treturn errors.New(\"FIPS 140-3 mode is incompatible with ASAN\")\n\t}\n\n\t// See EnableFIPS in cmd/internal/obj/fips.go for commentary.\n\t// Also, js/wasm and windows/386 don't have good enough timers\n\t// for the CPU jitter entropy source.\n\tswitch {\n\tcase runtime.GOARCH == \"wasm\",\n\t\truntime.GOOS == \"windows\" && runtime.GOARCH == \"386\",\n\t\truntime.GOOS == \"openbsd\", // due to -fexecute-only, see #70880\n\t\truntime.GOOS == \"aix\":\n\t\treturn errors.New(\"FIPS 140-3 mode is not supported on \" + runtime.GOOS + \"-\" + runtime.GOARCH)\n\t}\n\n\tif boringEnabled {\n\t\treturn errors.New(\"FIPS 140-3 mode is incompatible with GOEXPERIMENT=boringcrypto\")\n\t}\n\n\treturn nil\n}\n\nfunc Name() string {\n\treturn \"Go Cryptographic Module\"\n}\n\n// Version returns the formal version (such as \"v1.0.0\") if building against a\n// frozen module with GOFIPS140. Otherwise, it returns \"latest\".\nfunc Version() string {\n\t// This return value is replaced by mkzip.go, it must not be changed or\n\t// moved to a different file.\n\treturn \"latest\" //mkzip:version\n}\n","sourceCodeStart":44,"sourceCodeEnd":79,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/crypto/internal/fips140/fips140.go#L44-L79","documentation":"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.","triggerScenarios":"Building with GOEXPERIMENT=boringcrypto set (env or go build flags) and then enabling GOFIPS140=1 or calling fips140.Supported().","commonSituations":"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.","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."],"exampleFix":"# before\nGOEXPERIMENT=boringcrypto GOFIPS140=1 go build ./...\n\n# after\nGOFIPS140=1 go build ./...","handlingStrategy":"validation","validationCode":"if err := fips140.Supported(); err != nil {\n    if strings.Contains(err.Error(), \"boringcrypto\") {\n        log.Fatal(\"FIPS 140-3 mode conflicts with GOEXPERIMENT=boringcrypto; pick one\")\n    }\n    log.Fatalf(\"FIPS unsupported: %v\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := fips140.Supported(); err != nil {\n    return fmt.Errorf(\"FIPS startup check failed: %w\", err)\n}","preventionTips":["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."],"tags":["fips140","boringcrypto","goexperiment","config","compatibility"],"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T08:17:17.861Z"}