[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/branches/lighttpd-1.4.x@2788 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.29
Stefan Bühler 2011-04-24 16:02:52 +00:00
parent bf0d57d505
commit 328043caf3
4 changed files with 23 additions and 17 deletions

1
NEWS
View File

@ -11,6 +11,7 @@ NEWS
* ssl: Support for Diffie-Hellman and Elliptic-Curve Diffie-Hellman key exchange (fixes #2301)
add ssl.use-sslv3 (fixes #2246)
load all algorithms (fixes #2239)
* [ssl/md5] prefix our own md5 implementation with li_ so it doesn't conflict with the openssl one (fixes #2269)
- 1.4.28 - 2010-08-22
* Rename fdevent_event_add to _set to reflect what the function does. Fix some handlers. (fixes #2249)

View File

@ -32,6 +32,12 @@
# include <openssl/md5.h>
#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
/**

View File

@ -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 void *_input; /* input block */
unsigned int inputLen; /* length of input block */
{
@ -151,10 +151,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;
}
@ -170,9 +170,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;
@ -184,10 +184,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);
@ -199,7 +199,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];
{

View File

@ -39,9 +39,8 @@ 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;
void MD5_Init (MD5_CTX *);
void MD5_Update (MD5_CTX *, const void *, unsigned int);
void MD5_Final (unsigned char [16], MD5_CTX *);
} li_MD5_CTX;
void li_MD5_Init (li_MD5_CTX *);
void li_MD5_Update (li_MD5_CTX *, const void *, unsigned int);
void li_MD5_Final (unsigned char [16], li_MD5_CTX *);