Commit c53ea27
committed
Improve openssl_random_pseudo_bytes()
CSPRNG implementations should always fail closed. Now
openssl_random_pseudo_bytes() will fail closed by throwing an
`\Exception` if it is unable to return crypto-strong bytes.
The second `$crypto_strong` parameter doesn't do anything despite the
docs stating otherwise. This unnecessarily confusing parameter is now
deprecated and will be removed in PHP 8.0.
In addition to removing the second parameter in 8.0, the ZPP macros will
be updated to `ZEND_PARSE_PARAMS_THROW` so passing a second argument
will cause a fatal error.1 parent 3fe698b commit c53ea27
File tree
3 files changed
+34
-21
lines changed- ext/openssl
- tests
3 files changed
+34
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
6801 | 6802 | | |
6802 | 6803 | | |
6803 | 6804 | | |
6804 | | - | |
6805 | | - | |
6806 | | - | |
| 6805 | + | |
| 6806 | + | |
| 6807 | + | |
| 6808 | + | |
| 6809 | + | |
6807 | 6810 | | |
6808 | 6811 | | |
6809 | 6812 | | |
6810 | | - | |
| 6813 | + | |
| 6814 | + | |
6811 | 6815 | | |
6812 | 6816 | | |
6813 | 6817 | | |
6814 | 6818 | | |
6815 | 6819 | | |
6816 | 6820 | | |
6817 | 6821 | | |
6818 | | - | |
| 6822 | + | |
| 6823 | + | |
6819 | 6824 | | |
6820 | 6825 | | |
6821 | 6826 | | |
6822 | 6827 | | |
6823 | 6828 | | |
6824 | 6829 | | |
6825 | 6830 | | |
6826 | | - | |
6827 | | - | |
6828 | | - | |
6829 | | - | |
| 6831 | + | |
| 6832 | + | |
6830 | 6833 | | |
6831 | 6834 | | |
6832 | 6835 | | |
| |||
6835 | 6838 | | |
6836 | 6839 | | |
6837 | 6840 | | |
6838 | | - | |
6839 | | - | |
6840 | | - | |
6841 | | - | |
| 6841 | + | |
| 6842 | + | |
6842 | 6843 | | |
6843 | 6844 | | |
6844 | 6845 | | |
6845 | 6846 | | |
6846 | 6847 | | |
6847 | 6848 | | |
6848 | 6849 | | |
6849 | | - | |
6850 | | - | |
6851 | | - | |
6852 | | - | |
6853 | 6850 | | |
6854 | 6851 | | |
6855 | 6852 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
| 7 | + | |
| 8 | + | |
9 | 9 | | |
10 | | - | |
11 | 10 | | |
12 | 11 | | |
13 | | - | |
14 | 12 | | |
15 | 13 | | |
16 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
0 commit comments