-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use another method of FIPS validation (fips-detect) (#3363)
* Use another method of FIPS validation (fips-detect)
- Loading branch information
Showing
5 changed files
with
32 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -221,7 +221,7 @@ validate-go-action: | |
@sha256sum --quiet -c .sha256sum || (echo error: client library is stale, please run make client; exit 1) | ||
|
||
validate-fips: | ||
hack/fips/validate-fips.sh | ||
hack/fips/validate-fips.sh ./aro | ||
|
||
unit-test-go: | ||
go run gotest.tools/[email protected] --format pkgname --junitfile report.xml -- -coverprofile=cover.out ./... | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,22 @@ | ||
#!/bin/bash | ||
|
||
# The small go program below will validate that a | ||
# FIPS validated crypto lib | ||
cat > ./hack/fips/main.go << 'EOF' | ||
package main | ||
set -xe | ||
|
||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the Apache License 2.0. | ||
# check if we can build and have built a valid FIPS-compatible binary | ||
res=$(go run github.com/acardace/[email protected] ${1} -j) | ||
|
||
import ( | ||
_ "crypto/tls/fipsonly" | ||
binary=$(echo $res | go run ./hack/jq -r '.goBinaryFips.value') | ||
lib=$(echo $res | go run ./hack/jq -r '.cryptoLibFips.value') | ||
|
||
utillog "github.com/Azure/ARO-RP/pkg/util/log" | ||
) | ||
if [[ $binary == "false" ]]; then | ||
echo "binary is not FIPS compatible" | ||
exit 1 | ||
fi | ||
|
||
func main() { | ||
log := utillog.GetLogger() | ||
log.Println("FIPS mode enabled") | ||
} | ||
EOF | ||
trap "rm ./hack/fips/main.go" EXIT | ||
echo "Attempting to run program that requires FIPS crypto" | ||
go run ./hack/fips/main.go | ||
if [[ $lib == "false" ]]; then | ||
echo "lib is not FIPS compatible" | ||
exit 1 | ||
fi | ||
|
||
tool=$(go tool nm ${1} | grep FIPS) | ||
echo $tool |