manoj 99/08/05 13:04:05
Modified: src/ap ap_sha1.c src/include ap_md5.h ap_sha1.h src/main http_main.c Log: Fix a couple of nits which also cause problems on TPF: - get rid of the "const" in a const void function definition - prefix BYTE and LONG with AP_ in ap_sha1.[ch]. BYTE is already defined on TPF - prepend a couple of declarations with extern, so they don't end up as double definitions. Revision Changes Path 1.3 +23 -23 apache-1.3/src/ap/ap_sha1.c Index: ap_sha1.c =================================================================== RCS file: /home/cvs/apache-1.3/src/ap/ap_sha1.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -u -r1.2 -r1.3 --- ap_sha1.c 1999/08/02 20:50:12 1.2 +++ ap_sha1.c 1999/08/05 20:04:01 1.3 @@ -133,21 +133,21 @@ temp = ROT32(A,5) + f##n(B,C,D) + E + W[i] + CONST##n; \ E = D; D = C; C = ROT32(B,30); B = A; A = temp -typedef unsigned char BYTE; /* an 8-bit quantity */ -typedef unsigned long LONG; /* a 32-bit quantity */ +typedef unsigned char AP_BYTE; /* an 8-bit quantity */ +typedef unsigned long AP_LONG; /* a 32-bit quantity */ #define SHA_BLOCKSIZE 64 #define SHA_DIGESTSIZE 20 typedef struct { - LONG digest[5]; /* message digest */ - LONG count_lo, count_hi; /* 64-bit bit count */ - LONG data[16]; /* SHA data buffer */ + AP_LONG digest[5]; /* message digest */ + AP_LONG count_lo, count_hi; /* 64-bit bit count */ + AP_LONG data[16]; /* SHA data buffer */ int local; /* unprocessed amount in data */ } SHA_INFO; static void sha_init(SHA_INFO *); -static void sha_update(SHA_INFO *, const BYTE *, int); +static void sha_update(SHA_INFO *, const AP_BYTE *, int); static void sha_final(SHA_INFO *); static void sha_raw_swap(SHA_INFO *); static void output64chunk(unsigned char, unsigned char, unsigned char, @@ -159,7 +159,7 @@ static void sha_transform(SHA_INFO *sha_info) { int i; - LONG temp, A, B, C, D, E, W[80]; + AP_LONG temp, A, B, C, D, E, W[80]; for (i = 0; i < 16; ++i) { W[i] = sha_info->data[i]; @@ -231,14 +231,14 @@ /* change endianness of data */ /* count is the number of bytes to do an endian flip */ -static void maybe_byte_reverse(LONG *buffer, int count) +static void maybe_byte_reverse(AP_LONG *buffer, int count) { int i; - BYTE ct[4], *cp; + AP_BYTE ct[4], *cp; if (isLittleEndian()) { /* do the swap only if it is little endian */ - count /= sizeof(LONG); - cp = (BYTE *) buffer; + count /= sizeof(AP_LONG); + cp = (AP_BYTE *) buffer; for (i = 0; i < count; ++i) { ct[0] = cp[0]; ct[1] = cp[1]; @@ -248,7 +248,7 @@ cp[1] = ct[2]; cp[2] = ct[1]; cp[3] = ct[0]; - cp += sizeof(LONG); + cp += sizeof(AP_LONG); } } } @@ -269,21 +269,21 @@ /* update the SHA digest */ -static void sha_update(SHA_INFO *sha_info, const BYTE *buffer, int count) +static void sha_update(SHA_INFO *sha_info, const AP_BYTE *buffer, int count) { int i; - if ((sha_info->count_lo + ((LONG) count << 3)) < sha_info->count_lo) { + if ((sha_info->count_lo + ((AP_LONG) count << 3)) < sha_info->count_lo) { ++sha_info->count_hi; } - sha_info->count_lo += (LONG) count << 3; - sha_info->count_hi += (LONG) count >> 29; + sha_info->count_lo += (AP_LONG) count << 3; + sha_info->count_hi += (AP_LONG) count >> 29; if (sha_info->local) { i = SHA_BLOCKSIZE - sha_info->local; if (i > count) { i = count; } - memcpy(((BYTE *) sha_info->data) + sha_info->local, buffer, i); + memcpy(((AP_BYTE *) sha_info->data) + sha_info->local, buffer, i); count -= i; buffer += i; sha_info->local += i; @@ -311,20 +311,20 @@ static void sha_final(SHA_INFO *sha_info) { int count; - LONG lo_bit_count, hi_bit_count; + AP_LONG lo_bit_count, hi_bit_count; lo_bit_count = sha_info->count_lo; hi_bit_count = sha_info->count_hi; count = (int) ((lo_bit_count >> 3) & 0x3f); - ((BYTE *) sha_info->data)[count++] = 0x80; + ((AP_BYTE *) sha_info->data)[count++] = 0x80; if (count > SHA_BLOCKSIZE - 8) { - memset(((BYTE *) sha_info->data) + count, 0, SHA_BLOCKSIZE - count); + memset(((AP_BYTE *) sha_info->data) + count, 0, SHA_BLOCKSIZE - count); maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE); sha_transform(sha_info); - memset((BYTE *) sha_info->data, 0, SHA_BLOCKSIZE - 8); + memset((AP_BYTE *) sha_info->data, 0, SHA_BLOCKSIZE - 8); } else { - memset(((BYTE *) sha_info->data) + count, 0, + memset(((AP_BYTE *) sha_info->data) + count, 0, SHA_BLOCKSIZE - 8 - count); } maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE); @@ -344,7 +344,7 @@ int i; for (i = 0; i < 5; ++i) { - maybe_byte_reverse((LONG *) &sha_info->digest[i], 4); + maybe_byte_reverse((AP_LONG *) &sha_info->digest[i], 4); } } 1.8 +1 -1 apache-1.3/src/include/ap_md5.h Index: ap_md5.h =================================================================== RCS file: /home/cvs/apache-1.3/src/include/ap_md5.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -u -r1.7 -r1.8 --- ap_md5.h 1999/08/02 20:50:14 1.7 +++ ap_md5.h 1999/08/05 20:04:02 1.8 @@ -104,7 +104,7 @@ unsigned char buffer[64]; /* input buffer */ } AP_MD5_CTX; -const char *apr1_id; /* MD5 passwd marker string */ +extern const char *apr1_id; /* MD5 passwd marker string */ API_EXPORT(void) ap_MD5Init(AP_MD5_CTX *context); API_EXPORT(void) ap_MD5Update(AP_MD5_CTX *context, const unsigned char *input, 1.3 +1 -1 apache-1.3/src/include/ap_sha1.h Index: ap_sha1.h =================================================================== RCS file: /home/cvs/apache-1.3/src/include/ap_sha1.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -u -r1.2 -r1.3 --- ap_sha1.h 1999/08/02 20:50:15 1.2 +++ ap_sha1.h 1999/08/05 20:04:03 1.3 @@ -84,7 +84,7 @@ extern "C" { #endif -const char *sha1_id; /* passwd prefix marker for SHA1 */ +extern const char *sha1_id; /* passwd prefix marker for SHA1 */ API_EXPORT(void) ap_sha1_base64(const char *clear, int len, char *out); #ifdef __cplusplus 1.467 +1 -1 apache-1.3/src/main/http_main.c Index: http_main.c =================================================================== RCS file: /home/cvs/apache-1.3/src/main/http_main.c,v retrieving revision 1.466 retrieving revision 1.467 diff -u -d -u -r1.466 -r1.467 --- http_main.c 1999/08/02 20:50:20 1.466 +++ http_main.c 1999/08/05 20:04:04 1.467 @@ -6648,7 +6648,7 @@ * Force ap_validate_password() into the image so that modules like * mod_auth can use it even if they're dynamically loaded. */ -const void suck_in_ap_validate_password(void) +void suck_in_ap_validate_password(void) { ap_validate_password("a", "b"); }