mirror of
https://github.com/vel21ripn/nDPI.git
synced 2026-05-03 01:10:17 +00:00
* Add IEC62056 (DLMS/COSEM) protocol dissector * Fix detection on big endian architectures * Update protocols.rst * Add ndpi_crc16_x25 to fuzz/fuzz_alg_crc32_md5.c * Update pcap sample * Remove empty .out file * iec62056: add some documentation --------- Co-authored-by: Nardi Ivan <nardi.ivan@gmail.com>
43 lines
943 B
C
43 lines
943 B
C
#include "ndpi_api.h"
|
|
|
|
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
|
u_char hash[16];
|
|
struct ndpi_popcount popcount;
|
|
char *str;
|
|
|
|
/* No memory allocations involved */
|
|
|
|
/* Used for crc32, md5, hash(es) and popcount algs */
|
|
|
|
ndpi_crc16_ccit(data, size);
|
|
ndpi_crc16_ccit_false(data, size);
|
|
ndpi_crc16_xmodem(data, size);
|
|
ndpi_crc16_x25(data, size);
|
|
ndpi_crc32(data, size);
|
|
ndpi_md5(data, size, hash);
|
|
|
|
ndpi_murmur_hash((const char *)data, size);
|
|
ndpi_quick_hash(data, size);
|
|
|
|
if(size >= 16)
|
|
ndpi_quick_16_byte_hash(data);
|
|
|
|
str = ndpi_malloc(size + 1);
|
|
if(str) {
|
|
memcpy(str, data, size);
|
|
str[size] = '\0';
|
|
|
|
ndpi_quick_hash64((const char *)str, strlen(str));
|
|
ndpi_hash_string(str);
|
|
ndpi_rev_hash_string(str);
|
|
ndpi_hash_string_len(str, strlen(str));
|
|
|
|
ndpi_free(str);
|
|
}
|
|
|
|
|
|
ndpi_popcount_init(&popcount);
|
|
ndpi_popcount_count(&popcount, data, size);
|
|
|
|
return 0;
|
|
}
|