Author vstinner
Recipients jcon, pitrou, vstinner
Date 2011-05-11.20:52:03
SpamBayes Score 7.79522e-05
Marked as misclassified No
Message-id <1305147183.89.0.970992404469.issue12049@psf.upfronthosting.co.za>
In-reply-to
Content
ssl_rand.patch adds RAND_bytes() and RAND_pseudo_bytes() functions to the ssl module.

I moved /dev/urandom to /dev/urandom.xxx and /dev/random to /dev/random.xxx to test RAND_bytes() error path. In this case, RAND_pseudo_bytes() generates non-cryptographic pseudo-random bytes.

RAND_pseudo_bytes() returns a tuple (bytes, is_cryptographic).

In test_ssl, I used the assertion that RAND_pseudo_bytes() only generates cryptographic numbers if RAND_status() is 1. If the assertion is wrong, the test can be changed to just test the type of is_crytographic.

RAND_bytes() and RAND_pseudo_bytes() raise a SSLError on error using ERR_get_errno() as the error code, whereas other ssl functions uses a value of the py_ssl_error enum. I don't know if it is the good choise.
History
Date User Action Args
2011-05-11 20:53:04vstinnersetrecipients: + vstinner, pitrou, jcon
2011-05-11 20:53:03vstinnersetmessageid: <1305147183.89.0.970992404469.issue12049@psf.upfronthosting.co.za>
2011-05-11 20:52:03vstinnerlinkissue12049 messages
2011-05-11 20:52:03vstinnercreate