1 //go:build baremetal || wasip1 || wasm_unknown || wasip2 || nintendoswitch || (!darwin && !linux)
2 3 package runtime
4 5 import (
6 "internal/gclayout"
7 "unsafe"
8 )
9 10 // isSecurePtr stub for platforms without the secure allocator. Always returns
11 // false so the runtime comparison path takes the fast (non-constant-time)
12 // branch. On these targets SecureAlloc itself is unavailable; any code that
13 // relies on constant-time compare must either run on a platform with the
14 // secalloc machinery or perform the compare explicitly via
15 // crypto/subtle.ConstantTimeCompare.
16 func isSecurePtr(ptr unsafe.Pointer) bool {
17 return false
18 }
19 20 // secureAwareByteAlloc stub: secure is always false on these platforms
21 // (isSecurePtr never returns true), so callers will only ever hit the heap
22 // path. Preserved symbol shape so bytesConcat can call it unconditionally.
23 func secureAwareByteAlloc(n uintptr, secure bool) []byte {
24 buf := alloc(n, gclayout.NoPtrs.AsPtr())
25 return unsafe.Slice((*byte)(buf), n)
26 }
27