Merge branch 'master' into netbsd

This commit is contained in:
Andreas T Jonsson
2024-04-25 22:04:40 +02:00
111 changed files with 6783 additions and 922 deletions
+1 -1
View File
@@ -11,6 +11,6 @@ _rand_bytes :: proc(dst: []byte) {
arc4random_buf(raw_data(dst), len(dst))
}
_has_rand_bytes :: proc () -> bool {
_has_rand_bytes :: proc() -> bool {
return true
}
+8 -6
View File
@@ -1,16 +1,18 @@
package crypto
import "core:fmt"
import "core:sys/darwin"
import CF "core:sys/darwin/CoreFoundation"
import Sec "core:sys/darwin/Security"
_rand_bytes :: proc(dst: []byte) {
res := darwin.SecRandomCopyBytes(count=len(dst), bytes=raw_data(dst))
if res != .Success {
msg := darwin.CFStringCopyToOdinString(darwin.SecCopyErrorMessageString(res))
panic(fmt.tprintf("crypto/rand_bytes: SecRandomCopyBytes returned non-zero result: %v %s", res, msg))
err := Sec.RandomCopyBytes(count=len(dst), bytes=raw_data(dst))
if err != .Success {
msg := CF.StringCopyToOdinString(Sec.CopyErrorMessageString(err))
panic(fmt.tprintf("crypto/rand_bytes: SecRandomCopyBytes returned non-zero result: %v %s", err, msg))
}
}
_has_rand_bytes :: proc () -> bool {
_has_rand_bytes :: proc() -> bool {
return true
}
+1 -1
View File
@@ -11,6 +11,6 @@ _rand_bytes :: proc(dst: []byte) {
unimplemented("crypto: rand_bytes not supported on this OS")
}
_has_rand_bytes :: proc () -> bool {
_has_rand_bytes :: proc() -> bool {
return false
}
+1 -1
View File
@@ -19,6 +19,6 @@ _rand_bytes :: proc(dst: []byte) {
}
}
_has_rand_bytes :: proc () -> bool {
_has_rand_bytes :: proc() -> bool {
return true
}
+1 -1
View File
@@ -35,6 +35,6 @@ _rand_bytes :: proc (dst: []byte) {
}
}
_has_rand_bytes :: proc () -> bool {
_has_rand_bytes :: proc() -> bool {
return true
}
+1 -1
View File
@@ -22,6 +22,6 @@ _rand_bytes :: proc(dst: []byte) {
}
}
_has_rand_bytes :: proc () -> bool {
_has_rand_bytes :: proc() -> bool {
return true
}