Skip to content

Commit b6f01ec

Browse files
stanhuPatrick Cyiza
authored and
Patrick Cyiza
committed
Prepare for Go 1.19 FIPS support
https://gitlab.com/gitlab-org/gitlab-shell/-/merge_requests/718 will make Go 1.19 the default for gitlab-shell. Per golang/go#51940, the dev.boringcrypto branch no longer exists, and to support FIPS we need to pass along `GOEXPERIMENT=boringcrypto`. To do this, we just see if this `GOEXPERIMENT` is available with `go version` rather than do some more complicated version-specific comparison.
1 parent f76503a commit b6f01ec

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Makefile

+9-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@ BUILD_TIME := $(shell date -u +%Y%m%d.%H%M%S)
88
BUILD_TAGS := tracer_static tracer_static_jaeger continuous_profiler_stackdriver
99

1010
ifeq (${FIPS_MODE}, 1)
11-
# boringcrypto tag is added automatically by golang-fips compiler
11+
# Go 1.19 now requires GOEXPERIMENT=boringcrypto for FIPS compilation.
12+
# See https://github.com/golang/go/issues/51940 for more details.
13+
BORINGCRYPTO_SUPPORT := $(shell GOEXPERIMENT=boringcrypto go version &> /dev/null; echo $$?)
14+
ifeq ($(BORINGCRYPTO_SUPPORT), 0)
15+
GOBUILD_ENV=GOEXPERIMENT=boringcrypto
16+
endif
17+
1218
BUILD_TAGS += fips
1319
# If the golang-fips compiler is built with CGO_ENABLED=0, this needs to be
1420
# explicitly switched on.
@@ -60,10 +66,10 @@ _script_install:
6066

6167
compile: bin/gitlab-shell bin/gitlab-sshd
6268
bin/gitlab-shell: $(GO_SOURCES)
63-
GOBIN="$(CURDIR)/bin" go install $(GOBUILD_FLAGS) ./cmd/...
69+
GOBIN="$(CURDIR)/bin" $(GOBUILD_ENV) go install $(GOBUILD_FLAGS) ./cmd/...
6470

6571
bin/gitlab-sshd: $(GO_SOURCES)
66-
GOBIN="$(CURDIR)/bin" go install $(GOBUILD_FLAGS) ./cmd/gitlab-sshd
72+
GOBIN="$(CURDIR)/bin" $(GOBUILD_ENV) go install $(GOBUILD_FLAGS) ./cmd/gitlab-sshd
6773

6874
check:
6975
bin/check

0 commit comments

Comments
 (0)