Skip to content

Commit 106604c

Browse files
committed
Thirdparty: Update TLSH to version 4.11
1 parent 4663b87 commit 106604c

File tree

15 files changed

+473
-172
lines changed

15 files changed

+473
-172
lines changed
-7.76 KB
Binary file not shown.
-518 Bytes
Binary file not shown.
15.7 KB
Binary file not shown.
-428 KB
Binary file not shown.
-443 KB
Binary file not shown.
-442 KB
Binary file not shown.

tools/thirdparty/thirdparty.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,8 +515,8 @@
515515
<ClInclude Include="tlsh\tlsh.h" />
516516
<ClInclude Include="tlsh\tlsh_impl.h" />
517517
<ClInclude Include="tlsh\tlsh_util.h" />
518+
<ClInclude Include="tlsh\tlsh_win_version.h" />
518519
<ClInclude Include="tlsh\tlsh_wrapper.h" />
519-
<ClInclude Include="tlsh\WinFunctions.h" />
520520
<ClInclude Include="tlsh\win_version.h" />
521521
</ItemGroup>
522522
<ItemGroup>

tools/thirdparty/thirdparty.vcxproj.filters

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -752,9 +752,6 @@
752752
<ClInclude Include="tlsh\win_version.h">
753753
<Filter>tlsh</Filter>
754754
</ClInclude>
755-
<ClInclude Include="tlsh\WinFunctions.h">
756-
<Filter>tlsh</Filter>
757-
</ClInclude>
758755
<ClInclude Include="gzip\crc32.h">
759756
<Filter>gzip\Headers</Filter>
760757
</ClInclude>
@@ -821,6 +818,9 @@
821818
<ClInclude Include="miniz\miniz.h">
822819
<Filter>miniz</Filter>
823820
</ClInclude>
821+
<ClInclude Include="tlsh\tlsh_win_version.h">
822+
<Filter>tlsh</Filter>
823+
</ClInclude>
824824
</ItemGroup>
825825
<ItemGroup>
826826
<None Include="capstone\arch\AArch64\AArch64GenAsmWriter.inc">

tools/thirdparty/tlsh/WinFunctions.h

Lines changed: 0 additions & 48 deletions
This file was deleted.

tools/thirdparty/tlsh/tlsh.cpp

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,11 @@
5555
* OF THE POSSIBILITY OF SUCH DAMAGE.
5656
*/
5757

58-
#define _CRT_SECURE_NO_WARNINGS 1
59-
6058
#include "tlsh.h"
6159
#include "tlsh_impl.h"
62-
//#include <stdio.h>
63-
//#include <errno.h>
64-
//#include <string.h>
60+
#include <stdio.h>
61+
#include <errno.h>
62+
#include <string.h>
6563

6664
/////////////////////////////////////////////////////
6765
// C++ Implementation
@@ -135,17 +133,23 @@ Tlsh::~Tlsh()
135133

136134
void Tlsh::update(const unsigned char* data, unsigned int len)
137135
{
138-
if ( NULL != impl )
139-
impl->update(data, len);
136+
//
137+
// threaded and private options only available to
138+
// windowsize == 5
139+
// calling final - without calling update first
140+
//
141+
int tlsh_option = 0;
142+
if (impl != NULL)
143+
impl->update(data, len, tlsh_option);
140144
}
141145

142-
void Tlsh::final(const unsigned char* data, unsigned int len, int fc_cons_option)
146+
void Tlsh::final(const unsigned char* data, unsigned int len, int tlsh_option)
143147
{
144-
if ( NULL != impl ){
145-
if ( NULL != data && len > 0 )
146-
impl->update(data, len);
147-
impl->final(fc_cons_option);
148-
}
148+
if (NULL != impl) {
149+
if ((data != NULL) && (len > 0))
150+
impl->update(data, len, tlsh_option);
151+
impl->final(tlsh_option);
152+
}
149153
}
150154

151155
const char* Tlsh::getHash(int showvers) const
@@ -217,6 +221,11 @@ int Tlsh::BucketValue(int bucket)
217221
return( impl->BucketValue(bucket) );
218222
}
219223

224+
int Tlsh::HistogramCount(int bucket)
225+
{
226+
return( impl->HistogramCount(bucket) );
227+
}
228+
220229
int Tlsh::totalDiff(const Tlsh *other, bool len_diff) const
221230
{
222231
if( NULL==impl || NULL == other || NULL == other->impl )

tools/thirdparty/tlsh/tlsh.h

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,19 @@
6060
#ifndef HEADER_TLSH_H
6161
#define HEADER_TLSH_H
6262

63-
#define WINDOWS
63+
#define WINDOWS // dmex
64+
65+
// -force option no longer used
66+
// #define TLSH_OPTION_FORCE 1
67+
#define TLSH_OPTION_CONSERVATIVE 2
68+
#define TLSH_OPTION_KEEP_BUCKET 4
69+
#define TLSH_OPTION_PRIVATE 8
70+
#define TLSH_OPTION_THREADED 16
6471

6572
#if defined WINDOWS || defined MINGW
66-
#include "win_version.h"
73+
#include "tlsh_win_version.h"
6774
#else
68-
#include "version.h"
75+
#include "tlsh_version.h"
6976
#endif
7077

7178
#ifndef NULL
@@ -108,7 +115,9 @@ class TlshImpl;
108115
#define TLSH_STRING_BUFFER_LEN (TLSH_STRING_LEN_REQ+1)
109116

110117
#ifdef WINDOWS
111-
#include "WinFunctions.h"
118+
// 27/Nov/2020
119+
// #include <WinFunctions.h>
120+
#define TLSH_API
112121
#else
113122
#if defined(__SPARC) || defined(_AS_MK_OS_RH73)
114123
#define TLSH_API
@@ -144,6 +153,7 @@ class TLSH_API Tlsh{
144153
int Q2ratio();
145154
int Checksum(int k);
146155
int BucketValue(int bucket);
156+
int HistogramCount(int bucket);
147157

148158
/* calculate difference */
149159
/* The len_diff parameter specifies if the file length is to be included in the difference calculation (len_diff=true) or if it */

0 commit comments

Comments
 (0)