Changeset 219119 in webkit
- Timestamp:
- Jul 4, 2017, 10:43:18 AM (8 years ago)
- Location:
- trunk/Source/WTF
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r219117 r219119 1 2017-07-04 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 [WTF] Initialize srandom and srand with cryptographically random number 4 https://bugs.webkit.org/show_bug.cgi?id=174123 5 6 Reviewed by Mark Lam. 7 8 Use cryptographically random number instead of current time as a seed. 9 10 * wtf/RandomNumberSeed.h: 11 (WTF::initializeRandomNumberGenerator): 12 1 13 2017-07-04 Joseph Pecoraro <pecoraro@apple.com> 2 14 -
trunk/Source/WTF/wtf/RandomNumberSeed.h
r218594 r219119 29 29 #include <stdlib.h> 30 30 #include <time.h> 31 #include <wtf/CryptographicallyRandomNumber.h> 31 32 32 33 #if HAVE(SYS_TIME_H) … … 48 49 // On Windows we use rand_s which initialises itself 49 50 #elif OS(UNIX) 50 // srandomdev is not guaranteed to exist on linux so we use this poor seed, this should be improved 51 timeval time; 52 gettimeofday(&time, 0); 53 srandom(static_cast<unsigned>(time.tv_usec * getpid())); 51 srandom(cryptographicallyRandomNumber()); 54 52 #else 55 srand( static_cast<unsigned>(time(0)));53 srand(cryptographicallyRandomNumber()); 56 54 #endif 57 55
Note:
See TracChangeset
for help on using the changeset viewer.