sysrng-linux: re-open /dev/urandom every time
Prompted by the following comment by @dueno:
I also wonder why we keep the fd open for such a long time in the first place. Both OpenSSL and NSS have a similar fallback to /dev/urandom if getrandom is not available, but opens the device in one-shot, when reseeding is needed (and that's pretty rare).
I thought that could be easier to switch to such one-shot opening
than to resurrect and fix tests/init_fds.c
.
I'm not exactly sure about all the benefits and drawbacks of going that way though, so, please, treat that as a suggestion, not a request.
Fixes: #1188 (closed)
Checklist
-
Commits have Signed-off-by:
with name/author being identical to the commit author -
Code modified for feature -
Test suite updated with functionality tests -
Test suite updated with negative tests -
Documentation updated / NEWS entry present (for non-trivial changes) -
CI timeout is 2h or higher (see Settings/CICD/General pipelines/Timeout)
Reviewer's checklist:
-
Any issues marked for closing are addressed -
There is a test suite reasonably covering new functionality or modifications -
Function naming, parameters, return values, types, etc., are consistent and according to CONTRIBUTION.md
-
This feature/change has adequate documentation added -
No obvious mistakes in the code
Edited by Daiki Ueno