4 ms·
my theory: trace what can happen if reading from /dev/urandom, etc fails. i think: a) if the RAND_seed has already been called it is possible to fail reading
by benmmurphy 13y ago
my theory:
trace what can happen if reading from /dev/urandom, etc fails.
i think:
a) if the RAND_seed has already been called it is possible to fail reading from /dev/random and not get a subsequent failure from RAND_bytes because RAND_bytes will believe there is enough entropy in the pool. this can happen even if YOU don't explicitly seed the SecureRandom you are using because the state of all SecureRandom instances are shared :)
b) there is this lols method called throwExceptionIfNecessary in the native crypto code. RAND_bytes checks the return code and if the return code is bad it calls throwExceptionIfNecessary. however, throwExceptionIfNecessary does not always throw an exception. there are some conditions where it won't throw an exception (malloc failure...). however, i'm not sure if these conditions are possible on android openssl.
c) sharing of state between forks. not sure if openssl is initialized in zygote before forking.