Skip to content

Commit 13324e1

Browse files
committed
Reverting Moshe's EGD patch *and* Martin's patch to make it work with
OpenSSL versions beore 0.9.5. This just is too experimental to be worth it, especially since the user would have to do some severe hacking of the Modules/Setup file to even enable the EGD code, and without the EGD code it would always spit out a warning on some systems -- even when socket.ssl() is not used. Fixing that properly is not my job; the EGD patch is clearly not so important that it should hold up the 2.1 release.
1 parent e04eaec commit 13324e1

1 file changed

Lines changed: 0 additions & 34 deletions

File tree

Modules/socketmodule.c

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -194,14 +194,6 @@ Socket methods:
194194
#include "openssl/pem.h"
195195
#include "openssl/ssl.h"
196196
#include "openssl/err.h"
197-
#include "openssl/rand.h"
198-
199-
#if OPENSSL_VERSION_NUMBER < 0x0090510fL
200-
/* RAND_status was added in OpenSSL 0.9.5. If it is not available,
201-
we assume that seeding the RNG is necessary every time. */
202-
#define RAND_status() 0
203-
#endif
204-
205197
#endif /* USE_SSL */
206198

207199
#if defined(MS_WINDOWS) || defined(__BEOS__)
@@ -2552,32 +2544,6 @@ init_socket(void)
25522544
if (PyDict_SetItemString(d, "SSLType",
25532545
(PyObject *)&SSL_Type) != 0)
25542546
return;
2555-
if (RAND_status() == 0) {
2556-
#ifdef USE_EGD
2557-
char random_device[MAXPATHLEN+1];
2558-
if (!RAND_file_name (random_device, MAXPATHLEN + 1)) {
2559-
PyErr_SetObject(SSLErrorObject,
2560-
PyString_FromString("RAND_file_name error"));
2561-
return;
2562-
}
2563-
if (RAND_egd (random_device) == -1) {
2564-
PyErr_SetObject(SSLErrorObject,
2565-
PyString_FromString("RAND_egd error"));
2566-
return;
2567-
}
2568-
#else /* USE_EGD not defined */
2569-
char random_string[32];
2570-
int i;
2571-
2572-
PyErr_Warn(PyExc_RuntimeWarning,
2573-
"using insecure method to generate random numbers");
2574-
srand(time(NULL));
2575-
for(i=0; i<sizeof(random_string); i++) {
2576-
random_string[i] = rand();
2577-
}
2578-
RAND_seed(random_string, sizeof(random_string));
2579-
#endif /* USE_EGD */
2580-
}
25812547
#endif /* USE_SSL */
25822548
PyDict_SetItemString(d, "error", PySocket_Error);
25832549
PySocketSock_Type.ob_type = &PyType_Type;

0 commit comments

Comments
 (0)