mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-22 13:29:01 +00:00
runtime: add FIPS helper functions
Not entirely sure what they're for, but the Go runtime also stores this information per goroutine so let's go with that.
This commit is contained in:
committed by
Ron Evans
parent
a1be8cd9fe
commit
07c7eff3c3
@@ -21,6 +21,9 @@ type Task struct {
|
|||||||
// state is the underlying running state of the task.
|
// state is the underlying running state of the task.
|
||||||
state state
|
state state
|
||||||
|
|
||||||
|
// This is needed for some crypto packages.
|
||||||
|
FipsIndicator uint8
|
||||||
|
|
||||||
// DeferFrame stores a pointer to the (stack allocated) defer frame of the
|
// DeferFrame stores a pointer to the (stack allocated) defer frame of the
|
||||||
// goroutine that is used for the recover builtin.
|
// goroutine that is used for the recover builtin.
|
||||||
DeferFrame unsafe.Pointer
|
DeferFrame unsafe.Pointer
|
||||||
|
|||||||
@@ -226,3 +226,8 @@ func divideByZeroPanic() {
|
|||||||
func blockingPanic() {
|
func blockingPanic() {
|
||||||
runtimePanicAt(returnAddress(0), "trying to do blocking operation in exported function")
|
runtimePanicAt(returnAddress(0), "trying to do blocking operation in exported function")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//go:linkname fips_fatal crypto/internal/fips140.fatal
|
||||||
|
func fips_fatal(msg string) {
|
||||||
|
runtimePanic(msg)
|
||||||
|
}
|
||||||
|
|||||||
@@ -31,3 +31,14 @@ func scheduleLogChan(msg string, ch *channel, t *task.Task) {
|
|||||||
func Goexit() {
|
func Goexit() {
|
||||||
panicOrGoexit(nil, panicGoexit)
|
panicOrGoexit(nil, panicGoexit)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//go:linkname fips_getIndicator crypto/internal/fips140.getIndicator
|
||||||
|
func fips_getIndicator() uint8 {
|
||||||
|
return task.Current().FipsIndicator
|
||||||
|
}
|
||||||
|
|
||||||
|
//go:linkname fips_setIndicator crypto/internal/fips140.setIndicator
|
||||||
|
func fips_setIndicator(indicator uint8) {
|
||||||
|
// This indicator is stored per goroutine.
|
||||||
|
task.Current().FipsIndicator = indicator
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user