openbsd-ports/www/lighttpd/patches/patch-src_md5_c
sthen 5262fc0208 - backport a patch from upstream to avoid a conflict between OpenSSL and
internal implementations of MD5. Fixes SSL problems with some clients.

From Brad
2011-04-25 09:39:36 +00:00

85 lines
3.2 KiB
Plaintext

$OpenBSD: patch-src_md5_c,v 1.1 2011/04/25 09:39:36 sthen Exp $
http://redmine.lighttpd.net/issues/2269
--- src/md5.c.orig Sun Apr 24 22:03:40 2011
+++ src/md5.c Sun Apr 24 22:07:52 2011
@@ -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 recomput
/* 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;
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 o
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 o
/* 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;
*/
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;
/* 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];
{