import "sync/atomic"
-var required uint32
+var required atomic.Bool
// Force forces crypto/tls to restrict TLS configurations to FIPS-approved settings.
// By design, this call is impossible to undo (except in tests).
// Note that this call has an effect even in programs using
// standard crypto (that is, even when Enabled = false).
func Force() {
- atomic.StoreUint32(&required, 1)
+ required.Store(true)
}
// Abandon allows non-FIPS-approved settings.
if !hasSuffix(name, "_test") && !hasSuffix(name, ".test") && name != "NaClMain" && name != "" {
panic("fipstls: invalid use of Abandon in " + name)
}
- atomic.StoreUint32(&required, 0)
+ required.Store(false)
}
// provided by runtime
// Required reports whether FIPS-approved settings are required.
func Required() bool {
- return atomic.LoadUint32(&required) != 0
+ return required.Load()
}