core/crypto: Add has_rand_bytes

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.
This commit is contained in:
Yawning Angel
2024-03-17 10:29:59 +09:00
parent a43a5b053c
commit b155fdf8c9
8 changed files with 35 additions and 1 deletions

View File

@@ -347,7 +347,7 @@ test_x25519 :: proc(t: ^testing.T) {
test_rand_bytes :: proc(t: ^testing.T) {
tc.log(t, "Testing rand_bytes")
if ODIN_OS != .Linux {
if !crypto.has_rand_bytes() {
tc.log(t, "rand_bytes not supported - skipping")
return
}