Replace it all with random_bytes(), leave
only MWCryptRand::generateHex() as a convenience helper.
Change-Id: Ic30376a90e66d8f00dab86e7e6466fb3a750b87d
This avoids random_bytes polyfills used on older versions of PHP or
HHVM. HHVM has had random_bytes longer than PHP so treat it separately.
Bug: T143788
Change-Id: Ic9e511ccc043d50e0a9051cdfe069c27e4f4c339
5bd6de6 converted CryptRand to use the logger command but kept the
newlines in the message which is needed for wfDebug() but not with the
logger interface.
Patch also removed a call to wfGetAllCallers() from the first debug
message of generate(), leaving an uneeded debugging message.
Hence we had output such as:
---
[CryptRand] Generating cryptographic random bytes for
[CryptRand] mcrypt_create_iv generated 20 bytes of randomness.
[CryptRand] 0 bytes of randomness leftover in the buffer.
---
Drop the newlines from all debug message.
Drop the lonely debug message from generate().
Result:
---
[CryptRand] mcrypt_create_iv generated 20 bytes of randomness.
[CryptRand] 0 bytes of randomness leftover in the buffer.
---
Change-Id: I572206296fc3a0a498febb18925672a67480eb18
Dependency-inject the MW-specific parts of MWCryptRand via
MediaWikiServices into a generic CryptRand class that is in libs/.
Note that this removes the wfGetAllCallers() debug logging from
generate().
Change-Id: I9742735c266ee69fb247199d3c553cd2ad2a3987