Source file src/internal/syscall/unix/arc4random_openbsd.go
1 // Copyright 2024 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package unix 6 7 import ( 8 "internal/abi" 9 "syscall" 10 "unsafe" 11 ) 12 13 //go:linkname syscall_syscall syscall.syscall 14 func syscall_syscall(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) 15 16 //go:cgo_import_dynamic libc_arc4random_buf arc4random_buf "libc.so" 17 18 func libc_arc4random_buf_trampoline() 19 20 func ARC4Random(p []byte) { 21 syscall_syscall(abi.FuncPCABI0(libc_arc4random_buf_trampoline), 22 uintptr(unsafe.Pointer(unsafe.SliceData(p))), uintptr(len(p)), 0) 23 } 24