...
1env snap=v1.0.0
2env alias=inprocess
3
4env GOFIPS140=$snap
5
6# Go+BoringCrypto conflicts with GOFIPS140.
7[GOEXPERIMENT:boringcrypto] skip
8
9# default GODEBUG includes fips140=on
10go list -f '{{.DefaultGODEBUG}}'
11stdout fips140=on
12
13# std lists fips snapshot and not regular fips
14go list std
15stdout crypto/internal/fips140/$snap/sha256
16! stdout crypto/internal/fips140/sha256
17! stdout crypto/internal/fips140/check
18
19# build does not use regular fips
20go list -json -test
21stdout crypto/internal/fips140/$snap/sha256
22! stdout crypto/internal/fips140/sha256
23! stdout crypto/internal/fips140/check
24
25# again with GOFIPS140=$alias
26# TODO: enable when we add inprocess.txt
27# env GOFIPS140=$alias
28
29# default GODEBUG includes fips140=on
30go list -f '{{.DefaultGODEBUG}}'
31stdout fips140=on
32
33# std lists fips snapshot and not regular fips
34go list std
35stdout crypto/internal/fips140/$snap/sha256
36! stdout crypto/internal/fips140/sha256
37! stdout crypto/internal/fips140/check
38
39# build does not use regular fips
40go list -json -test
41stdout crypto/internal/fips140/$snap/sha256
42! stdout crypto/internal/fips140/sha256
43! stdout crypto/internal/fips140/check
44
45[short] skip
46
47# build with GOFIPS140=snap is cached
48go build -x -o x.exe
49stderr link.*-fipso
50go build -x -o x.exe
51! stderr link.*-fipso
52
53# build test with GOFIPS140=snap is cached
54go test -x -c
55stderr link.*-fipso
56go test -x -c
57! stderr link
58
59-- go.mod --
60module m
61-- x.go --
62package main
63import _ "crypto/sha256"
64func main() {
65}
66-- x_test.go --
67package main
68import "testing"
69func Test(t *testing.T) {}
View as plain text