diff --git a/src/internal/task/task.go b/src/internal/task/task.go index e257e1bc8..55f89fa9f 100644 --- a/src/internal/task/task.go +++ b/src/internal/task/task.go @@ -22,7 +22,8 @@ type Task struct { state state // This is needed for some crypto packages. - FipsIndicator uint8 + FipsIndicator uint8 + FipsOnlyBypass bool // State of the goroutine: running, paused, or must-resume-next-pause. // This extra field doesn't increase memory usage on 32-bit CPUs and above, diff --git a/src/runtime/scheduler.go b/src/runtime/scheduler.go index 9b2557952..847a586be 100644 --- a/src/runtime/scheduler.go +++ b/src/runtime/scheduler.go @@ -67,3 +67,18 @@ func fips_setIndicator(indicator uint8) { // This indicator is stored per goroutine. task.Current().FipsIndicator = indicator } + +//go:linkname fips140_setBypass crypto/fips140.setBypass +func fips140_setBypass() { + task.Current().FipsOnlyBypass = true +} + +//go:linkname fips140_unsetBypass crypto/fips140.unsetBypass +func fips140_unsetBypass() { + task.Current().FipsOnlyBypass = false +} + +//go:linkname fips140_isBypassed crypto/fips140.isBypassed +func fips140_isBypassed() bool { + return task.Current().FipsOnlyBypass +}