crypto:rand_bytes using deprecated function

David Whitlock <[email protected]> Thu, 8 Oct 2015 09:42:25 +0700
Newsgroups gmane.comp.lang.erlang.general,gmane.comp.lang.erlang.bugs
Message-ID <CAEwXPVNVXaN-dGdRkore3x0hQF=at_ADRMCSEHR6JWYudGgdww@mail.gmail.com>
Hi,

The rand_bytes function in the crypto module is using the openssl
RAND_pseudo_bytes
function, which is deprecated.

This raises three issues / questions:


   1. Should he function rand_bytes be deprecated?
   2. Should the documentation state that it should not be used for
   cryptographic purposes (this is the openssl recommendation)?
   3. In otp/lib/ssl/src/ssl.erl (starting line 595) and in
otp/lib/crypto/src/crypto.erl
   (starting line 643) there are functions which fall back to rand_bytes if
   strong_rand_bytes cannot be used. It is therefore possible that rand_bytes
   might be used to generate keys. Should these functions return an error
   instead?

If you need any more info, please let me know,

David Whitlock