From 9bb0d4df8c9bafd71cd90c15d483a2d648adcf5f Mon Sep 17 00:00:00 2001 From: stbuehler Date: Sun, 24 Apr 2011 16:20:06 +0000 Subject: [ssl/md5] prefix our own md5 implementation with li_ so it doesn't conflict with the openssl one (fixes #2269) git-svn-id: svn://svn.lighttpd.net/lighttpd/trunk@2791 152afb58-edef-0310-8abb-c4023f1b3aa9 --- NEWS | 1 + src/http_auth.c | 6 ++++++ src/http_auth_digest.c | 6 ++++++ src/md5.c | 24 ++++++++++++------------ src/md5.h | 8 ++++---- src/mod_secure_download.c | 6 ++++++ src/mod_usertrack.c | 6 ++++++ 7 files changed, 41 insertions(+), 16 deletions(-) diff --git a/NEWS b/NEWS index 17c4d0a9..c5b0a7f2 100644 --- a/NEWS +++ b/NEWS @@ -168,6 +168,7 @@ NEWS * proxy-backend-http: fix chunked encoding parser * more strict check for server.stat-cache-engine * Read hostname from absolute https:// uris in the request line (patch by Adrian Schröter ) + * [ssl/md5] prefix our own md5 implementation with li_ so it doesn't conflict with the openssl one (fixes #2269) - 1.5.0-r19.. - * -F option added for spawn-fcgi diff --git a/src/http_auth.c b/src/http_auth.c index b02f0233..70767139 100644 --- a/src/http_auth.c +++ b/src/http_auth.c @@ -38,6 +38,12 @@ # include #else # include "md5.h" + +typedef li_MD5_CTX MD5_CTX; +#define MD5_Init li_MD5_Init +#define MD5_Update li_MD5_Update +#define MD5_Final li_MD5_Final + #endif /** diff --git a/src/http_auth_digest.c b/src/http_auth_digest.c index e440430d..27b933ae 100644 --- a/src/http_auth_digest.c +++ b/src/http_auth_digest.c @@ -5,6 +5,12 @@ #ifndef USE_OPENSSL # include "md5.h" + +typedef li_MD5_CTX MD5_CTX; +#define MD5_Init li_MD5_Init +#define MD5_Update li_MD5_Update +#define MD5_Final li_MD5_Final + #endif void CvtHex(IN HASH Bin, OUT HASHHEX Hex) { diff --git a/src/md5.c b/src/md5.c index 72cb1462..b365fc41 100644 --- a/src/md5.c +++ b/src/md5.c @@ -52,7 +52,7 @@ documentation and/or software. #define S43 15 #define S44 21 -static void MD5Transform (UINT4 [4], const unsigned char [64]); +static void li_MD5Transform (UINT4 [4], const unsigned char [64]); static void Encode (unsigned char *, UINT4 *, unsigned int); static void Decode (UINT4 *, const unsigned char *, unsigned int); @@ -110,8 +110,8 @@ Rotation is separate from addition to prevent recomputation. /* MD5 initialization. Begins an MD5 operation, writing a new context. */ -void MD5_Init (context) -MD5_CTX *context; /* context */ +void li_MD5_Init (context) +li_MD5_CTX *context; /* context */ { context->count[0] = context->count[1] = 0; /* Load magic initialization constants. @@ -126,8 +126,8 @@ MD5_CTX *context; /* context */ operation, processing another message block, and updating the context. */ -void MD5_Update (context, input, inputLen) -MD5_CTX *context; /* context */ +void li_MD5_Update (context, input, inputLen) +li_MD5_CTX *context; /* context */ const unsigned char *input; /* input block */ unsigned int inputLen; /* length of input block */ { @@ -150,10 +150,10 @@ unsigned int inputLen; /* length of input block */ if (inputLen >= partLen) { MD5_memcpy ((POINTER)&context->buffer[ndx], (POINTER)input, partLen); - MD5Transform (context->state, context->buffer); + li_MD5Transform (context->state, context->buffer); for (i = partLen; i + 63 < inputLen; i += 64) - MD5Transform (context->state, &input[i]); + li_MD5Transform (context->state, &input[i]); ndx = 0; } @@ -169,9 +169,9 @@ 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 MD5_Final (digest, context) +void li_MD5_Final (digest, context) unsigned char digest[16]; /* message digest */ -MD5_CTX *context; /* context */ +li_MD5_CTX *context; /* context */ { unsigned char bits[8]; unsigned int ndx, padLen; @@ -183,10 +183,10 @@ MD5_CTX *context; /* context */ */ ndx = (unsigned int)((context->count[0] >> 3) & 0x3f); padLen = (ndx < 56) ? (56 - ndx) : (120 - ndx); - MD5_Update (context, PADDING, padLen); + li_MD5_Update (context, PADDING, padLen); /* Append length (before padding) */ - MD5_Update (context, bits, 8); + li_MD5_Update (context, bits, 8); /* Store state in digest */ Encode (digest, context->state, 16); @@ -198,7 +198,7 @@ MD5_CTX *context; /* context */ /* MD5 basic transformation. Transforms state based on block. */ -static void MD5Transform (state, block) +static void li_MD5Transform (state, block) UINT4 state[4]; const unsigned char block[64]; { diff --git a/src/md5.h b/src/md5.h index 6d122eef..fbcada0f 100644 --- a/src/md5.h +++ b/src/md5.h @@ -47,11 +47,11 @@ typedef struct { UINT4 state[4]; /* state (ABCD) */ UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */ unsigned char buffer[64]; /* input buffer */ -} MD5_CTX; +} li_MD5_CTX; -LI_API void MD5_Init (MD5_CTX *); -LI_API void MD5_Update (MD5_CTX *, const unsigned char *, unsigned int); -LI_API void MD5_Final (unsigned char [16], MD5_CTX *); +LI_API void li_MD5_Init (li_MD5_CTX *); +LI_API void li_MD5_Update (li_MD5_CTX *, const unsigned char *, unsigned int); +LI_API void li_MD5_Final (unsigned char [16], li_MD5_CTX *); diff --git a/src/mod_secure_download.c b/src/mod_secure_download.c index cbc4854b..a5d2b663 100644 --- a/src/mod_secure_download.c +++ b/src/mod_secure_download.c @@ -16,6 +16,12 @@ # include #else # include "md5.h" + +typedef li_MD5_CTX MD5_CTX; +#define MD5_Init li_MD5_Init +#define MD5_Update li_MD5_Update +#define MD5_Final li_MD5_Final + #endif #define HASHLEN 16 diff --git a/src/mod_usertrack.c b/src/mod_usertrack.c index 8ea3bf94..b0275107 100644 --- a/src/mod_usertrack.c +++ b/src/mod_usertrack.c @@ -12,6 +12,12 @@ # include #else # include "md5.h" + +typedef li_MD5_CTX MD5_CTX; +#define MD5_Init li_MD5_Init +#define MD5_Update li_MD5_Update +#define MD5_Final li_MD5_Final + #endif /* plugin config for all request/connections */ -- cgit v1.2.1