From 62d8d1ef53fe9f1d29a6c693290cf4e2030b83e3 Mon Sep 17 00:00:00 2001 From: Jan Kneschke Date: Thu, 17 Nov 2005 14:39:07 +0000 Subject: [PATCH] fixed md5 on 64bit platforms git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@856 152afb58-edef-0310-8abb-c4023f1b3aa9 --- src/Makefile.am | 2 +- src/http_auth.c | 1 - src/http_auth_digest.c | 1 - src/md5.c | 13 +++++-------- src/md5.h | 18 ++++++++++++++---- src/md5_global.h | 31 ------------------------------- src/mod_cml_funcs.c | 1 - src/mod_cml_lua.c | 1 - src/mod_secure_download.c | 1 - src/mod_usertrack.c | 1 - 10 files changed, 20 insertions(+), 50 deletions(-) delete mode 100644 src/md5_global.h diff --git a/src/Makefile.am b/src/Makefile.am index 3d870273..8caace22 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -220,7 +220,7 @@ mod_accesslog_la_LIBADD = $(common_libadd) hdr = server.h buffer.h network.h log.h keyvalue.h \ response.h request.h fastcgi.h chunk.h \ settings.h http_chunk.h http_auth_digest.h \ - md5.h md5_global.h http_auth.h stream.h \ + md5.h http_auth.h stream.h \ fdevent.h connections.h base.h stat_cache.h \ plugin.h mod_auth.h \ etag.h joblist.h array.h crc32.h \ diff --git a/src/http_auth.c b/src/http_auth.c index 274537d4..8bdb2512 100644 --- a/src/http_auth.c +++ b/src/http_auth.c @@ -34,7 +34,6 @@ #ifdef USE_OPENSSL # include #else -# include "md5_global.h" # include "md5.h" #endif diff --git a/src/http_auth_digest.c b/src/http_auth_digest.c index 6da57bf0..8f7086fb 100644 --- a/src/http_auth_digest.c +++ b/src/http_auth_digest.c @@ -4,7 +4,6 @@ #include "buffer.h" #ifndef USE_OPENSSL -# include "md5_global.h" # include "md5.h" #endif diff --git a/src/md5.c b/src/md5.c index edd1e828..8b688f64 100644 --- a/src/md5.c +++ b/src/md5.c @@ -30,7 +30,6 @@ documentation and/or software. #ifndef USE_OPENSSL #include -#include "md5_global.h" #include "md5.h" /* Constants for MD5Transform routine. @@ -53,21 +52,19 @@ documentation and/or software. #define S43 15 #define S44 21 -static void MD5Transform PROTO_LIST ((UINT4 [4], unsigned char [64])); -static void Encode PROTO_LIST - ((unsigned char *, UINT4 *, unsigned int)); -static void Decode PROTO_LIST - ((UINT4 *, unsigned char *, unsigned int)); +static void MD5Transform (UINT4 [4], unsigned char [64]); +static void Encode (unsigned char *, UINT4 *, unsigned int); +static void Decode (UINT4 *, unsigned char *, unsigned int); #ifdef HAVE_MEMCPY #define MD5_memcpy(output, input, len) memcpy((output), (input), (len)) #else -static void MD5_memcpy PROTO_LIST ((POINTER, POINTER, unsigned int)); +static void MD5_memcpy (POINTER, POINTER, unsigned int); #endif #ifdef HAVE_MEMSET #define MD5_memset(output, value, len) memset((output), (value), (len)) #else -static void MD5_memset PROTO_LIST ((POINTER, int, unsigned int)); +static void MD5_memset (POINTER, int, unsigned int); #endif static unsigned char PADDING[64] = { diff --git a/src/md5.h b/src/md5.h index 4b601484..a1c0d761 100644 --- a/src/md5.h +++ b/src/md5.h @@ -22,6 +22,17 @@ 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. */ +#include +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif + +#define UINT4 uint32_t +#define UINT2 uint16_t +#define POINTER unsigned char * /* MD5 context. */ typedef struct { @@ -30,8 +41,7 @@ typedef struct { unsigned char buffer[64]; /* input buffer */ } MD5_CTX; -void MD5_Init PROTO_LIST ((MD5_CTX *)); -void MD5_Update PROTO_LIST - ((MD5_CTX *, unsigned char *, unsigned int)); -void MD5_Final PROTO_LIST ((unsigned char [16], MD5_CTX *)); +void MD5_Init (MD5_CTX *); +void MD5_Update (MD5_CTX *, unsigned char *, unsigned int); +void MD5_Final (unsigned char [16], MD5_CTX *); diff --git a/src/md5_global.h b/src/md5_global.h deleted file mode 100644 index 6a5c94ff..00000000 --- a/src/md5_global.h +++ /dev/null @@ -1,31 +0,0 @@ -/* GLOBAL.H - RSAREF types and constants - */ - -/* PROTOTYPES should be set to one if and only if the compiler supports - function argument prototyping. -The following makes PROTOTYPES default to 0 if it has not already - - been defined with C compiler flags. - */ -#ifndef PROTOTYPES -#define PROTOTYPES 0 -#endif - -/* POINTER defines a generic pointer type */ -typedef unsigned char *POINTER; - -/* UINT2 defines a two byte word */ -typedef unsigned short int UINT2; - -/* UINT4 defines a four byte word */ -typedef unsigned long int UINT4; - -/* PROTO_LIST is defined depending on how PROTOTYPES is defined above. -If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it - returns an empty list. - */ -#if PROTOTYPES -#define PROTO_LIST(list) list -#else -#define PROTO_LIST(list) () -#endif diff --git a/src/mod_cml_funcs.c b/src/mod_cml_funcs.c index c3e251bb..46a1f16e 100644 --- a/src/mod_cml_funcs.c +++ b/src/mod_cml_funcs.c @@ -20,7 +20,6 @@ #ifdef USE_OPENSSL # include #else -# include "md5_global.h" # include "md5.h" #endif diff --git a/src/mod_cml_lua.c b/src/mod_cml_lua.c index b72a8260..384b2069 100644 --- a/src/mod_cml_lua.c +++ b/src/mod_cml_lua.c @@ -13,7 +13,6 @@ #ifdef USE_OPENSSL # include #else -# include "md5_global.h" # include "md5.h" #endif diff --git a/src/mod_secure_download.c b/src/mod_secure_download.c index 6d714c4d..51395078 100644 --- a/src/mod_secure_download.c +++ b/src/mod_secure_download.c @@ -15,7 +15,6 @@ #ifdef USE_OPENSSL # include #else -# include "md5_global.h" # include "md5.h" #endif diff --git a/src/mod_usertrack.c b/src/mod_usertrack.c index a9d42345..25fb8ec2 100644 --- a/src/mod_usertrack.c +++ b/src/mod_usertrack.c @@ -11,7 +11,6 @@ #ifdef USE_OPENSSL # include #else -# include "md5_global.h" # include "md5.h" #endif