You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
OpenSSL backend: incorrect RAND_load_file() return value check #18986
OpenSSL documents the return value of RAND_load_file() as
RETURN VALUES
RAND_load_file() returns the number of bytes read or -1 on error.
(from code inspection this happens to be correct).
The error check in php_openssl_load_rand_file() will however interpret an error as success. People relying on seeding the PRNG might therefore proceed without having added any entropy to the pool. These days the RAND(7) of OpenSSL is claimed to be robust enough without explicit seeding, so there should be no security impact to this, but it would probably still be good to fix it since it goes against expectations:
Activity
ndossche commentedon Jun 30, 2025
You appear to be correct, as that's also what my static analyzer inferred (albeit on an older openssl version) (https://raw.githubusercontent.com/csl-ugent/ESSS/refs/heads/main/evaluation/my-openssl-output, CTRL+F for RAND_load_file).
Feel free to open a PR.
ndossche commentedon Jun 30, 2025
Same issue for RAND_write_file btw
Fix phpGH-18986: OpenSSL backend: incorrect RAND_{load,write}_file() …
Fix GH-18986: OpenSSL backend: incorrect RAND_{load,write}_file() ret…
Merge branch 'PHP-8.3' into PHP-8.4
Merge branch 'PHP-8.4'