Source File
enforcement.go
Belonging Package
crypto/fips140
// Copyright 2025 The Go Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.package fips140import (_ // for linkname)// WithoutEnforcement disables strict FIPS 140-3 enforcement while executing f.// Calling WithoutEnforcement without strict enforcement enabled// (GODEBUG=fips140=only is not set or already inside of a call to// WithoutEnforcement) is a no-op.//// WithoutEnforcement is inherited by any goroutines spawned while executing f.//// As this disables enforcement, it should be applied carefully to tightly// scoped functions.func ( func()) {if !Enabled() || !Enforced() {()return}setBypass()defer unsetBypass()()}var enabled = godebug.New("fips140").Value() == "only"// Enforced indicates if strict FIPS 140-3 enforcement is enabled. Strict// enforcement is enabled when a program is run with GODEBUG=fips140=only and// enforcement has not been disabled by a call to [WithoutEnforcement].func () bool {return enabled && !isBypassed()}//go:linkname setBypassfunc setBypass()//go:linkname isBypassedfunc isBypassed() bool//go:linkname unsetBypassfunc unsetBypass()
![]() |
The pages are generated with Golds v0.8.3-preview. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |