diff --git a/Makefile.common b/Makefile.common index b3139c8e4a6ad..a2ba71009105f 100644 --- a/Makefile.common +++ b/Makefile.common @@ -27,7 +27,13 @@ path_to_add := $(addsuffix /bin,$(subst :,/bin:,$(GOPATH))):$(PWD)/tools/bin export PATH := $(path_to_add):$(PATH) GO := GO111MODULE=on go -GOBUILD := $(GO) build $(BUILD_FLAG) -tags codes +BUILD_FLAG := -tags codes +GOEXPERIMENT= +ifeq ("${ENABLE_FIPS}", "1") + BUILD_FLAG = -tags codes,boringcrypto + GOEXPERIMENT = GOEXPERIMENT=boringcrypto +endif +GOBUILD := $(GOEXPERIMENT) $(GO) build $(BUILD_FLAG) GOBUILDCOVERAGE := GOPATH=$(GOPATH) cd tidb-server; $(GO) test -coverpkg="../..." -c . GOTEST := $(GO) test -p $(P) OVERALLS := GO111MODULE=on overalls diff --git a/cmd/tidb-server/fips.go b/cmd/tidb-server/fips.go new file mode 100644 index 0000000000000..5b18f7bee023e --- /dev/null +++ b/cmd/tidb-server/fips.go @@ -0,0 +1,26 @@ +// Copyright 2023 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build boringcrypto +// +build boringcrypto + +package main + +import _ "crypto/tls/fipsonly" + +import "github.com/pingcap/tidb/pkg/parser/mysql" + +func init() { + mysql.TiDBReleaseVersion += "-fips" +}