From d070d39c4d88ae27270fb3b166421662554c4eae Mon Sep 17 00:00:00 2001 From: Sven Geuer <68420948@users.noreply.github.com> Date: Sat, 6 Dec 2025 20:23:36 +0100 Subject: [PATCH] Make sure one of BUCKETS_* and one of CHECHKSUM_?B are always defined To make tlsh a ready-to-use static or shared library tlsh.h must make sure to define one of the BUCKETS_* and CHECHKSUM_?B variables in case none is defined yet. This PR ensures the default settings as per CMakeLists.txt. This PR fixes https://github.com/trendmicro/tlsh/issues/114. --- include/tlsh.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/tlsh.h b/include/tlsh.h index 3d7e363..e1b7d4a 100644 --- a/include/tlsh.h +++ b/include/tlsh.h @@ -83,6 +83,14 @@ class TlshImpl; // Define TLSH_STRING_LEN_REQ, which is the string length of "T1" + the hex value of the Tlsh hash. // BUCKETS_256 & CHECKSUM_3B are compiler switches defined in CMakeLists.txt +// Make sure BUCKETS_* and CHECHKSUM_?B are always defined, to make tlsh.h and +// the (static or shared) library self-contained. +#if !(defined BUCKETS_48 || defined BUCKETS_128 || defined BUCKETS_256) + #define BUCKETS_128 +#endif +#if !(defined CHECKSUM_0B || defined CHECKSUM_1B || defined CHECKSUM_3B) + #define CHECKSUM_1B +#endif #if defined BUCKETS_256 #define TLSH_STRING_LEN_REQ 136 // changed the minimum data length to 256 for version 3.3