mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-07 16:18:52 +00:00
use Security.framework with SecRandomCopyBytes for rand_bytes on darwin
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
package crypto
|
||||
|
||||
import "core:fmt"
|
||||
import "core:sys/darwin"
|
||||
|
||||
_rand_bytes :: proc(dst: []byte) {
|
||||
res := darwin.SecRandomCopyBytes(count=len(dst), bytes=raw_data(dst))
|
||||
if res != .Success {
|
||||
panic(fmt.tprintf("crypto/rand_bytes: SecRandomCopyBytes returned non-zero result: %v", res))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user