$OpenBSD: patch-src_utils_os_unix_c,v 1.1 2019/11/19 14:35:59 sthen Exp $

Index: src/utils/os_unix.c
--- src/utils/os_unix.c.orig
+++ src/utils/os_unix.c
@@ -257,22 +257,11 @@ int os_get_random(unsigned char *buf, size_t len)
 		buf[i] = i & 0xff;
 	return 0;
 #else /* TEST_FUZZ */
-	FILE *f;
-	size_t rc;
-
 	if (TEST_FAIL())
 		return -1;
 
-	f = fopen("/dev/urandom", "rb");
-	if (f == NULL) {
-		printf("Could not open /dev/urandom.\n");
-		return -1;
-	}
-
-	rc = fread(buf, 1, len, f);
-	fclose(f);
-
-	return rc != len ? -1 : 0;
+	arc4random_buf(buf, len);
+	return 0;
 #endif /* TEST_FUZZ */
 }
 
