mirror of
https://github.com/slackhq/nebula.git
synced 2026-05-16 12:57:38 +02:00
requires go1.26
This commit is contained in:
22
fips140.go
22
fips140.go
@@ -2,16 +2,30 @@ package nebula
|
||||
|
||||
import (
|
||||
"crypto/fips140"
|
||||
"fmt"
|
||||
"runtime/debug"
|
||||
)
|
||||
|
||||
func fips140version() string {
|
||||
func getFIPS140() string {
|
||||
switch {
|
||||
case fips140.Enforced():
|
||||
return fmt.Sprintf("only,version=%s", fips140.Version())
|
||||
return "only"
|
||||
case fips140.Enabled():
|
||||
return fmt.Sprintf("on,version=%s", fips140.Version())
|
||||
return "on"
|
||||
default:
|
||||
return "off"
|
||||
}
|
||||
}
|
||||
|
||||
func getFIPS140Version() string {
|
||||
// The docs for fips140.Version mention this is more accurate to
|
||||
// get the exact version
|
||||
info, ok := debug.ReadBuildInfo()
|
||||
if ok {
|
||||
for _, s := range info.Settings {
|
||||
if s.Key == "GOFIPS140" {
|
||||
return s.Value
|
||||
}
|
||||
}
|
||||
}
|
||||
return fips140.Version()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user