Finalize the EXTMS messages and compute the hash
(self, msg_str)
| 1339 | return _TLSHandshake.build(self, *args, **kargs) |
| 1340 | |
| 1341 | def tls_session_update(self, msg_str): |
| 1342 | """ |
| 1343 | Finalize the EXTMS messages and compute the hash |
| 1344 | """ |
| 1345 | super(TLSClientKeyExchange, self).tls_session_update(msg_str) |
| 1346 | |
| 1347 | if self.tls_session.extms: |
| 1348 | to_hash = b''.join(self.tls_session.handshake_messages) |
| 1349 | # https://tools.ietf.org/html/rfc7627#section-3 |
| 1350 | if self.tls_session.tls_version >= 0x303: |
| 1351 | # TLS 1.2 uses the same Hash as the PRF |
| 1352 | from scapy.layers.tls.crypto.hash import _tls_hash_algs |
| 1353 | hash_object = _tls_hash_algs.get( |
| 1354 | self.tls_session.prcs.prf.hash_name |
| 1355 | )() |
| 1356 | self.tls_session.session_hash = hash_object.digest(to_hash) |
| 1357 | else: |
| 1358 | # Previous TLS version use concatenation of MD5 & SHA1 |
| 1359 | from scapy.layers.tls.crypto.hash import Hash_MD5, Hash_SHA |
| 1360 | self.tls_session.session_hash = ( |
| 1361 | Hash_MD5().digest(to_hash) + Hash_SHA().digest(to_hash) |
| 1362 | ) |
| 1363 | if self.tls_session.pre_master_secret: |
| 1364 | self.tls_session.compute_ms_and_derive_keys() |
| 1365 | |
| 1366 | if not self.tls_session.master_secret: |
| 1367 | # There are still no master secret (we're just passive) |
| 1368 | if self.tls_session.use_nss_master_secret_if_present(): |
| 1369 | # we have a NSS file |
| 1370 | self.tls_session.compute_ms_and_derive_keys() |
| 1371 | |
| 1372 | |
| 1373 | ############################################################################### |
nothing calls this directly
no test coverage detected