Fixed TLS certificate dissection of subjectAltName
This commit is contained in:
+11
-3
@@ -482,7 +482,10 @@ static void processCertificateElements(struct ndpi_detection_module_struct *ndpi
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
i += 3 /* skip the initial patten 55 1D 11 */;
|
i += 3 /* skip the initial patten 55 1D 11 */;
|
||||||
i++; /* skip the first type, 0x04 == BIT STRING, and jump to it's length */
|
|
||||||
|
/* skip the first type, 0x04 == BIT STRING, and jump to it's length */
|
||||||
|
if(packet->payload[i] == 0x04) i++; else i += 4; /* 4 bytes, with the last byte set to 04 */
|
||||||
|
|
||||||
if(i < packet->payload_packet_len) {
|
if(i < packet->payload_packet_len) {
|
||||||
i += (packet->payload[i] & 0x80) ? (packet->payload[i] & 0x7F) : 0; /* skip BIT STRING length */
|
i += (packet->payload[i] & 0x80) ? (packet->payload[i] & 0x7F) : 0; /* skip BIT STRING length */
|
||||||
if(i < packet->payload_packet_len) {
|
if(i < packet->payload_packet_len) {
|
||||||
@@ -531,6 +534,11 @@ static void processCertificateElements(struct ndpi_detection_module_struct *ndpi
|
|||||||
{
|
{
|
||||||
char * first_dot = strchr(flow->protos.tls_quic_stun.tls_quic.client_requested_server_name, '.');
|
char * first_dot = strchr(flow->protos.tls_quic_stun.tls_quic.client_requested_server_name, '.');
|
||||||
|
|
||||||
|
#if DEBUG_TLS
|
||||||
|
printf("[TLS] Trying to match '%s' with '%s'\n",
|
||||||
|
flow->protos.tls_quic_stun.tls_quic.client_requested_server_name,
|
||||||
|
dNSName);
|
||||||
|
#endif
|
||||||
if (first_dot == NULL || first_dot >= label)
|
if (first_dot == NULL || first_dot >= label)
|
||||||
{
|
{
|
||||||
matched_name = 1;
|
matched_name = 1;
|
||||||
@@ -583,7 +591,7 @@ static void processCertificateElements(struct ndpi_detection_module_struct *ndpi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} /* for */
|
||||||
|
|
||||||
if(rdn_len && (flow->protos.tls_quic_stun.tls_quic.subjectDN == NULL)) {
|
if(rdn_len && (flow->protos.tls_quic_stun.tls_quic.subjectDN == NULL)) {
|
||||||
flow->protos.tls_quic_stun.tls_quic.subjectDN = ndpi_strdup(rdnSeqBuf);
|
flow->protos.tls_quic_stun.tls_quic.subjectDN = ndpi_strdup(rdnSeqBuf);
|
||||||
@@ -1313,7 +1321,7 @@ int processClientServerHello(struct ndpi_detection_module_struct *ndpi_struct,
|
|||||||
tot_extension_len = 0;
|
tot_extension_len = 0;
|
||||||
|
|
||||||
#ifdef DEBUG_TLS
|
#ifdef DEBUG_TLS
|
||||||
printf("TLS [server][extension_len: %u]\n", extension_len);
|
printf("TLS [server][tot_extension_len: %u]\n", tot_extension_len);
|
||||||
#endif
|
#endif
|
||||||
offset += 2;
|
offset += 2;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user