aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorIvan Nardi <12729895+IvanNardi@users.noreply.github.com>2024-09-23 17:58:21 +0200
committerGitHub <noreply@github.com>2024-09-23 17:58:21 +0200
commit2bf869ca594ccceca05985de648f7221e9848d37 (patch)
tree168d508a4265710588d22d1467380e37c64ddcdf /src/lib
parentefe1930b02544ea5ac2be18297fb93bdebeee1ff (diff)
TLS: improve handling of Change Cipher message (#2564)
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/protocols/tls.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/lib/protocols/tls.c b/src/lib/protocols/tls.c
index 7f3b5f7ed..82caf0584 100644
--- a/src/lib/protocols/tls.c
+++ b/src/lib/protocols/tls.c
@@ -1068,13 +1068,18 @@ static int ndpi_search_tls_tcp(struct ndpi_detection_module_struct *ndpi_struct,
*/
flow->l4.tcp.tls.num_tls_blocks = 0;
}
+ if(len == 6 &&
+ message->buffer[1] == 0x03 && /* TLS >= 1.0 */
+ ((message->buffer[3] << 8) + (message->buffer[4])) == 1) {
#ifdef DEBUG_TLS
- printf("[TLS] Change Cipher Spec\n");
+ printf("[TLS] Change Cipher Spec\n");
#endif
- flow->l4.tcp.tls.app_data_seen[packet->packet_direction] = 1;
- /* Further data is encrypted so we are not able to parse it without
- erros and without setting `something_went_wrong` variable */
- break;
+ ndpi_int_tls_add_connection(ndpi_struct, flow);
+ flow->l4.tcp.tls.app_data_seen[packet->packet_direction] = 1;
+ /* Further data is encrypted so we are not able to parse it without
+ erros and without setting `something_went_wrong` variable */
+ break;
+ }
} else if(content_type == 0x15 /* Alert */) {
/* https://techcommunity.microsoft.com/t5/iis-support-blog/ssl-tls-alert-protocol-and-the-alert-codes/ba-p/377132 */
#ifdef DEBUG_TLS