From eb4700fe55b392297b9e00b77e839aad58bb9c3f Mon Sep 17 00:00:00 2001 From: Alexander K Date: Mon, 7 Dec 2020 17:11:43 +0300 Subject: [PATCH] Fix https://github.com/tempesta-tech/tempesta/issues/1310 (https://github.com/tintinweb/scapy-ssl_tls/issues/163). RFC 5246 6.2.3.3 requires the explicit nonce (most usually sequence number) in the additional authenticated data (AAD), however crypto_data.sequence, used for the AAD creation in EAEADCryptoContainer, wasn't initialized with the explicit_nonce. --- tls/scapy_ssl_tls/ssl_tls_crypto.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tls/scapy_ssl_tls/ssl_tls_crypto.py b/tls/scapy_ssl_tls/ssl_tls_crypto.py index be1b919e1..fe88e017d 100644 --- a/tls/scapy_ssl_tls/ssl_tls_crypto.py +++ b/tls/scapy_ssl_tls/ssl_tls_crypto.py @@ -1078,6 +1078,7 @@ def decrypt(self, ciphertext, content_type=tls.TLSContentType.APPLICATION_DATA): # Create an empty Crypto container to retrieve AEAD data based on length of cleartext crypto_data = CryptoData.from_context(self.tls_ctx, self.ctx, "\x00" * len(ciphertext)) crypto_data.content_type = content_type + crypto_data.sequence = struct.unpack("!Q", explicit_nonce)[0] crypto_container = EAEADCryptoContainer.from_context(self.tls_ctx, self.ctx, crypto_data) self.__init_ciphers(self.get_nonce(explicit_nonce)) self.dec_cipher.update(crypto_container.aead)