Skip to content

Commit 896a14d

Browse files
committed
Force fips140tls in boring mode and run http tests
1 parent 48fd3b2 commit 896a14d

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

patches/fips.patch

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11964,3 +11964,24 @@ index 7ca8e34908..bf66a1cd19 100644
1196411964
# golang.org/x/crypto v0.30.0
1196511965
## explicit; go 1.20
1196611966
golang.org/x/crypto/chacha20
11967+
diff --git a/src/crypto/tls/internal/fips140tls/fipstls.go b/src/crypto/tls/internal/fips140tls/fipstls.go
11968+
index 24d78d60cf..efd78bf17f 100644
11969+
--- a/src/crypto/tls/internal/fips140tls/fipstls.go
11970+
+++ b/src/crypto/tls/internal/fips140tls/fipstls.go
11971+
@@ -6,6 +6,7 @@
11972+
package fips140tls
11973+
11974+
import (
11975+
+ boring "crypto/internal/backend"
11976+
"crypto/internal/fips140"
11977+
"sync/atomic"
11978+
)
11979+
@@ -13,7 +14,7 @@ import (
11980+
var required atomic.Bool
11981+
11982+
func init() {
11983+
- if fips140.Enabled {
11984+
+ if fips140.Enabled || boring.Enabled() {
11985+
Force()
11986+
}
11987+
}

scripts/crypto-test.sh

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export GOCACHE=/tmp/go-cache
2020
export GO=${GOROOT}/bin/go
2121

2222
# Test suites to run
23-
SUITES="crypto,tls"
23+
SUITES="crypto,tls,http"
2424
# Verbosity flags to pass to Go
2525
VERBOSE=""
2626

@@ -65,6 +65,24 @@ run_crypto_test_suite () {
6565
quiet popd
6666
}
6767

68+
run_http_test_suite () {
69+
local mode=$1
70+
local tags=$2
71+
local suite="net-http-fips"
72+
notify_running ${mode} ${suite}
73+
quiet pushd ${GOROOT}/src/net/http
74+
GOLANG_FIPS=1 OPENSSL_FORCE_FIPS_MODE=1 \
75+
$GO test $tags -count=1 $VERBOSE
76+
77+
local suite="net-http-fips-parity-nocgo"
78+
notify_running ${mode} ${suite}
79+
quiet pushd ${GOROOT}/src/net/http
80+
GOLANG_FIPS=1 OPENSSL_FORCE_FIPS_MODE=1 \
81+
CGO_ENABLED=0 $GO test $tags -count=1 $VERBOSE
82+
83+
quiet popd
84+
}
85+
6886
run_tls_test_suite () {
6987
local mode=$1
7088
local tags=$2
@@ -85,6 +103,8 @@ run_full_test_suite () {
85103
run_crypto_test_suite ${mode} ${tags}
86104
elif [[ "$suite" == "tls" ]]; then
87105
run_tls_test_suite ${mode} ${tags}
106+
elif [[ "$suite" == "http" ]]; then
107+
run_http_test_suite ${mode} ${tags}
88108
fi
89109
done
90110
}

0 commit comments

Comments
 (0)