...
1env snap=v1.0.0-c2097c7c
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
26env GOFIPS140=$alias
27
28# default GODEBUG includes fips140=on
29go list -f '{{.DefaultGODEBUG}}'
30stdout fips140=on
31
32# std lists fips snapshot and not regular fips
33go list std
34stdout crypto/internal/fips140/$snap/sha256
35! stdout crypto/internal/fips140/sha256
36! stdout crypto/internal/fips140/check
37
38# build does not use regular fips
39go list -json -test
40stdout crypto/internal/fips140/$snap/sha256
41! stdout crypto/internal/fips140/sha256
42! stdout crypto/internal/fips140/check
43
44[short] skip
45
46# build with GOFIPS140=snap is cached
47go build -x -o x.exe
48stderr link.*-fipso
49go build -x -o x.exe
50! stderr link.*-fipso
51
52# build test with GOFIPS140=snap is cached
53go test -x -c
54stderr link.*-fipso
55go test -x -c
56! stderr link
57
58-- go.mod --
59module m
60-- x.go --
61package main
62import _ "crypto/sha256"
63func main() {
64}
65-- x_test.go --
66package main
67import "testing"
68func Test(t *testing.T) {}
View as plain text