core/crypto: Add a HAS_RAND_BYTES constant

This commit is contained in:
Yawning Angel
2024-04-23 11:47:43 +09:00
parent 902e877467
commit a6eb64df6c
8 changed files with 24 additions and 31 deletions
+3 -4
View File
@@ -3,14 +3,13 @@ package crypto
foreign import libc "system:c"
HAS_RAND_BYTES :: true
foreign libc {
arc4random_buf :: proc(buf: [^]byte, nbytes: uint) ---
}
@(private)
_rand_bytes :: proc(dst: []byte) {
arc4random_buf(raw_data(dst), len(dst))
}
_has_rand_bytes :: proc() -> bool {
return true
}