initial OpenBSD support

This commit is contained in:
Sébastien Marie
2022-02-25 08:49:25 +00:00
parent 3a469dc13e
commit 5676c9e7eb
30 changed files with 1151 additions and 27 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
package crypto
when ODIN_OS != .Linux {
when ODIN_OS != .Linux && ODIN_OS != .OpenBSD {
_rand_bytes :: proc (dst: []byte) {
unimplemented("crypto: rand_bytes not supported on this OS")
}
+12
View File
@@ -0,0 +1,12 @@
package crypto
import "core:c"
foreign import libc "system:c"
foreign libc {
arc4random_buf :: proc "c" (buf: rawptr, nbytes: c.size_t) ---
}
_rand_bytes :: proc (dst: []byte) {
arc4random_buf(raw_data(dst), len(dst))
}