#include <openssl/rand.h>
#include "wget.h"
+#include "utils.h"
#include "connect.h"
#include "url.h"
return;
/* Get random data from EGD if opt.sslegdsock was set. */
- if (opt.sslegdsock)
+ if (opt.sslegdsock && *opt.sslegdsock)
RAND_egd (opt.sslegdsock);
if (RAND_status ())
security will use /dev/random or their own source of randomness
anyway. */
- srand (time (NULL));
while (RAND_status () == 0 && maxrand-- > 0)
{
- int rnd = rand ();
- RAND_seed ((unsigned char *)&rnd, sizeof (rnd));
+ unsigned char rnd = random_number (256);
+ RAND_seed (&rnd, sizeof (rnd));
}
if (RAND_status () == 0)
{
- logprintf (LOG_NOTQUIET, "Could not seed OpenSSL PRNG; disabling SSL.\n");
+ logprintf (LOG_NOTQUIET,
+ _("Could not seed OpenSSL PRNG; disabling SSL.\n"));
scheme_disable (SCHEME_HTTPS);
}
#endif /* SSLEAY_VERSION_NUMBER >= 0x00905100 */
meth = SSLv23_client_method ();
*ctx = SSL_CTX_new (meth);
SSL_CTX_set_verify (*ctx, verify, verify_callback);
- if (*ctx == NULL) return SSLERRCTXCREATE;
+ if (*ctx == NULL)
+ return SSLERRCTXCREATE;
if (opt.sslcertfile)
{
if (SSL_CTX_use_certificate_file (*ctx, opt.sslcertfile,
do
{
#ifdef HAVE_SELECT
- if (opt.timeout)
+ if (opt.timeout && !SSL_pending (con))
{
-
do
{
res = select_fd (fd, opt.timeout, 0);