mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Worked with Samy Kamkar to improve LCG entropy.
This commit is contained in:
parent
679b228391
commit
58867bacc1
2 changed files with 7 additions and 1 deletions
1
NEWS
1
NEWS
|
@ -7,6 +7,7 @@ PHP NEWS
|
|||
- Added missing host validation for HTTP urls inside FILTER_VALIDATE_URL.
|
||||
(Ilia)
|
||||
- Added stream_resolve_include_path(). (Mikko)
|
||||
- Improved LCG entropy (Rasmus, Samy Kamkar)
|
||||
|
||||
- Fixed bug #50680 (strtotime() does not support eighth ordinal number).
|
||||
(Ilia)
|
||||
|
|
|
@ -78,7 +78,7 @@ static void lcg_seed(TSRMLS_D) /* {{{ */
|
|||
struct timeval tv;
|
||||
|
||||
if (gettimeofday(&tv, NULL) == 0) {
|
||||
LCG(s1) = tv.tv_sec ^ (~tv.tv_usec);
|
||||
LCG(s1) = tv.tv_sec ^ (tv.tv_usec<<11);
|
||||
} else {
|
||||
LCG(s1) = 1;
|
||||
}
|
||||
|
@ -88,6 +88,11 @@ static void lcg_seed(TSRMLS_D) /* {{{ */
|
|||
LCG(s2) = (long) getpid();
|
||||
#endif
|
||||
|
||||
/* Add entropy to s2 by calling gettimeofday() again */
|
||||
if (gettimeofday(&tv, NULL) == 0) {
|
||||
LCG(s2) ^= (tv.tv_usec<<11);
|
||||
}
|
||||
|
||||
LCG(seeded) = 1;
|
||||
}
|
||||
/* }}} */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue