def create_per_cipher_tests(): def _(self, proto, cipher): self._test_openssl_accepts_selected_proto_cipher(proto, cipher) for proto in sslproto.get_supported_protocols(): ciphers = sslproto.get_ciphers(proto) for cipher in ciphers: cipher_slug_name = re.sub('-', '_', cipher) setattr(TestSSLProtoModule, "test_openssl_accepts_proto_%s_cipher_%s" % (proto, cipher_slug_name), lambda self, proto=proto, cipher=cipher: _(self, proto, cipher))
def create_per_cipher_tests(): def _(self, proto, cipher): self._test_openssl_accepts_selected_proto_cipher(proto, cipher) for proto in sslproto.get_supported_protocols(): ciphers = sslproto.get_ciphers(proto) for cipher in ciphers: cipher_slug_name = re.sub('-', '_', cipher) setattr(TestSSLProtoModule, "test_openssl_accepts_proto_%s_cipher_%s" % (proto, cipher_slug_name), lambda self, proto=proto, cipher=cipher: _( self, proto, cipher))
def _test_openssl_accepts_selected_proto_cipher(self, selected_proto, selected_cipher): eccars = [] for cipher in sslproto.get_ciphers(selected_proto): if cipher == selected_cipher: expected_res = Connected() else: expected_res = ALERT_NO_SHARED_CIPHER eccars.append(ECCAR(SSLServerProtoSpec(selected_proto, cipher), expected_res=expected_res)) self._main_test( ['-m', 'sslproto', '--protocols', selected_proto, '--ciphers', 'ITERATE'], OpenSSLHammer(len(eccars), cipher=selected_cipher), eccars )
def _test_openssl_accepts_selected_proto_cipher(self, selected_proto, selected_cipher): eccars = [] for cipher in sslproto.get_ciphers(selected_proto): if cipher == selected_cipher: expected_res = Connected() else: expected_res = ALERT_NO_SHARED_CIPHER eccars.append( ECCAR(SSLServerProtoSpec(selected_proto, cipher), expected_res=expected_res)) self._main_test([ '-m', 'sslproto', '--protocols', selected_proto, '--ciphers', 'ITERATE' ], OpenSSLHammer(len(eccars), cipher=selected_cipher), eccars)