Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rand_unix.c: open random devices on first use only #7437

Closed

Commits on Oct 18, 2018

  1. rand_unix.c: open random devices on first use only

    Commit c7504ae (pr openssl#6432) fixed a regression for applications in
    chroot environments, which compensated the fact that the new OpenSSL CSPRNG
    (based on the NIST DRBG) now reseeds periodically, which the previous
    one didn't. Now the reseeding could fail in the chroot environment if the
    DEVRANDOM devices were not present anymore and no other entropy source
    (e.g. getrandom()) was available.
    
    The solution was to keep the file handles for the DEVRANDOM devices open
    by default. In fact, the fix did more than this, it opened the DEVRANDOM
    devices early and unconditionally in rand_pool_init(), which had the
    unwanted side effect that the devices were opened (and kept open) even
    in cases when they were not used at all, for example when the getrandom()
    system call was available. Due  to a bug (issue openssl#7419) this even happened
    when the feature was disabled by the application.
    
    This commit removes the unconditional opening of all DEVRANDOM devices.
    They will now only be opened (and kept open) on first use. In particular,
    if getrandom() is available, the handles will not be opened unnecessarily.
    
    This change does not introduce a regression for applications compiled for
    libcrypto 1.1.0, because the SSLEAY RNG also seeds on first use. So in the
    above constellation the CSPRNG will only be properly seeded if it is happens
    before the forking and chrooting.
    
    Fixes openssl#7419
    mspncp committed Oct 18, 2018
    Copy the full SHA
    1160f24 View commit details
    Browse the repository at this point in the history