From: Roy T. Fielding Date: Sun, 23 Apr 2000 02:32:58 +0000 (+0000) Subject: Finished move of ap_md5 routines to apr_md5. Removed ap_md5.h. X-Git-Tag: APACHE_2_0_ALPHA_3~63 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7cbb1cb050511156e5e4a6a1e8b3923f0d383f7a;p=thirdparty%2Fapache%2Fhttpd.git Finished move of ap_md5 routines to apr_md5. Removed ap_md5.h. Replaced more magic numbers with MD5_DIGESTSIZE. Yuck. Submitted by: William Rowe, Roy Fielding git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85017 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/include/util_md5.h b/include/util_md5.h index 9f94e265a5b..5f03ccfa3e3 100644 --- a/include/util_md5.h +++ b/include/util_md5.h @@ -63,11 +63,11 @@ extern "C" { #endif -#include "ap_md5.h" +#include "apr_md5.h" API_EXPORT(char *) ap_md5(ap_pool_t *a, const unsigned char *string); API_EXPORT(char *) ap_md5_binary(ap_pool_t *a, const unsigned char *buf, int len); -API_EXPORT(char *) ap_md5contextTo64(ap_pool_t *p, AP_MD5_CTX * context); +API_EXPORT(char *) ap_md5contextTo64(ap_pool_t *p, ap_md5_ctx_t *context); API_EXPORT(char *) ap_md5digest(ap_pool_t *p, ap_file_t *infile); #ifdef __cplusplus diff --git a/modules/http/http_core.c b/modules/http/http_core.c index 25d9b7e464b..63f55a324b2 100644 --- a/modules/http/http_core.c +++ b/modules/http/http_core.c @@ -2560,7 +2560,7 @@ static int default_handler(request_rec *r) ap_mmap_offset((void**)&addr, mm ,0); if (d->content_md5 & 1) { - AP_MD5_CTX context; + ap_md5_ctx_t context; ap_MD5Init(&context); ap_MD5Update(&context, addr, (unsigned int)r->finfo.size); diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c index 8380258870b..79f346ab96a 100644 --- a/modules/proxy/proxy_util.c +++ b/modules/proxy/proxy_util.c @@ -59,7 +59,7 @@ /* Utility routines for Apache proxy */ #include "mod_proxy.h" #include "http_main.h" -#include "ap_md5.h" +#include "apr_md5.h" #include "http_log.h" #include "util_uri.h" #include "util_date.h" /* get ap_checkmask() decl. */ @@ -667,8 +667,8 @@ int ap_proxy_liststr(const char *list, const char *val) */ void ap_proxy_hash(const char *it, char *val, int ndepth, int nlength) { - AP_MD5_CTX context; - unsigned char digest[16]; + ap_md5_ctx_t context; + unsigned char digest[MD5_DIGESTSIZE]; char tmp[26]; int i, k, d; unsigned int x; @@ -714,8 +714,8 @@ void ap_proxy_hash(const char *it, char *val, int ndepth, int nlength) void ap_proxy_hash(const char *it, char *val, int ndepth, int nlength) { - AP_MD5_CTX context; - unsigned char digest[16]; + ap_md5_ctx_t context; + unsigned char digest[MD5_DIGESTSIZE]; char tmp[22]; int i, k, d; unsigned int x; diff --git a/server/util_md5.c b/server/util_md5.c index 8af5cc61624..f9e58ad127f 100644 --- a/server/util_md5.c +++ b/server/util_md5.c @@ -93,8 +93,8 @@ API_EXPORT(char *) ap_md5_binary(ap_pool_t *p, const unsigned char *buf, int length) { const char *hex = "0123456789abcdef"; - AP_MD5_CTX my_md5; - unsigned char hash[16]; + ap_md5_ctx_t my_md5; + unsigned char hash[MD5_DIGESTSIZE]; char *r, result[33]; int i; @@ -106,7 +106,7 @@ API_EXPORT(char *) ap_md5_binary(ap_pool_t *p, const unsigned char *buf, int len ap_MD5Update(&my_md5, buf, (unsigned int)length); ap_MD5Final(hash, &my_md5); - for (i = 0, r = result; i < 16; i++) { + for (i = 0, r = result; i < MD5_DIGESTSIZE; i++) { *r++ = hex[hash[i] >> 4]; *r++ = hex[hash[i] & 0xF]; } @@ -165,7 +165,7 @@ API_EXPORT(char *) ap_md5(ap_pool_t *p, const unsigned char *string) static char basis_64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; -API_EXPORT(char *) ap_md5contextTo64(ap_pool_t *a, AP_MD5_CTX * context) +API_EXPORT(char *) ap_md5contextTo64(ap_pool_t *a, ap_md5_ctx_t *context) { unsigned char digest[18]; char *encodedDigest; @@ -194,7 +194,7 @@ API_EXPORT(char *) ap_md5contextTo64(ap_pool_t *a, AP_MD5_CTX * context) API_EXPORT(char *) ap_md5digest(ap_pool_t *p, ap_file_t *infile, int convert) { - AP_MD5_CTX context; + ap_md5_ctx_t context; unsigned char buf[1000]; long length = 0; int nbytes; @@ -216,7 +216,7 @@ API_EXPORT(char *) ap_md5digest(ap_pool_t *p, ap_file_t *infile, int convert) API_EXPORT(char *) ap_md5digest(ap_pool_t *p, ap_file_t *infile) { - AP_MD5_CTX context; + ap_md5_ctx_t context; unsigned char buf[1000]; long length = 0; ap_ssize_t nbytes; diff --git a/support/htdigest.c b/support/htdigest.c index 8730c5f3458..0b2c176da32 100644 --- a/support/htdigest.c +++ b/support/htdigest.c @@ -69,10 +69,8 @@ */ #include "apr_lib.h" -#include "ap_config.h" -#include -#include "ap.h" -#include "ap_md5.h" +#include "apr_md5.h" +#include "apr_portable.h" #if defined(MPE) || defined(QNX) || defined(WIN32) || defined(__TANDEM) || defined(BEOS) #include #else @@ -142,8 +140,8 @@ static void putline(FILE *f, char *l) static void add_password(char *user, char *realm, FILE *f) { char *pw; - AP_MD5_CTX context; - unsigned char digest[16]; + ap_md5_ctx_t context; + unsigned char digest[MD5_DIGESTSIZE]; char string[MAX_STRING_LEN]; char pwin[MAX_STRING_LEN]; char pwv[MAX_STRING_LEN]; @@ -174,7 +172,7 @@ static void add_password(char *user, char *realm, FILE *f) ap_MD5Update(&context, (unsigned char *) string, strlen(string)); ap_MD5Final(digest, &context); - for (i = 0; i < 16; i++) + for (i = 0; i < MD5_DIGESTSIZE; i++) fprintf(f, "%02x", digest[i]); fprintf(f, "\n");