mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-26 07:25:00 -07:00
b155fdf8c9
This allows runtime detection as to if `rand_bytes` is supported or not, and lets us enable the test-case on all of the supported targets.
17 lines
279 B
Odin
17 lines
279 B
Odin
//+build freebsd, openbsd
|
|
package crypto
|
|
|
|
foreign import libc "system:c"
|
|
|
|
foreign libc {
|
|
arc4random_buf :: proc(buf: [^]byte, nbytes: uint) ---
|
|
}
|
|
|
|
_rand_bytes :: proc(dst: []byte) {
|
|
arc4random_buf(raw_data(dst), len(dst))
|
|
}
|
|
|
|
_has_rand_bytes :: proc () -> bool {
|
|
return true
|
|
}
|