Cleaned up tls/quic datatypes

This commit is contained in:
Luca Deri
2021-01-21 19:17:33 +01:00
parent 15295ef4c5
commit a31bd5ac3c
8 changed files with 174 additions and 174 deletions
+12 -12
View File
@@ -1190,12 +1190,12 @@ static void process_tls(struct ndpi_detection_module_struct *ndpi_struct,
this way we lose JA3S and negotiated ciphers...
Negotiated version is only present in the ServerHello message too, but
fortunately, QUIC always uses TLS version 1.3 */
flow->protos.stun_ssl.ssl.ssl_version = 0x0304;
flow->protos.tls_quic_stun.tls_quic.ssl_version = 0x0304;
/* DNS-over-QUIC: ALPN is "doq" or "doq-XXX" (for drafts versions) */
if(flow->protos.stun_ssl.ssl.alpn &&
strncmp(flow->protos.stun_ssl.ssl.alpn, "doq", 3) == 0) {
NDPI_LOG_DBG(ndpi_struct, "Found DOQ (ALPN: [%s])\n", flow->protos.stun_ssl.ssl.alpn);
if(flow->protos.tls_quic_stun.tls_quic.alpn &&
strncmp(flow->protos.tls_quic_stun.tls_quic.alpn, "doq", 3) == 0) {
NDPI_LOG_DBG(ndpi_struct, "Found DOQ (ALPN: [%s])\n", flow->protos.tls_quic_stun.tls_quic.alpn);
ndpi_int_change_protocol(ndpi_struct, flow, NDPI_PROTOCOL_DOH_DOT, NDPI_PROTOCOL_QUIC);
}
}
@@ -1239,22 +1239,22 @@ static void process_chlo(struct ndpi_detection_module_struct *ndpi_struct,
#endif
if((memcmp(tag, "SNI\0", 4) == 0) &&
(tag_offset_start + prev_offset + len < crypto_data_len)) {
sni_len = MIN(len, sizeof(flow->protos.stun_ssl.ssl.client_requested_server_name) - 1);
memcpy(flow->protos.stun_ssl.ssl.client_requested_server_name,
sni_len = MIN(len, sizeof(flow->protos.tls_quic_stun.tls_quic.client_requested_server_name) - 1);
memcpy(flow->protos.tls_quic_stun.tls_quic.client_requested_server_name,
&crypto_data[tag_offset_start + prev_offset], sni_len);
flow->protos.stun_ssl.ssl.client_requested_server_name[sni_len] = '\0';
flow->protos.tls_quic_stun.tls_quic.client_requested_server_name[sni_len] = '\0';
NDPI_LOG_DBG2(ndpi_struct, "SNI: [%s]\n",
flow->protos.stun_ssl.ssl.client_requested_server_name);
flow->protos.tls_quic_stun.tls_quic.client_requested_server_name);
ndpi_match_host_subprotocol(ndpi_struct, flow,
(char *)flow->protos.stun_ssl.ssl.client_requested_server_name,
strlen((const char*)flow->protos.stun_ssl.ssl.client_requested_server_name),
(char *)flow->protos.tls_quic_stun.tls_quic.client_requested_server_name,
strlen((const char*)flow->protos.tls_quic_stun.tls_quic.client_requested_server_name),
&ret_match, NDPI_PROTOCOL_QUIC);
flow->l4.tcp.tls.hello_processed = 1; /* Allow matching of custom categories */
ndpi_check_dga_name(ndpi_struct, flow,
flow->protos.stun_ssl.ssl.client_requested_server_name, 1);
flow->protos.tls_quic_stun.tls_quic.client_requested_server_name, 1);
sni_found = 1;
if (ua_found)
@@ -1281,7 +1281,7 @@ static void process_chlo(struct ndpi_detection_module_struct *ndpi_struct,
NDPI_LOG_DBG(ndpi_struct, "Something went wrong in tags iteration\n");
/* Add check for missing SNI */
if(flow->protos.stun_ssl.ssl.client_requested_server_name[0] == '\0') {
if(flow->protos.tls_quic_stun.tls_quic.client_requested_server_name[0] == '\0') {
/* This is a bit suspicious */
NDPI_SET_BIT(flow->risk, NDPI_TLS_MISSING_SNI);
}