tomato42/tlslite-ng

View on GitHub

Showing 1,716 of 1,734 total issues

Function _getFinished has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
Open

def _getFinished(self, masterSecret, cipherSuite=None,
expect_next_protocol=False, nextProto=None):
 
expect_ccs_message = True
# If we use SessionTicket resumption on client side, there are multiple
Severity: Minor
Found in tlslite/tlsconnection.py - About 6 hrs to fix

Identical blocks of code found in 2 locations. Consider refactoring.
Open

if settings.ticketCipher in ("aes128gcm", "aes256gcm"):
cipher = createAESGCM(key,
settings.cipherImplementations)
elif settings.ticketCipher in ("aes128ccm", "aes256ccm"):
cipher = createAESCCM(key, settings.cipherImplementations)
Severity: Major
Found in tlslite/tlsconnection.py and 1 other location - About 6 hrs to fix
tlslite/tlsconnection.py on lines 2756..2764

Identical blocks of code found in 2 locations. Consider refactoring.
Open

if settings.ticketCipher in ("aes128gcm", "aes256gcm"):
cipher = createAESGCM(key, settings.cipherImplementations)
elif settings.ticketCipher in ("aes128ccm", "aes256ccm"):
cipher = createAESCCM(key, settings.cipherImplementations)
elif settings.ticketCipher in ("aes128ccm_8", "aes256ccm_8"):
Severity: Major
Found in tlslite/tlsconnection.py and 1 other location - About 6 hrs to fix
tlslite/tlsconnection.py on lines 2706..2716

Similar blocks of code found in 2 locations. Consider refactoring.
Open

try:
return self.rsa.encrypt(compatLong(ciphertext), None)[0]
except ValueError as e:
print("rsa: {0!r}".format(self.rsa), file=sys.stderr)
values = []
Severity: Major
Found in tlslite/utils/pycrypto_rsakey.py and 1 other location - About 6 hrs to fix
tlslite/utils/pycrypto_rsakey.py on lines 38..48

Similar blocks of code found in 2 locations. Consider refactoring.
Open

try:
return self.rsa.decrypt((compatLong(message),))
except ValueError as e:
print("rsa: {0!r}".format(self.rsa), file=sys.stderr)
values = []
Severity: Major
Found in tlslite/utils/pycrypto_rsakey.py and 1 other location - About 6 hrs to fix
tlslite/utils/pycrypto_rsakey.py on lines 52..62

RecordLayer has 45 functions (exceeds 20 allowed). Consider refactoring.
Open

class RecordLayer(object):
 
"""
Implementation of TLS record layer protocol
 
 
Severity: Minor
Found in tlslite/recordlayer.py - About 6 hrs to fix

    Cyclomatic complexity is too high in method recvRecord. (37)
    Open

    def recvRecord(self):
    """
    Read, decrypt and check integrity of a single record
     
    :rtype: tuple
    Severity: Minor
    Found in tlslite/recordlayer.py by radon

    Cyclomatic complexity is too high in function brotli_decompress_buffer. (37)
    Open

    def brotli_decompress_buffer(input_buffer, buffer_limit=None):
    br = BrotliBitReader(input_buffer)
    output_buffer = bytearray([])
    pos = 0
    input_end = 0
    Severity: Minor
    Found in tlslite/utils/brotlidecpy/decode.py by radon

    TLSConnection has 44 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class TLSConnection(TLSRecordLayer):
    """
    This class wraps a socket and provides TLS handshaking and data transfer.
     
    To use this class, create a new instance, passing a connected
    Severity: Minor
    Found in tlslite/tlsconnection.py - About 6 hrs to fix

      Function read_huffman_code has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
      Open

      def read_huffman_code(alphabet_size, tables, table, br):
      code_lengths = bytearray([0] * alphabet_size)
       
      # simple_code_or_skip is used as follows:
      # 1 for simple code
      Severity: Minor
      Found in tlslite/utils/brotlidecpy/decode.py - About 5 hrs to fix

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

      if self.version < (3, 4):
      ext_c = clientHello.getExtension(ExtensionType.ec_point_formats)
      ext_s = serverHello.getExtension(ExtensionType.ec_point_formats)
      if ext_c and ext_s:
      try:
      Severity: Major
      Found in tlslite/tlsconnection.py and 1 other location - About 5 hrs to fix
      tlslite/tlsconnection.py on lines 2555..2567

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

      if version < (3, 4):
      ext_c = clientHello.getExtension(ExtensionType.ec_point_formats)
      ext_s = serverHello.getExtension(ExtensionType.ec_point_formats)
      if ext_c and ext_s:
      try:
      Severity: Major
      Found in tlslite/tlsconnection.py and 1 other location - About 5 hrs to fix
      tlslite/tlsconnection.py on lines 676..688

      Cyclomatic complexity is too high in method readAsync. (33)
      Open

      def readAsync(self, max=None, min=1):
      """Start a read operation on the TLS connection.
       
      This function returns a generator which behaves similarly to
      read(). Successive invocations of the generator will return 0
      Severity: Minor
      Found in tlslite/tlsrecordlayer.py by radon

      Function recvRecord has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

      def recvRecord(self):
      """
      Read, decrypt and check integrity of a single record
       
      :rtype: tuple
      Severity: Minor
      Found in tlslite/recordlayer.py - About 5 hrs to fix

      Function parse has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
      Open

      def parse(s, passwordCallback=None):
      # Skip forward to the first PEM header
      start = s.find("-----BEGIN ")
      if start == -1:
      raise SyntaxError()
      Severity: Minor
      Found in tlslite/utils/openssl_rsakey.py - About 5 hrs to fix

      Function _decrefAsync has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
      Open

      def _decrefAsync(self):
      self._refCount -= 1
      if self._refCount == 0 and not self.closed:
      try:
      for result in self._sendMsg(Alert().create(\
      Severity: Minor
      Found in tlslite/tlsrecordlayer.py - About 4 hrs to fix

      Function _parse_pkcs8 has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
      Open

      def _parse_pkcs8(bytes):
      parser = ASN1Parser(bytes)
       
      # first element in PrivateKeyInfo is an INTEGER
      version = parser.getChild(0).value
      Severity: Minor
      Found in tlslite/utils/python_key.py - About 4 hrs to fix

      Cyclomatic complexity is too high in class TLSConnection. (28)
      Open

      class TLSConnection(TLSRecordLayer):
      """
      This class wraps a socket and provides TLS handshaking and data transfer.
       
      To use this class, create a new instance, passing a connected
      Severity: Minor
      Found in tlslite/tlsconnection.py by radon

      File codec.py has 361 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # Author: Trevor Perrin
      # See the LICENSE file for legal information regarding use of this file.
       
      """Classes for reading/writing binary data (such as TLS records)."""
       
       
      Severity: Minor
      Found in tlslite/utils/codec.py - About 4 hrs to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        for i in range(0, size_bytes):
        next_byte = br.read_bits(8)
        if i + 1 == size_bytes and size_bytes > 1 and next_byte == 0:
        raise Exception('Invalid size byte')
         
         
        Severity: Major
        Found in tlslite/utils/brotlidecpy/decode.py and 1 other location - About 4 hrs to fix
        tlslite/utils/brotlidecpy/decode.py on lines 82..104
        Severity
        Category
        Status
        Source
        Language