$OpenBSD$
--- ext/session/session.c.orig.port	Tue Feb 14 14:51:37 2017
+++ ext/session/session.c	Wed May 24 13:41:47 2017
@@ -47,6 +47,7 @@
 #include "ext/standard/php_lcg.h"
 #include "ext/standard/url_scanner_ex.h"
 #include "ext/standard/php_rand.h" /* for RAND_MAX */
+#include "ext/standard/php_random.h"
 #include "ext/standard/info.h"
 #include "zend_smart_str.h"
 #include "ext/standard/url.h"
@@ -356,12 +357,9 @@ PHPAPI zend_string *php_session_create_id(PS_CREATE_SI
 	efree(buf);
 
 	if (PS(entropy_length) > 0) {
-#ifdef PHP_WIN32
 		unsigned char rbuf[2048];
 		size_t toread = PS(entropy_length);
-
-		if (php_win32_get_random_bytes(rbuf, MIN(toread, sizeof(rbuf))) == SUCCESS){
-
+		if (php_random_bytes_silent(rbuf, MIN(toread, sizeof(rbuf))) == SUCCESS) {
 			switch (PS(hash_func)) {
 				case PS_HASH_FUNC_MD5:
 					PHP_MD5Update(&md5_context, rbuf, toread);
@@ -376,37 +374,6 @@ PHPAPI zend_string *php_session_create_id(PS_CREATE_SI
 # endif /* HAVE_HASH_EXT */
 			}
 		}
-#else
-		int fd;
-
-		fd = VCWD_OPEN(PS(entropy_file), O_RDONLY);
-		if (fd >= 0) {
-			unsigned char rbuf[2048];
-			int n;
-			int to_read = PS(entropy_length);
-
-			while (to_read > 0) {
-				n = read(fd, rbuf, MIN(to_read, sizeof(rbuf)));
-				if (n <= 0) break;
-
-				switch (PS(hash_func)) {
-					case PS_HASH_FUNC_MD5:
-						PHP_MD5Update(&md5_context, rbuf, n);
-						break;
-					case PS_HASH_FUNC_SHA1:
-						PHP_SHA1Update(&sha1_context, rbuf, n);
-						break;
-#if defined(HAVE_HASH_EXT) && !defined(COMPILE_DL_HASH)
-					case PS_HASH_FUNC_OTHER:
-						PS(hash_ops)->hash_update(hash_context, rbuf, n);
-						break;
-#endif /* HAVE_HASH_EXT */
-				}
-				to_read -= n;
-			}
-			close(fd);
-		}
-#endif
 	}
 
 	digest = emalloc(digest_len + 1);
