Skip to content

Commit aa093ee

Browse files
committed
crypto/fips140: add Version
Fixes #75301 Change-Id: If953b4382499570d5437491036f91cbe4fec7c01 Reviewed-on: https://go-review.googlesource.com/c/go/+/723101 Reviewed-by: Roland Shoemaker <roland@golang.org> Reviewed-by: Filippo Valsorda <filippo@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
1 parent 1dc1505 commit aa093ee

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

api/next/75301.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pkg crypto/fips140, func Version() string #75301
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[Version] returns the resolved FIPS 140-3 Go Cryptographic Module version when building against a frozen module with GOFIPS140.

src/crypto/fips140/fips140.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,18 @@ func Enabled() bool {
2323
}
2424
return fips140.Enabled
2525
}
26+
27+
// Version returns the FIPS 140-3 Go Cryptographic Module version (such as
28+
// "v1.0.0"), as referenced in the Security Policy for the module, if building
29+
// against a frozen module with GOFIPS140. Otherwise, it returns "latest". If an
30+
// alias is in use (such as "inprogress") the actual resolved version is
31+
// returned.
32+
//
33+
// The returned version may not uniquely identify the frozen module which was
34+
// used to build the program, if there are multiple copies of the frozen module
35+
// at the same version. The uniquely identifying version suffix can be found by
36+
// checking the value of the GOFIPS140 setting in
37+
// runtime/debug.BuildInfo.Settings.
38+
func Version() string {
39+
return fips140.Version()
40+
}

0 commit comments

Comments
 (0)