Commit graph

9 commits

Author SHA1 Message Date
Max Semenik
ff2804804f Hard deprecate functionality replaced with random_bytes()
Deprecated in 1.32, no callers.

Change-Id: Id2d59c303fd60fab2b323af6cab137fdf74b5377
2018-10-17 19:57:52 -07:00
Max Semenik
9bab7de5f8 Clean up CSPRNG support for PHP7
Replace it all with random_bytes(), leave
only MWCryptRand::generateHex() as a convenience helper.

Change-Id: Ic30376a90e66d8f00dab86e7e6466fb3a750b87d
2018-06-10 00:52:04 +00:00
Reedy
21551d2d15 Reduce some nesting in CryptRand.php
Change-Id: Ic0b7307d66f877a5b1df974f34846857084dc23a
2018-04-18 12:21:18 +00:00
Reedy
39f0f919c5 Update suppressWarning()/restoreWarning() calls
Bug: T182273
Change-Id: I9e1b628fe5949ca54258424c2e45b2fb6d491d0f
2018-02-10 08:50:12 +00:00
Umherirrender
b5cddfb27b Remove empty lines at begin of function, if, foreach, switch
Organize phpcs.xml a bit

Change-Id: Ifb767729b481b4b686e6d6444cf48b1f580cc478
2017-07-01 11:34:16 +00:00
Derk-Jan Hartman
9272d7717d CryptRand: only use random_bytes on php 7 and HHVM
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
2017-05-26 14:31:55 +02:00
Derk-Jan Hartman
453e829ce0 Add support for PHP7 random_bytes in favor of mcrypt_create_iv
Bug: T143788
Change-Id: Ib49eab7983a82966d167f03761e32461f9b9f602
2016-12-02 13:48:19 +01:00
Antoine Musso
eab0c94902 CryptRand: remove newlines from logging message
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
2016-11-10 15:33:23 +01:00
Kunal Mehta
5bd6de67e3 Move most of MWCryptRand into libs
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
2016-10-04 05:50:36 +00:00