We use the tls_version if it has been defined, else the advertised version. Also, the legacy 0x0301 is used for TLS 1.3 packets.
| 70 | |
| 71 | |
| 72 | class _TLSVersionField(ShortEnumField): |
| 73 | """ |
| 74 | We use the tls_version if it has been defined, else the advertised version. |
| 75 | Also, the legacy 0x0301 is used for TLS 1.3 packets. |
| 76 | """ |
| 77 | |
| 78 | def i2h(self, pkt, x): |
| 79 | if x is None: |
| 80 | v = pkt.tls_session.tls_version |
| 81 | if v: |
| 82 | return _tls13_version_filter(v, 0x0301) |
| 83 | else: |
| 84 | adv_v = pkt.tls_session.advertised_tls_version |
| 85 | return _tls13_version_filter(adv_v, 0x0301) |
| 86 | return x |
| 87 | |
| 88 | def i2m(self, pkt, x): |
| 89 | if x is None: |
| 90 | v = pkt.tls_session.tls_version |
| 91 | if v: |
| 92 | return _tls13_version_filter(v, 0x0301) |
| 93 | else: |
| 94 | adv_v = pkt.tls_session.advertised_tls_version |
| 95 | return _tls13_version_filter(adv_v, 0x0301) |
| 96 | return x |
| 97 | |
| 98 | |
| 99 | class _TLSLengthField(ShortField): |
no outgoing calls
no test coverage detected
searching dependent graphs…