Removed redundant type

This commit is contained in:
Ujjwal Verma 2017-06-22 06:28:11 +05:30
parent 6d284f5a2e
commit 6380e74821
3 changed files with 4 additions and 16 deletions

View File

@ -73,7 +73,7 @@ class TlsClientHello(KaitaiStruct):
self.len = self._io.read_u2be()
self.cipher_suites = [None] * (self.len // 2)
for i in range(self.len // 2):
self.cipher_suites[i] = self._root.CipherSuite(self._io, self, self._root)
self.cipher_suites[i] = self._io.read_u2be()
class CompressionMethods(KaitaiStruct):
def __init__(self, _io, _parent=None, _root=None):
@ -111,13 +111,6 @@ class TlsClientHello(KaitaiStruct):
self.major = self._io.read_u1()
self.minor = self._io.read_u1()
class CipherSuite(KaitaiStruct):
def __init__(self, _io, _parent=None, _root=None):
self._io = _io
self._parent = _parent
self._root = _root if _root else self
self.cipher_suite = self._io.read_u2be()
class Protocol(KaitaiStruct):
def __init__(self, _io, _parent=None, _root=None):
self._io = _io

View File

@ -59,14 +59,9 @@ types:
type: u2
- id: cipher_suites
type: cipher_suite
type: u2
repeat: expr
repeat-expr: len/2
cipher_suite:
seq:
- id: cipher_suite
type: u2
compression_methods:
seq:

View File

@ -539,8 +539,8 @@ class TlsLayer(base.Layer):
if not ciphers_server and self._client_tls:
ciphers_server = []
for id in self._client_hello.cipher_suites:
if id.cipher_suite in CIPHER_ID_NAME_MAP.keys():
ciphers_server.append(CIPHER_ID_NAME_MAP[id.cipher_suite])
if id in CIPHER_ID_NAME_MAP.keys():
ciphers_server.append(CIPHER_ID_NAME_MAP[id])
ciphers_server = ':'.join(ciphers_server)
self.server_conn.establish_ssl(