View | Details | Raw Unified | Return to bug 192511 | Differences between
and this patch

Collapse All | Expand All

(-)pyconfig.h.in (+6 lines)
Lines 544-549 Link Here
544
/* Define to 1 if you have the `putenv' function. */
544
/* Define to 1 if you have the `putenv' function. */
545
#undef HAVE_PUTENV
545
#undef HAVE_PUTENV
546
546
547
/* ### Fix build with LibreSSL (does not have RAND_egd)
548
   ### PR192511, http://bugs.python.org/issue21356 */
549
/* Define if the libcrypto has RAND_egd */
550
#undef HAVE_RAND_EGD
551
552
/* ### End PR192511 */
547
/* Define to 1 if you have the `readlink' function. */
553
/* Define to 1 if you have the `readlink' function. */
548
#undef HAVE_READLINK
554
#undef HAVE_READLINK
549
555
(-)Lib/test/test_ssl.py (-2 / +6 lines)
Lines 96-103 Link Here
96
            sys.stdout.write("\n RAND_status is %d (%s)\n"
96
            sys.stdout.write("\n RAND_status is %d (%s)\n"
97
                             % (v, (v and "sufficient randomness") or
97
                             % (v, (v and "sufficient randomness") or
98
                                "insufficient randomness"))
98
                                "insufficient randomness"))
99
        self.assertRaises(TypeError, ssl.RAND_egd, 1)
99
### Fix build with LibreSSL (does not have RAND_egd)
100
        self.assertRaises(TypeError, ssl.RAND_egd, 'foo', 1)
100
### PR192511, http://bugs.python.org/issue21356        
101
        if hasattr(ssl, 'RAND_egd'):
102
            self.assertRaises(TypeError, ssl.RAND_egd, 1)
103
            self.assertRaises(TypeError, ssl.RAND_egd, 'foo', 1)
104
### End PR192511
101
        ssl.RAND_add("this is a random string", 75.0)
105
        ssl.RAND_add("this is a random string", 75.0)
102
106
103
    def test_parse_cert(self):
107
    def test_parse_cert(self):
(-)Lib/ssl.py (-2 / +7 lines)
Lines 62-71 Link Here
62
from _ssl import OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_INFO, OPENSSL_VERSION
62
from _ssl import OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_INFO, OPENSSL_VERSION
63
from _ssl import SSLError
63
from _ssl import SSLError
64
from _ssl import CERT_NONE, CERT_OPTIONAL, CERT_REQUIRED
64
from _ssl import CERT_NONE, CERT_OPTIONAL, CERT_REQUIRED
65
### Fix build with LibreSSL (does not have RAND_egd)
66
### PR192511, http://bugs.python.org/issue21356
67
from _ssl import RAND_status, RAND_add
65
try:
68
try:
66
     from _ssl import RAND_status, RAND_egd, RAND_add
69
    from _ssl import RAND_egd
67
except ImportError:
70
except ImportError:
68
     from _ssl import RAND_status, RAND_add
71
    # LibreSSL does not provide RAND_egd
72
    pass
73
### End PR192511
69
from _ssl import \
74
from _ssl import \
70
     SSL_ERROR_ZERO_RETURN, \
75
     SSL_ERROR_ZERO_RETURN, \
71
     SSL_ERROR_WANT_READ, \
76
     SSL_ERROR_WANT_READ, \
(-)configure.ac (+7 lines)
Lines 2216-2221 Link Here
2216
AC_CHECK_LIB(dl, dlopen)	# Dynamic linking for SunOS/Solaris and SYSV
2216
AC_CHECK_LIB(dl, dlopen)	# Dynamic linking for SunOS/Solaris and SYSV
2217
AC_CHECK_LIB(dld, shl_load)	# Dynamic linking for HP-UX
2217
AC_CHECK_LIB(dld, shl_load)	# Dynamic linking for HP-UX
2218
2218
2219
### Fix build with LibreSSL (does not have RAND_egd)
2220
### PR192511, http://bugs.python.org/issue21356
2221
AC_CHECK_LIB(crypto, RAND_egd,
2222
             AC_DEFINE(HAVE_RAND_EGD, 1,
2223
             [Define if the libcrypto has RAND_egd]))
