diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/hash/md5/md5.h | 8 | ||||
-rw-r--r-- | src/hash/md5/md5c.c | 20 | ||||
-rw-r--r-- | src/toast.c | 6 |
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) |