summaryrefslogtreecommitdiff
path: root/execute_rnd.inc.c
diff options
context:
space:
mode:
authorBen Fuhrmannek2016-02-22 13:23:16 +0100
committerBen Fuhrmannek2016-02-22 13:23:16 +0100
commit759139184a4e322c561de889484f7de3d181756f (patch)
tree34f0ceac20058b7f96c003be588c5c7c40bade75 /execute_rnd.inc.c
parente668d3495dce6e33855266fc830fc27b1a003689 (diff)
removed TSRMLS
Diffstat (limited to 'execute_rnd.inc.c')
-rw-r--r--execute_rnd.inc.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/execute_rnd.inc.c b/execute_rnd.inc.c
index c09c467..9647b63 100644
--- a/execute_rnd.inc.c
+++ b/execute_rnd.inc.c
@@ -134,7 +134,7 @@ static inline void suhosin_mt_reload(php_uint32 *state, php_uint32 **next, int *
134 134
135/* {{{ suhosin_mt_srand 135/* {{{ suhosin_mt_srand
136 */ 136 */
137static void suhosin_mt_srand(php_uint32 seed TSRMLS_DC) 137static void suhosin_mt_srand(php_uint32 seed)
138{ 138{
139 /* Seed the generator with a simple uint32 */ 139 /* Seed the generator with a simple uint32 */
140 suhosin_mt_initialize(seed, SUHOSIN7_G(mt_state)); 140 suhosin_mt_initialize(seed, SUHOSIN7_G(mt_state));
@@ -147,7 +147,7 @@ static void suhosin_mt_srand(php_uint32 seed TSRMLS_DC)
147 147
148/* {{{ suhosin_mt_rand 148/* {{{ suhosin_mt_rand
149 */ 149 */
150static php_uint32 suhosin_mt_rand(TSRMLS_D) 150static php_uint32 suhosin_mt_rand()
151{ 151{
152 /* Pull a 32-bit integer from the generator state 152 /* Pull a 32-bit integer from the generator state
153 Every other access function simply transforms the numbers extracted here */ 153 Every other access function simply transforms the numbers extracted here */
@@ -169,7 +169,7 @@ static php_uint32 suhosin_mt_rand(TSRMLS_D)
169 169
170/* {{{ SUHOSIN7_Gen_entropy 170/* {{{ SUHOSIN7_Gen_entropy
171 */ 171 */
172static void SUHOSIN7_Gen_entropy(php_uint32 *entropybuf TSRMLS_DC) 172static void SUHOSIN7_Gen_entropy(php_uint32 *entropybuf)
173{ 173{
174 php_uint32 seedbuf[20]; 174 php_uint32 seedbuf[20];
175 /* On a modern OS code, stack and heap base are randomized */ 175 /* On a modern OS code, stack and heap base are randomized */
@@ -192,7 +192,7 @@ static void SUHOSIN7_Gen_entropy(php_uint32 *entropybuf TSRMLS_DC)
192#else 192#else
193 seedbuf[4] = getpid(); 193 seedbuf[4] = getpid();
194#endif 194#endif
195 seedbuf[5] = (php_uint32) 0x7fffffff * php_combined_lcg(TSRMLS_C); 195 seedbuf[5] = (php_uint32) 0x7fffffff * php_combined_lcg();
196 196
197#ifndef PHP_WIN32 197#ifndef PHP_WIN32
198 fd = VCWD_OPEN("/dev/urandom", O_RDONLY); 198 fd = VCWD_OPEN("/dev/urandom", O_RDONLY);
@@ -219,10 +219,10 @@ static void SUHOSIN7_Gen_entropy(php_uint32 *entropybuf TSRMLS_DC)
219 219
220/* {{{ suhosin_srand_auto 220/* {{{ suhosin_srand_auto
221 */ 221 */
222static void suhosin_srand_auto(TSRMLS_D) 222static void suhosin_srand_auto()
223{ 223{
224 php_uint32 seed[8]; 224 php_uint32 seed[8];
225 SUHOSIN7_Gen_entropy(&seed[0] TSRMLS_CC); 225 SUHOSIN7_Gen_entropy(&seed[0]);
226 226
227 suhosin_mt_init_by_array(seed, 8, SUHOSIN7_G(r_state)); 227 suhosin_mt_init_by_array(seed, 8, SUHOSIN7_G(r_state));
228 suhosin_mt_reload(SUHOSIN7_G(r_state), &SUHOSIN7_G(r_next), &SUHOSIN7_G(r_left)); 228 suhosin_mt_reload(SUHOSIN7_G(r_state), &SUHOSIN7_G(r_next), &SUHOSIN7_G(r_left));
@@ -234,10 +234,10 @@ static void suhosin_srand_auto(TSRMLS_D)
234 234
235/* {{{ suhosin_mt_srand_auto 235/* {{{ suhosin_mt_srand_auto
236 */ 236 */
237static void suhosin_mt_srand_auto(TSRMLS_D) 237static void suhosin_mt_srand_auto()
238{ 238{
239 php_uint32 seed[8]; 239 php_uint32 seed[8];
240 SUHOSIN7_Gen_entropy(&seed[0] TSRMLS_CC); 240 SUHOSIN7_Gen_entropy(&seed[0]);
241 241
242 suhosin_mt_init_by_array(seed, 8, SUHOSIN7_G(mt_state)); 242 suhosin_mt_init_by_array(seed, 8, SUHOSIN7_G(mt_state));
243 suhosin_mt_reload(SUHOSIN7_G(mt_state), &SUHOSIN7_G(mt_next), &SUHOSIN7_G(mt_left)); 243 suhosin_mt_reload(SUHOSIN7_G(mt_state), &SUHOSIN7_G(mt_next), &SUHOSIN7_G(mt_left));
@@ -250,7 +250,7 @@ static void suhosin_mt_srand_auto(TSRMLS_D)
250 250
251/* {{{ suhosin_srand 251/* {{{ suhosin_srand
252 */ 252 */
253static void suhosin_srand(php_uint32 seed TSRMLS_DC) 253static void suhosin_srand(php_uint32 seed)
254{ 254{
255 /* Seed the generator with a simple uint32 */ 255 /* Seed the generator with a simple uint32 */
256 suhosin_mt_initialize(seed+0x12345, SUHOSIN7_G(r_state)); 256 suhosin_mt_initialize(seed+0x12345, SUHOSIN7_G(r_state));
@@ -263,7 +263,7 @@ static void suhosin_srand(php_uint32 seed TSRMLS_DC)
263 263
264/* {{{ suhosin_mt_rand 264/* {{{ suhosin_mt_rand
265 */ 265 */
266static php_uint32 suhosin_rand(TSRMLS_D) 266static php_uint32 suhosin_rand()
267{ 267{
268 /* Pull a 32-bit integer from the generator state 268 /* Pull a 32-bit integer from the generator state
269 Every other access function simply transforms the numbers extracted here */ 269 Every other access function simply transforms the numbers extracted here */
@@ -293,14 +293,14 @@ static int ih_srand(IH_HANDLER_PARAMS)
293 return 1; 293 return 1;
294 } 294 }
295 295
296 if (zend_parse_parameters(argc TSRMLS_CC, "|l", &seed) == FAILURE) { 296 if (zend_parse_parameters(argc, "|l", &seed) == FAILURE) {
297 return 1; 297 return 1;
298 } 298 }
299 299
300 if (argc) { 300 if (argc) {
301 suhosin_srand(seed TSRMLS_CC); 301 suhosin_srand(seed);
302 } else { 302 } else {
303 suhosin_srand_auto(TSRMLS_C); 303 suhosin_srand_auto();
304 } 304 }
305 return (1); 305 return (1);
306} 306}
@@ -315,14 +315,14 @@ static int ih_mt_srand(IH_HANDLER_PARAMS)
315 return 1; 315 return 1;
316 } 316 }
317 317
318 if (zend_parse_parameters(argc TSRMLS_CC, "|l", &seed) == FAILURE) { 318 if (zend_parse_parameters(argc, "|l", &seed) == FAILURE) {
319 return 1; 319 return 1;
320 } 320 }
321 321
322 if (argc) { 322 if (argc) {
323 suhosin_mt_srand(seed TSRMLS_CC); 323 suhosin_mt_srand(seed);
324 } else { 324 } else {
325 suhosin_mt_srand_auto(TSRMLS_C); 325 suhosin_mt_srand_auto();
326 } 326 }
327 return 1; 327 return 1;
328} 328}
@@ -334,15 +334,15 @@ static int ih_mt_rand(IH_HANDLER_PARAMS)
334 long max; 334 long max;
335 long number; 335 long number;
336 336
337 if (argc != 0 && zend_parse_parameters(argc TSRMLS_CC, "ll", &min, &max) == FAILURE) { 337 if (argc != 0 && zend_parse_parameters(argc, "ll", &min, &max) == FAILURE) {
338 return (1); 338 return (1);
339 } 339 }
340 340
341 if (!SUHOSIN7_G(mt_is_seeded)) { 341 if (!SUHOSIN7_G(mt_is_seeded)) {
342 suhosin_mt_srand_auto(TSRMLS_C); 342 suhosin_mt_srand_auto();
343 } 343 }
344 344
345 number = (long) (suhosin_mt_rand(TSRMLS_C) >> 1); 345 number = (long) (suhosin_mt_rand() >> 1);
346 if (argc == 2) { 346 if (argc == 2) {
347 RAND_RANGE(number, min, max, PHP_MT_RAND_MAX); 347 RAND_RANGE(number, min, max, PHP_MT_RAND_MAX);
348 } 348 }
@@ -358,15 +358,15 @@ static int ih_rand(IH_HANDLER_PARAMS)
358 long max; 358 long max;
359 long number; 359 long number;
360 360
361 if (argc != 0 && zend_parse_parameters(argc TSRMLS_CC, "ll", &min, &max) == FAILURE) { 361 if (argc != 0 && zend_parse_parameters(argc, "ll", &min, &max) == FAILURE) {
362 return (1); 362 return (1);
363 } 363 }
364 364
365 if (!SUHOSIN7_G(r_is_seeded)) { 365 if (!SUHOSIN7_G(r_is_seeded)) {
366 suhosin_srand_auto(TSRMLS_C); 366 suhosin_srand_auto();
367 } 367 }
368 368
369 number = (long) (suhosin_rand(TSRMLS_C) >> 1); 369 number = (long) (suhosin_rand() >> 1);
370 if (argc == 2) { 370 if (argc == 2) {
371 RAND_RANGE(number, min, max, PHP_MT_RAND_MAX); 371 RAND_RANGE(number, min, max, PHP_MT_RAND_MAX);
372 } 372 }