2224
### End PR192511
2225
2219
# only check for sem_init if thread support is requested
2226
# only check for sem_init if thread support is requested
2220
if test "$with_threads" = "yes" -o -z "$with_threads"; then
2227
if test "$with_threads" = "yes" -o -z "$with_threads"; then
2221
    AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris
2228
    AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris
(-)configure (+46 lines)
Lines 8529-8534 Link Here
8529
fi
8529
fi
8530
	# Dynamic linking for HP-UX
8530
	# Dynamic linking for HP-UX
8531
8531
8532
### Fix build with LibreSSL (does not have RAND_egd)
8533
### PR192511, http://bugs.python.org/issue21356
8534
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for RAND_egd in -lcrypto" >&5
8535
$as_echo_n "checking for RAND_egd in -lcrypto... " >&6; }
8536
if ${ac_cv_lib_crypto_RAND_egd+:} false; then :
8537
  $as_echo_n "(cached) " >&6
8538
else
8539
  ac_check_lib_save_LIBS=$LIBS
8540
LIBS="-lcrypto  $LIBS"
8541
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
8542
/* end confdefs.h.  */
8543
8544
/* Override any GCC internal prototype to avoid an error.
8545
   Use char because int might match the return type of a GCC
8546
   builtin and then its argument prototype would still apply.  */
8547
#ifdef __cplusplus
8548
extern "C"
8549
#endif
8550
char RAND_egd ();
8551
int
8552
main ()
8553
{
8554
return RAND_egd ();
8555
  ;
8556
  return 0;
8557
}
8558
_ACEOF
8559
if ac_fn_c_try_link "$LINENO"; then :
8560
  ac_cv_lib_crypto_RAND_egd=yes
8561
else
8562
  ac_cv_lib_crypto_RAND_egd=no
8563
fi
8564
rm -f core conftest.err conftest.$ac_objext \
8565
    conftest$ac_exeext conftest.$ac_ext
8566
LIBS=$ac_check_lib_save_LIBS
8567
fi
8568
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_RAND_egd" >&5
8569
$as_echo "$ac_cv_lib_crypto_RAND_egd" >&6; }
8570
if test "x$ac_cv_lib_crypto_RAND_egd" = xyes; then :
8571
8572
$as_echo "#define HAVE_RAND_EGD 1" >>confdefs.h
8573
8574
fi
8575
8576
### End PR192511
8577
8532
# only check for sem_init if thread support is requested
8578
# only check for sem_init if thread support is requested
8533
if test "$with_threads" = "yes" -o -z "$with_threads"; then
8579
if test "$with_threads" = "yes" -o -z "$with_threads"; then
8534
    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sem_init" >&5
8580
    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sem_init" >&5
(-)Lib/socket.py (-1 / +8 lines)
Lines 67-73 Link Here
67
    from _ssl import SSLError as sslerror
67
    from _ssl import SSLError as sslerror
68
    from _ssl import \
68
    from _ssl import \
69
         RAND_add, \
69
         RAND_add, \
70
         RAND_egd, \
71
         RAND_status, \
70
         RAND_status, \
72
         SSL_ERROR_ZERO_RETURN, \
71
         SSL_ERROR_ZERO_RETURN, \
73
         SSL_ERROR_WANT_READ, \
72
         SSL_ERROR_WANT_READ, \
Lines 78-83 Link Here
78
         SSL_ERROR_WANT_CONNECT, \
77
         SSL_ERROR_WANT_CONNECT, \
79
         SSL_ERROR_EOF, \
78
         SSL_ERROR_EOF, \
80
         SSL_ERROR_INVALID_ERROR_CODE
79
         SSL_ERROR_INVALID_ERROR_CODE
80
### Fix build with LibreSSL (does not have RAND_egd)
81
### PR192511, http://bugs.python.org/issue21356
82
    try:
83
         from _ssl import RAND_egd
84
         # LibreSSL does not provide RAND_egd
85
    except ImportError:
86
         pass
87
### End PR192511
81
88
82
import os, sys, warnings
89
import os, sys, warnings
83
90

Return to bug 192511