Issue #21356: Make ssl.RAND_egd() optional to support LibreSSL. The

availability of the function is checked during the compilation.

Patch written by Bernard Spil.
This commit is contained in:
Victor Stinner 2014-11-28 13:28:25 +01:00
parent 07ff92a0d2
commit beeb512fe1
7 changed files with 65 additions and 3 deletions

View file

@ -3713,6 +3713,7 @@ Returns 1 if the OpenSSL PRNG has been seeded with enough data and 0 if not.\n\
It is necessary to seed the PRNG with RAND_add() on some platforms before\n\
using the ssl() function.");
#ifdef HAVE_RAND_EGD
static PyObject *
PySSL_RAND_egd(PyObject *self, PyObject *args)
{
@ -3740,6 +3741,7 @@ PyDoc_STRVAR(PySSL_RAND_egd_doc,
Queries the entropy gather daemon (EGD) on the socket named by 'path'.\n\
Returns number of bytes read. Raises SSLError if connection to EGD\n\
fails or if it does not provide enough data to seed PRNG.");
#endif /* HAVE_RAND_EGD */
#endif /* HAVE_OPENSSL_RAND */
@ -4135,8 +4137,10 @@ static PyMethodDef PySSL_methods[] = {
PySSL_RAND_bytes_doc},
{"RAND_pseudo_bytes", PySSL_RAND_pseudo_bytes, METH_VARARGS,
PySSL_RAND_pseudo_bytes_doc},
#ifdef HAVE_RAND_EGD
{"RAND_egd", PySSL_RAND_egd, METH_VARARGS,
PySSL_RAND_egd_doc},
#endif
{"RAND_status", (PyCFunction)PySSL_RAND_status, METH_NOARGS,
PySSL_RAND_status_doc},
#endif