12345678910111213141516171819202122232425262728293031 |
- $OpenBSD: suhosin-ext_suhosin_execute_c,v 1.1 2016/06/22 21:18:33 sthen Exp $
- --- ext/suhosin/execute.c.orig.port Mon Feb 1 23:04:02 2016
- +++ ext/suhosin/execute.c Mon Feb 1 23:38:49 2016
- @@ -1312,6 +1312,9 @@ static php_uint32 suhosin_mt_rand(TSRMLS_D)
- */
- static void suhosin_gen_entropy(php_uint32 *entropybuf TSRMLS_DC)
- {
- +#if defined(__OpenBSD__)
- + arc4random_buf(entropybuf, 8 * sizeof(php_uint32));
- +#else
- php_uint32 seedbuf[20];
- /* On a modern OS code, stack and heap base are randomized */
- unsigned long code_value = (unsigned long)suhosin_gen_entropy;
- @@ -1335,7 +1338,7 @@ static void suhosin_gen_entropy(php_uint32 *entropybuf
- #endif
- seedbuf[5] = (php_uint32) 0x7fffffff * php_combined_lcg(TSRMLS_C);
-
- -#ifndef PHP_WIN32
- +#if !defined(PHP_WIN32)
- fd = VCWD_OPEN("/dev/urandom", O_RDONLY);
- if (fd >= 0) {
- /* ignore error case - if urandom doesn't give us any/enough random bytes */
- @@ -1354,6 +1357,7 @@ static void suhosin_gen_entropy(php_uint32 *entropybuf
- suhosin_SHA256Update(&context, (unsigned char*)SUHOSIN_G(seedingkey), strlen(SUHOSIN_G(seedingkey)));
- }
- suhosin_SHA256Final((void *)entropybuf, &context);
- +#endif /* openbsd */
- }
- /* }}} */
-
|