// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build goexperiment.runtimesecret
+
// Note: this assembly file is used for testing only.
// We need to access registers directly to properly test
// that secrets are erased and go test doesn't like to conditionally
// registers contain secrets.
// It also tests the path from G stack to M stack
// to scheduler and back.
- CALL ·delay(SB)
+ CALL runtime∕secret·delay(SB)
RET
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build goexperiment.runtimesecret
+
// Note: this assembly file is used for testing only.
// We need to access registers directly to properly test
// that secrets are erased and go test doesn't like to conditionally
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build arm64 || amd64
+//go:build goexperiment.runtimesecret && (arm64 || amd64)
// testing stubs, these are implemented in assembly in
// asm_$GOARCH.s
//
//go:noescape
func useSecret(secret []byte)
+
+// callback from assembly
+func delay() {
+ sleep(1_000_000)
+}
+
+// linknamed to avoid package importing time
+// for just testing code
+//
+//go:linkname sleep time.Sleep
+func sleep(int64)
"weak"
)
-// callback from assembly
-//
-//go:linkname delay main.delay
-func delay() {
- time.Sleep(1 * time.Millisecond)
-}
-
// Same secret as in ../../crash_test.go
var secretStore = [8]byte{
0x00,