diff options
author | Luca Deri <deri@ntop.org> | 2019-09-15 22:43:43 +0200 |
---|---|---|
committer | Luca Deri <deri@ntop.org> | 2019-09-15 22:43:43 +0200 |
commit | 62c9766cc1a0c44d3a16a789d0351c5e742d3ef3 (patch) | |
tree | cf1dba9b7e8f19b9eec5b36a3ab4dddc376835f0 /src/lib | |
parent | f0013e826e28690a7037a8b2b781b8bc085efc6c (diff) |
Warnign fix
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/protocols/tls.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/lib/protocols/tls.c b/src/lib/protocols/tls.c index 4ecbee651..f468df8d8 100644 --- a/src/lib/protocols/tls.c +++ b/src/lib/protocols/tls.c @@ -190,12 +190,12 @@ int getTLScertificate(struct ndpi_detection_module_struct *ndpi_struct, char *buffer, int buffer_len) { struct ndpi_packet_struct *packet = &flow->packet; struct ja3_info ja3; - int i; u_int8_t invalid_ja3 = 0; u_int16_t pkt_tls_version = (packet->payload[1] << 8) + packet->payload[2], ja3_str_len; char ja3_str[JA3_STR_LEN]; ndpi_MD5_CTX ctx; u_char md5_hash[16]; + int i; if(packet->udp) { /* Check if this is DTLS or return */ @@ -256,7 +256,8 @@ int getTLScertificate(struct ndpi_detection_module_struct *ndpi_struct, || (handshake_protocol == 0x0b) /* Server Hello and Certificate message types are interesting for us */) { u_int num_found = 0; u_int16_t tls_version; - + int i; + if(packet->tcp) tls_version = ntohs(*((u_int16_t*)&packet->payload[header_len+4])); else @@ -447,7 +448,7 @@ int getTLScertificate(struct ndpi_detection_module_struct *ndpi_struct, u_int16_t *id = (u_int16_t*)&packet->payload[cipher_offset+i]; #ifdef DEBUG_TLS - printf("Client SSL [cipher suite: %u/0x%04X] [%u/%u]\n", ntohs(*id), ntohs(*id), i, cipher_len); + printf("Client SSL [cipher suite: %u/0x%04X] [%d/%u]\n", ntohs(*id), ntohs(*id), i, cipher_len); #endif if((*id == 0) || (packet->payload[cipher_offset+i] != packet->payload[cipher_offset+i+1])) { /* @@ -1022,7 +1023,8 @@ int sslTryAndRetrieveServerCertificate(struct ndpi_detection_module_struct *ndpi #endif /* 1 means keep looking for more packets */ - return((!flow->l4.tcp.tls_srv_cert_fingerprint_processed) ? 1 : rc); + if(!flow->l4.tcp.tls_srv_cert_fingerprint_processed) rc = 1; + return(rc); } /* **************************************** */ @@ -1318,7 +1320,7 @@ void ndpi_search_tls_tcp_udp(struct ndpi_detection_module_struct *ndpi_struct, int rc = sslTryAndRetrieveServerCertificate(ndpi_struct, flow); #ifdef DEBUG_TLS - printf("==>> %u [rc: %u][len: %u][%s][version: %u]\n", + printf("==>> %u [rc: %d][len: %u][%s][version: %u]\n", flow->guessed_host_protocol_id, rc, packet->payload_packet_len, flow->protos.stun_ssl.ssl.ja3_server, flow->protos.stun_ssl.ssl.ssl_version); #endif |