aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan200101 <sentrycraft123@gmail.com>2022-06-16 22:43:56 +0200
committerJan200101 <sentrycraft123@gmail.com>2022-06-16 22:43:56 +0200
commit10bed2d13e6d670f4ed0f18e564f1e6790f2d812 (patch)
tree1f702032b39c6c854d6d8977b8d04d34e6e18f85
parente249a716e8c2d53ea843cf66ffcee75f184c0b6d (diff)
downloadOFQT-10bed2d13e6d670f4ed0f18e564f1e6790f2d812.tar.gz
OFQT-10bed2d13e6d670f4ed0f18e564f1e6790f2d812.zip
Change MD5 function signatures, make libtvn static, not object
this solves a problem on x86_64 Windows where the MD5 functions were included within ntdll. STATIC libraries have better defined behavior than static ones, and we do not compile the same thing multiple times since we use it as a libary.
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/hash/md5/md5.h8
-rw-r--r--src/hash/md5/md5c.c20
-rw-r--r--src/toast.c6
4 files changed, 19 insertions, 17 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 05cbcb2..c48af2d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -25,7 +25,7 @@ list(APPEND
${CMAKE_CURRENT_SOURCE_DIR}/toast.h
)
-add_library(tvn OBJECT ${CORE_SOURCES})
+add_library(tvn STATIC ${CORE_SOURCES})
target_compile_options(tvn PUBLIC ${CFLAGS})
target_include_directories(tvn PUBLIC ${LIBCURL_INCLUDE_DIRS})
diff --git a/src/hash/md5/md5.h b/src/hash/md5/md5.h
index 11b3ddd..d41b8fb 100644
--- a/src/hash/md5/md5.h
+++ b/src/hash/md5/md5.h
@@ -21,6 +21,8 @@ without express or implied warranty of any kind.
These notices must be retained in any copies of any part of this
documentation and/or software.
+
+Functions signatures changed as to not conflict with other libraries
*/
#include "global.h"
@@ -32,7 +34,7 @@ typedef struct {
unsigned char buffer[64]; /* input buffer */
} MD5_CTX;
-void MD5Init PROTO_LIST ((MD5_CTX *));
-void MD5Update PROTO_LIST
+void MD5_Init PROTO_LIST ((MD5_CTX *));
+void MD5_Update PROTO_LIST
((MD5_CTX *, unsigned char *, unsigned int));
-void MD5Final PROTO_LIST ((unsigned char [16], MD5_CTX *));
+void MD5_Final PROTO_LIST ((unsigned char [16], MD5_CTX *));
diff --git a/src/hash/md5/md5c.c b/src/hash/md5/md5c.c
index 3682361..a102cb9 100644
--- a/src/hash/md5/md5c.c
+++ b/src/hash/md5/md5c.c
@@ -26,7 +26,7 @@ documentation and/or software.
#include "global.h"
#include "md5.h"
-/* Constants for MD5Transform routine.
+/* Constants for MD5_Transform routine.
*/
#define S11 7
#define S12 12
@@ -45,7 +45,7 @@ documentation and/or software.
#define S43 15
#define S44 21
-static void MD5Transform PROTO_LIST ((UINT4 [4], unsigned char [64]));
+static void MD5_Transform PROTO_LIST ((UINT4 [4], unsigned char [64]));
static void Encode PROTO_LIST
((unsigned char *, UINT4 *, unsigned int));
static void Decode PROTO_LIST
@@ -96,7 +96,7 @@ Rotation is separate from addition to prevent recomputation.
/* MD5 initialization. Begins an MD5 operation, writing a new context.
*/
-void MD5Init (context)
+void MD5_Init (context)
MD5_CTX *context; /* context */
{
context->count[0] = context->count[1] = 0;
@@ -112,7 +112,7 @@ MD5_CTX *context; /* context */
operation, processing another message block, and updating the
context.
*/
-void MD5Update (context, input, inputLen)
+void MD5_Update (context, input, inputLen)
MD5_CTX *context; /* context */
unsigned char *input; /* input block */
unsigned int inputLen; /* length of input block */
@@ -135,10 +135,10 @@ unsigned int inputLen; /* length of input block */
if (inputLen >= partLen) {
MD5_memcpy
((POINTER)&context->buffer[index], (POINTER)input, partLen);
- MD5Transform (context->state, context->buffer);
+ MD5_Transform (context->state, context->buffer);
for (i = partLen; i + 63 < inputLen; i += 64)
- MD5Transform (context->state, &input[i]);
+ MD5_Transform (context->state, &input[i]);
index = 0;
}
@@ -154,7 +154,7 @@ unsigned int inputLen; /* length of input block */
/* MD5 finalization. Ends an MD5 message-digest operation, writing the
the message digest and zeroizing the context.
*/
-void MD5Final (digest, context)
+void MD5_Final (digest, context)
unsigned char digest[16]; /* message digest */
MD5_CTX *context; /* context */
{
@@ -168,10 +168,10 @@ MD5_CTX *context; /* context */
*/
index = (unsigned int)((context->count[0] >> 3) & 0x3f);
padLen = (index < 56) ? (56 - index) : (120 - index);
- MD5Update (context, PADDING, padLen);
+ MD5_Update (context, PADDING, padLen);
/* Append length (before padding) */
- MD5Update (context, bits, 8);
+ MD5_Update (context, bits, 8);
/* Store state in digest */
Encode (digest, context->state, 16);
@@ -183,7 +183,7 @@ MD5_CTX *context; /* context */
/* MD5 basic transformation. Transforms state based on block.
*/
-static void MD5Transform (state, block)
+static void MD5_Transform (state, block)
UINT4 state[4];
unsigned char block[64];
{
diff --git a/src/toast.c b/src/toast.c
index 34d28b9..475847c 100644
--- a/src/toast.c
+++ b/src/toast.c
@@ -589,7 +589,7 @@ static int fileHash(char* path, char* hash)
fseek(fd, 0L, SEEK_SET);
MD5_CTX context;
- MD5Init(&context);
+ MD5_Init(&context);
if (fd_size)
{
@@ -602,13 +602,13 @@ static int fileHash(char* path, char* hash)
fread(buf, sizeof(char), fd_size, fd);
- MD5Update(&context, buf, fd_size);
+ MD5_Update(&context, buf, fd_size);
free(buf);
}
fclose(fd);
unsigned char digest[16];
- MD5Final(digest, &context);
+ MD5_Final(digest, &context);
char md5string[33];
for(int i = 0; i < 16; ++i)