httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From field...@locus.apache.org
Subject cvs commit: apache-2.0/src/support htdigest.c
Date Sun, 23 Apr 2000 02:32:59 GMT
fielding    00/04/22 19:32:59

  Modified:    src      CHANGES
               src/include util_md5.h
               src/lib/apr/include apr_md5.h
               src/lib/apr/lib apr_md5.c
               src/main http_core.c util_md5.c
               src/modules/proxy proxy_util.c
               src/support htdigest.c
  Removed:     src/include ap_md5.h
  Log:
  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
  
  Revision  Changes    Path
  1.78      +5 -0      apache-2.0/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/CHANGES,v
  retrieving revision 1.77
  retrieving revision 1.78
  diff -u -r1.77 -r1.78
  --- CHANGES	2000/04/21 22:12:37	1.77
  +++ CHANGES	2000/04/23 02:32:56	1.78
  @@ -1,4 +1,9 @@
   Changes with Apache 2.0a3-dev
  +
  +  *) Finished move of ap_md5 routines to apr_md5.  Removed ap_md5.h.
  +     Replaced more magic numbers with MD5_DIGESTSIZE.
  +     [William Rowe, Roy Fielding]
  +
     *) Win32: Get mod_auth_digest compiling and added to the Windows
        build environment. Not tested and I'd be suprised if it 
        actually works. [Bill Stoddard]
  
  
  
  1.10      +2 -2      apache-2.0/src/include/util_md5.h
  
  Index: util_md5.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/include/util_md5.h,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- util_md5.h	2000/04/14 15:58:17	1.9
  +++ util_md5.h	2000/04/23 02:32:56	1.10
  @@ -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
  
  
  
  1.9       +6 -6      apache-2.0/src/lib/apr/include/apr_md5.h
  
  Index: apr_md5.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_md5.h,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- apr_md5.h	2000/04/23 01:33:40	1.8
  +++ apr_md5.h	2000/04/23 02:32:57	1.9
  @@ -91,7 +91,7 @@
   extern "C" {
   #endif
   
  -/* MD5.H - header file for MD5C.C */
  +#define MD5_DIGESTSIZE 16
   
   /* UINT4 defines a four byte word */
   typedef unsigned int UINT4;
  @@ -101,14 +101,14 @@
       UINT4 state[4];		/* state (ABCD) */
       UINT4 count[2];		/* number of bits, modulo 2^64 (lsb first) */
       unsigned char buffer[64];	/* input buffer */
  -} ap_MD5_ctx_t;
  +} ap_md5_ctx_t;
   
  -API_EXPORT(ap_status_t) ap_MD5Init(ap_MD5_ctx_t * context);
  -API_EXPORT(ap_status_t) ap_MD5Update(ap_MD5_ctx_t *context,
  +API_EXPORT(ap_status_t) ap_MD5Init(ap_md5_ctx_t *context);
  +API_EXPORT(ap_status_t) ap_MD5Update(ap_md5_ctx_t *context,
                                        const unsigned char *input,
                                        unsigned int inputLen);
  -API_EXPORT(ap_status_t) ap_MD5Final(unsigned char digest[16],
  -                                    ap_MD5_ctx_t *context);
  +API_EXPORT(ap_status_t) ap_MD5Final(unsigned char digest[MD5_DIGESTSIZE],
  +                                    ap_md5_ctx_t *context);
   API_EXPORT(ap_status_t) ap_MD5Encode(const char *password, const char *salt,
                                        char *result, size_t nbytes);
   
  
  
  
  1.12      +15 -12    apache-2.0/src/lib/apr/lib/apr_md5.c
  
  Index: apr_md5.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/lib/apr_md5.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- apr_md5.c	2000/04/23 01:33:40	1.11
  +++ apr_md5.c	2000/04/23 02:32:57	1.12
  @@ -181,7 +181,7 @@
   
   /* MD5 initialization. Begins an MD5 operation, writing a new context.
    */
  -API_EXPORT(ap_status_t) ap_MD5Init(ap_MD5_ctx_t * context)
  +API_EXPORT(ap_status_t) ap_MD5Init(ap_md5_ctx_t *context)
   {
       context->count[0] = context->count[1] = 0;
       /* Load magic initialization constants. */
  @@ -196,8 +196,9 @@
      operation, processing another message block, and updating the
      context.
    */
  -API_EXPORT(ap_status_t) ap_MD5Update(ap_MD5_ctx_t * context, const unsigned char *input,
  -			   unsigned int inputLen)
  +API_EXPORT(ap_status_t) ap_MD5Update(ap_md5_ctx_t *context,
  +                                     const unsigned char *input,
  +                                     unsigned int inputLen)
   {
       unsigned int i, idx, partLen;
   
  @@ -252,7 +253,8 @@
   /* MD5 finalization. Ends an MD5 message-digest operation, writing the
      the message digest and zeroizing the context.
    */
  -API_EXPORT(ap_status_t) ap_MD5Final(unsigned char digest[16], ap_MD5_ctx_t * context)
  +API_EXPORT(ap_status_t) ap_MD5Final(unsigned char digest[MD5_DIGESTSIZE],
  +                                    ap_md5_ctx_t *context)
   {
       unsigned char bits[8];
       unsigned int idx, padLen;
  @@ -285,7 +287,7 @@
       ap_MD5Update(context, bits, 8);
   
       /* Store state in digest */
  -    Encode(digest, context->state, 16);
  +    Encode(digest, context->state, MD5_DIGESTSIZE);
   
       /* Zeroize sensitive information. */
       memset(context, 0, sizeof(*context));
  @@ -296,7 +298,8 @@
   /* MD5 basic transformation. Transforms state based on block. */
   static void MD5Transform(UINT4 state[4], const unsigned char block[64])
   {
  -    UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
  +    UINT4 a = state[0], b = state[1], c = state[2], d = state[3],
  +          x[MD5_DIGESTSIZE];
   
       Decode(x, block, 64);
   
  @@ -444,9 +447,9 @@
   
       char passwd[120], *p;
       const char *sp, *ep;
  -    unsigned char final[16];
  +    unsigned char final[MD5_DIGESTSIZE];
       int sl, pl, i;
  -    ap_MD5_ctx_t ctx, ctx1;
  +    ap_md5_ctx_t ctx, ctx1;
       unsigned long l;
   
       /* 
  @@ -503,8 +506,8 @@
       ap_MD5Update(&ctx1, (unsigned char *)sp, sl);
       ap_MD5Update(&ctx1, (unsigned char *)pw, strlen(pw));
       ap_MD5Final(final, &ctx1);
  -    for(pl = strlen(pw); pl > 0; pl -= 16) {
  -	ap_MD5Update(&ctx, final, (pl > 16) ? 16 : pl);
  +    for (pl = strlen(pw); pl > 0; pl -= MD5_DIGESTSIZE) {
  +	ap_MD5Update(&ctx, final, (pl > MD5_DIGESTSIZE) ? MD5_DIGESTSIZE : pl);
       }
   
       /*
  @@ -545,7 +548,7 @@
   	    ap_MD5Update(&ctx1, (unsigned char *)pw, strlen(pw));
   	}
   	else {
  -	    ap_MD5Update(&ctx1, final, 16);
  +	    ap_MD5Update(&ctx1, final, MD5_DIGESTSIZE);
   	}
   	if (i % 3) {
   	    ap_MD5Update(&ctx1, (unsigned char *)sp, sl);
  @@ -556,7 +559,7 @@
   	}
   
   	if (i & 1) {
  -	    ap_MD5Update(&ctx1, final, 16);
  +	    ap_MD5Update(&ctx1, final, MD5_DIGESTSIZE);
   	}
   	else {
   	    ap_MD5Update(&ctx1, (unsigned char *)pw, strlen(pw));
  
  
  
  1.50      +1 -1      apache-2.0/src/main/http_core.c
  
  Index: http_core.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_core.c,v
  retrieving revision 1.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- http_core.c	2000/04/22 22:54:29	1.49
  +++ http_core.c	2000/04/23 02:32:58	1.50
  @@ -2560,7 +2560,7 @@
       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);
  
  
  
  1.12      +6 -6      apache-2.0/src/main/util_md5.c
  
  Index: util_md5.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/util_md5.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- util_md5.c	2000/04/14 15:58:57	1.11
  +++ util_md5.c	2000/04/23 02:32:58	1.12
  @@ -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 @@
       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 @@
   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_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)
   {
  -    AP_MD5_CTX context;
  +    ap_md5_ctx_t context;
       unsigned char buf[1000];
       long length = 0;
       ap_ssize_t nbytes;
  
  
  
  1.11      +5 -5      apache-2.0/src/modules/proxy/proxy_util.c
  
  Index: proxy_util.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/proxy/proxy_util.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- proxy_util.c	2000/04/14 15:59:05	1.10
  +++ proxy_util.c	2000/04/23 02:32:58	1.11
  @@ -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 @@
    */
   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)
   {
  -    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;
  
  
  
  1.6       +5 -7      apache-2.0/src/support/htdigest.c
  
  Index: htdigest.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/support/htdigest.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- htdigest.c	2000/03/31 09:42:55	1.5
  +++ htdigest.c	2000/04/23 02:32:58	1.6
  @@ -69,10 +69,8 @@
    */
   
   #include "apr_lib.h"
  -#include "ap_config.h"
  -#include <sys/types.h>
  -#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 <signal.h>
   #else
  @@ -142,8 +140,8 @@
   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 @@
       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");
  
  
  

Mime
View raw message