Hi,

Attached is a patch that FreeBSD has been applying to CHICKEN in their
tree [1].  It was pointed out by gahr in #chicken.

I haven't tested it myself.

[1] 
https://svnweb.freebsd.org/ports/head/lang/chicken5/files/patch-runtime.c?revision=478932&view=markup

All the best.
Mario
-- 
http://parenteses.org/mario
>From 6b197660a553211919c0b2281333041e48b3b042 Mon Sep 17 00:00:00 2001
From: Mario Domenech Goulart <[email protected]>
Date: Fri, 10 May 2019 19:50:53 +0200
Subject: [PATCH] Use arc4random on FreeBSD

Patch by Tobias Kortkamp. Source
https://svnweb.freebsd.org/ports/head/lang/chicken5/files/patch-runtime.c?revision=478932&view=co

This patch was pointed out by gahr in #chicken.
---
 NEWS      | 4 ++++
 runtime.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index c37366f2..7b3a9790 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+5.0.3
+- Runtime system
+  - Use arc4random on FreeBSD (thanks to Tobias Kortkamp and gahr)
+
 5.0.2
 
 - Core libraries
diff --git a/runtime.c b/runtime.c
index 5638df55..55a7aa32 100644
--- a/runtime.c
+++ b/runtime.c
@@ -13286,7 +13286,7 @@ C_word C_random_bytes(C_word buf, C_word size)
   int r = 0;
   int off = 0;
 
-#ifdef __OpenBSD__
+#if defined(__OpenBSD__) || defined(__FreeBSD__)
   arc4random_buf(C_data_pointer(buf), count);
 #elif defined(SYS_getrandom) && defined(__NR_getrandom)
   static int use_urandom = 0;
-- 
2.11.0

_______________________________________________
Chicken-hackers mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/chicken-hackers

Reply via email to