def test_RAND_status(self): #--Positive self.assertEqual(real_ssl.RAND_status(), 1) #--Negative self.assertRaises(TypeError, real_ssl.RAND_status, None) self.assertRaises(TypeError, real_ssl.RAND_status, "") self.assertRaises(TypeError, real_ssl.RAND_status, 1) self.assertRaises(TypeError, real_ssl.RAND_status, None, None)
def test_RAND_status(): #--Positive AreEqual(real_ssl.RAND_status(), 1) #--Negative AssertError(TypeError, real_ssl.RAND_status, None) AssertError(TypeError, real_ssl.RAND_status, "") AssertError(TypeError, real_ssl.RAND_status, 1) AssertError(TypeError, real_ssl.RAND_status, None, None)
def test_RAND_status(self): import _ssl if not hasattr(_ssl, "RAND_status"): skip("RAND_status is not available on this machine") _ssl.RAND_status()
# thread is interacting with the allocator can deadlock (or outright crash) the entire # process. # # considering that this can be reproduced in a 60 line C file that mallocs/frees in a loop # while another thread just runs the toolhelp example code from msdn, this is probably # a windows bug. if it's not, then it's an openssl bug. ugh. # # radioactive superfund site workaround follows: # RAND_status should cause the broken openssl code to run before too many threads are # started in the UI case. this drastically reduces the repro rate in the interim. it still # happens occasionally; threads spawned by the intel graphics drivers seem to still get hit here, # but only ~1/2 the time. on machines i've interacted with personally, this drops repro rate to 0%. # # TODO FIXME remove asap when windows patch/hotfix (hopefully) gets released import _ssl _ssl.RAND_status() except: pass class PythonDownloadInstance(DownloadInstance): def __init__(self, provider): super(PythonDownloadInstance, self).__init__(provider) def perform_destroy_instance(self): pass def perform_request(self, url): try: proxy_setting = settings.Settings().get_string( 'network.httpsProxy') if proxy_setting:
def test(): for _ in range(9999): bio = _ssl.MemoryBIO() for _ in range(fint()): if fint(): try: bio.write(fstr()) except _ssl.SSLError: pass if fint(): bio.read() if fint(): bio.write_eof() bio.pending bio.eof _ssl.RAND_add(fstr(), fdouble()) _ssl.RAND_status() try: _ssl.RAND_bytes(fint()) _ssl.RAND_pseudo_bytes(fint()) except _ssl.SSLError: pass while True: try: ctx = _ssl._SSLContext(rnd.randint(-1,20)) ; break except ValueError: continue try: ctx.set_ciphers(str(fstr())) except _ssl.SSLError: pass try: ctx.set_alpn_protocols(flst()) except (AttributeError, _ssl.SSLError): pass try: ctx.set_npn_protocols(flst()) except (AttributeError, _ssl.SSLError): pass try: ctx.set_ecdh_curve(fstr()) except (ValueError, _ssl.SSLError): pass ctx.get_ciphers() ctx.check_hostname ctx.check_hostname = fbool() ctx._host_flags ctx._host_flags = flong() ctx.minimum_version try: ctx.minimum_version = flong() except (ValueError, _ssl.SSLError): pass ctx.maximum_version try: ctx.maximum_version = flong() except (ValueError, _ssl.SSLError): pass ctx.sni_callback try: ctx.sni_callback = flong except (ValueError, _ssl.SSLError): pass ctx.options ctx.options = flong() ctx.protocol ctx.verify_flags ctx.verify_flags = flong() ctx.verify_mode try: ctx.verify_mode = flong() except (ValueError, _ssl.SSLError): pass sock = socket.socket() sock = ctx._wrap_socket(sock, fbool()) sock.compression() sock.cipher() sock.shared_ciphers() sock.version() sock.selected_alpn_protocol() sock.selected_npn_protocol() try: sock.do_handshake() except _ssl.SSLError: pass try: sock.write(fstr()) except _ssl.SSLError: pass try: sock.read(fint()) except _ssl.SSLError: pass sock.pending() sock.context sock.server_side sock.server_hostname sock.owner sock.session sock.session_reused try: sock.shutdown() except _ssl.SSLError: pass