summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crypto/ap_sha1.c383
-rw-r--r--crypto/apr_sha1.c383
-rw-r--r--encoding/ap_base64.c272
-rw-r--r--encoding/apr_base64.c272
-rw-r--r--hooks/ap_hooks.c220
-rw-r--r--hooks/apr_hooks.c220
-rw-r--r--include/apr_hooks.h127
-rw-r--r--include/apr_sha1.h102
8 files changed, 0 insertions, 1979 deletions
diff --git a/crypto/ap_sha1.c b/crypto/ap_sha1.c
deleted file mode 100644
index 1d4d9ea4..00000000
--- a/crypto/ap_sha1.c
+++ /dev/null
@@ -1,383 +0,0 @@
-/* ====================================================================
- * Copyright (c) 1996-1999 The Apache Group. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * 4. The names "Apache Server" and "Apache Group" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Group and was originally based
- * on public domain software written at the National Center for
- * Supercomputing Applications, University of Illinois, Urbana-Champaign.
- * For more information on the Apache Group and the Apache HTTP server
- * project, please see <http://www.apache.org/>.
- *
- * The exported function:
- *
- * ap_sha1_base64(const char *clear, int len, char *out);
- *
- * provides a means to SHA1 crypt/encode a plaintext password in
- * a way which makes password files compatible with those commonly
- * used in netscape web and ldap installations. It was put together
- * by Clinton Wong <clintdw@netcom.com>, who also notes that:
- *
- * Note: SHA1 support is useful for migration purposes, but is less
- * secure than Apache's password format, since Apache's (MD5)
- * password format uses a random eight character salt to generate
- * one of many possible hashes for the same password. Netscape
- * uses plain SHA1 without a salt, so the same password
- * will always generate the same hash, making it easier
- * to break since the search space is smaller.
- *
- * See also the documentation in support/SHA1 as to hints on how to
- * migrate an existing netscape installation and other supplied utitlites.
- *
- * This software also makes use of the following component:
- *
- * NIST Secure Hash Algorithm
- * heavily modified by Uwe Hollerbach uh@alumni.caltech edu
- * from Peter C. Gutmann's implementation as found in
- * Applied Cryptography by Bruce Schneier
- * This code is hereby placed in the public domain
- */
-
-#include <string.h>
-
-#include "ap_config.h"
-#include "ap_sha1.h"
-#include "ap.h"
-#ifdef CHARSET_EBCDIC
-#include "ebcdic.h"
-#endif /*CHARSET_EBCDIC*/
-
-/* a bit faster & bigger, if defined */
-#define UNROLL_LOOPS
-
-/* NIST's proposed modification to SHA, 7/11/94 */
-#define USE_MODIFIED_SHA
-
-/* SHA f()-functions */
-#define f1(x,y,z) ((x & y) | (~x & z))
-#define f2(x,y,z) (x ^ y ^ z)
-#define f3(x,y,z) ((x & y) | (x & z) | (y & z))
-#define f4(x,y,z) (x ^ y ^ z)
-
-/* SHA constants */
-#define CONST1 0x5a827999L
-#define CONST2 0x6ed9eba1L
-#define CONST3 0x8f1bbcdcL
-#define CONST4 0xca62c1d6L
-
-/* 32-bit rotate */
-
-#define ROT32(x,n) ((x << n) | (x >> (32 - n)))
-
-#define FUNC(n,i) \
- 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
-
-#define SHA_BLOCKSIZE 64
-
-typedef unsigned char AP_BYTE;
-
-/* do SHA transformation */
-static void sha_transform(AP_SHA1_CTX *sha_info)
-{
- int i;
- AP_LONG temp, A, B, C, D, E, W[80];
-
- for (i = 0; i < 16; ++i) {
- W[i] = sha_info->data[i];
- }
- for (i = 16; i < 80; ++i) {
- W[i] = W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16];
-#ifdef USE_MODIFIED_SHA
- W[i] = ROT32(W[i], 1);
-#endif /* USE_MODIFIED_SHA */
- }
- A = sha_info->digest[0];
- B = sha_info->digest[1];
- C = sha_info->digest[2];
- D = sha_info->digest[3];
- E = sha_info->digest[4];
-#ifdef UNROLL_LOOPS
- FUNC(1, 0); FUNC(1, 1); FUNC(1, 2); FUNC(1, 3); FUNC(1, 4);
- FUNC(1, 5); FUNC(1, 6); FUNC(1, 7); FUNC(1, 8); FUNC(1, 9);
- FUNC(1,10); FUNC(1,11); FUNC(1,12); FUNC(1,13); FUNC(1,14);
- FUNC(1,15); FUNC(1,16); FUNC(1,17); FUNC(1,18); FUNC(1,19);
-
- FUNC(2,20); FUNC(2,21); FUNC(2,22); FUNC(2,23); FUNC(2,24);
- FUNC(2,25); FUNC(2,26); FUNC(2,27); FUNC(2,28); FUNC(2,29);
- FUNC(2,30); FUNC(2,31); FUNC(2,32); FUNC(2,33); FUNC(2,34);
- FUNC(2,35); FUNC(2,36); FUNC(2,37); FUNC(2,38); FUNC(2,39);
-
- FUNC(3,40); FUNC(3,41); FUNC(3,42); FUNC(3,43); FUNC(3,44);
- FUNC(3,45); FUNC(3,46); FUNC(3,47); FUNC(3,48); FUNC(3,49);
- FUNC(3,50); FUNC(3,51); FUNC(3,52); FUNC(3,53); FUNC(3,54);
- FUNC(3,55); FUNC(3,56); FUNC(3,57); FUNC(3,58); FUNC(3,59);
-
- FUNC(4,60); FUNC(4,61); FUNC(4,62); FUNC(4,63); FUNC(4,64);
- FUNC(4,65); FUNC(4,66); FUNC(4,67); FUNC(4,68); FUNC(4,69);
- FUNC(4,70); FUNC(4,71); FUNC(4,72); FUNC(4,73); FUNC(4,74);
- FUNC(4,75); FUNC(4,76); FUNC(4,77); FUNC(4,78); FUNC(4,79);
-#else /* !UNROLL_LOOPS */
- for (i = 0; i < 20; ++i) {
- FUNC(1,i);
- }
- for (i = 20; i < 40; ++i) {
- FUNC(2,i);
- }
- for (i = 40; i < 60; ++i) {
- FUNC(3,i);
- }
- for (i = 60; i < 80; ++i) {
- FUNC(4,i);
- }
-#endif /* !UNROLL_LOOPS */
- sha_info->digest[0] += A;
- sha_info->digest[1] += B;
- sha_info->digest[2] += C;
- sha_info->digest[3] += D;
- sha_info->digest[4] += E;
-}
-
-union endianTest {
- long Long;
- char Char[sizeof(long)];
-};
-
-static char isLittleEndian(void)
-{
- static union endianTest u;
- u.Long = 1;
- return (u.Char[0] == 1);
-}
-
-/* change endianness of data */
-
-/* count is the number of bytes to do an endian flip */
-static void maybe_byte_reverse(AP_LONG *buffer, int count)
-{
- int i;
- AP_BYTE ct[4], *cp;
-
- if (isLittleEndian()) { /* do the swap only if it is little endian */
- count /= sizeof(AP_LONG);
- cp = (AP_BYTE *) buffer;
- for (i = 0; i < count; ++i) {
- ct[0] = cp[0];
- ct[1] = cp[1];
- ct[2] = cp[2];
- ct[3] = cp[3];
- cp[0] = ct[3];
- cp[1] = ct[2];
- cp[2] = ct[1];
- cp[3] = ct[0];
- cp += sizeof(AP_LONG);
- }
- }
-}
-
-/* initialize the SHA digest */
-
-API_EXPORT(void) ap_SHA1Init(AP_SHA1_CTX *sha_info)
-{
- sha_info->digest[0] = 0x67452301L;
- sha_info->digest[1] = 0xefcdab89L;
- sha_info->digest[2] = 0x98badcfeL;
- sha_info->digest[3] = 0x10325476L;
- sha_info->digest[4] = 0xc3d2e1f0L;
- sha_info->count_lo = 0L;
- sha_info->count_hi = 0L;
- sha_info->local = 0;
-}
-
-/* update the SHA digest */
-
-API_EXPORT(void) ap_SHA1Update_binary(AP_SHA1_CTX *sha_info,
- const unsigned char *buffer,
- unsigned int count)
-{
- unsigned int i;
-
- if ((sha_info->count_lo + ((AP_LONG) count << 3)) < sha_info->count_lo) {
- ++sha_info->count_hi;
- }
- 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(((AP_BYTE *) sha_info->data) + sha_info->local, buffer, i);
- count -= i;
- buffer += i;
- sha_info->local += i;
- if (sha_info->local == SHA_BLOCKSIZE) {
- maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE);
- sha_transform(sha_info);
- }
- else {
- return;
- }
- }
- while (count >= SHA_BLOCKSIZE) {
- memcpy(sha_info->data, buffer, SHA_BLOCKSIZE);
- buffer += SHA_BLOCKSIZE;
- count -= SHA_BLOCKSIZE;
- maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE);
- sha_transform(sha_info);
- }
- memcpy(sha_info->data, buffer, count);
- sha_info->local = count;
-}
-
-API_EXPORT(void) ap_SHA1Update(AP_SHA1_CTX *sha_info, const char *buf,
- unsigned int count)
-{
-#ifdef CHARSET_EBCDIC
- int i;
- const AP_BYTE *buffer = (const AP_BYTE *) buf;
-
- if ((sha_info->count_lo + ((AP_LONG) count << 3)) < sha_info->count_lo) {
- ++sha_info->count_hi;
- }
- sha_info->count_lo += (AP_LONG) count << 3;
- sha_info->count_hi += (AP_LONG) count >> 29;
- /* Is there a remainder of the previous Update operation? */
- if (sha_info->local) {
- i = SHA_BLOCKSIZE - sha_info->local;
- if (i > count) {
- i = count;
- }
- ebcdic2ascii_strictly(((AP_BYTE *) sha_info->data) + sha_info->local,
- buffer, i);
- count -= i;
- buffer += i;
- sha_info->local += i;
- if (sha_info->local == SHA_BLOCKSIZE) {
- maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE);
- sha_transform(sha_info);
- }
- else {
- return;
- }
- }
- while (count >= SHA_BLOCKSIZE) {
- ebcdic2ascii_strictly((AP_BYTE *)sha_info->data, buffer, SHA_BLOCKSIZE);
- buffer += SHA_BLOCKSIZE;
- count -= SHA_BLOCKSIZE;
- maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE);
- sha_transform(sha_info);
- }
- ebcdic2ascii_strictly((AP_BYTE *)sha_info->data, buffer, count);
- sha_info->local = count;
-#else
- ap_SHA1Update_binary(sha_info, (const unsigned char *) buf, count);
-#endif
-}
-
-/* finish computing the SHA digest */
-
-API_EXPORT(void) ap_SHA1Final(unsigned char digest[SHA_DIGESTSIZE],
- AP_SHA1_CTX *sha_info)
-{
- int count, i, j;
- AP_LONG lo_bit_count, hi_bit_count, k;
-
- lo_bit_count = sha_info->count_lo;
- hi_bit_count = sha_info->count_hi;
- count = (int) ((lo_bit_count >> 3) & 0x3f);
- ((AP_BYTE *) sha_info->data)[count++] = 0x80;
- if (count > SHA_BLOCKSIZE - 8) {
- memset(((AP_BYTE *) sha_info->data) + count, 0, SHA_BLOCKSIZE - count);
- maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE);
- sha_transform(sha_info);
- memset((AP_BYTE *) sha_info->data, 0, SHA_BLOCKSIZE - 8);
- }
- else {
- memset(((AP_BYTE *) sha_info->data) + count, 0,
- SHA_BLOCKSIZE - 8 - count);
- }
- maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE);
- sha_info->data[14] = hi_bit_count;
- sha_info->data[15] = lo_bit_count;
- sha_transform(sha_info);
-
- for (i = 0, j = 0; j < SHA_DIGESTSIZE; i++) {
- k = sha_info->digest[i];
- digest[j++] = (unsigned char) ((k >> 24) & 0xff);
- digest[j++] = (unsigned char) ((k >> 16) & 0xff);
- digest[j++] = (unsigned char) ((k >> 8) & 0xff);
- digest[j++] = (unsigned char) (k & 0xff);
- }
-}
-
-
-API_EXPORT(void) ap_sha1_base64(const char *clear, int len, char *out)
-{
- int l;
- AP_SHA1_CTX context;
- AP_BYTE digest[SHA_DIGESTSIZE];
-
- if (strncmp(clear, AP_SHA1PW_ID, AP_SHA1PW_IDLEN) == 0) {
- clear += AP_SHA1PW_IDLEN;
- }
-
- ap_SHA1Init(&context);
- ap_SHA1Update(&context, clear, len);
- ap_SHA1Final(digest, &context);
-
- /* private marker. */
- ap_cpystrn(out, AP_SHA1PW_ID, AP_SHA1PW_IDLEN + 1);
-
- /* SHA1 hash is always 20 chars */
- l = ap_base64encode_binary(out + AP_SHA1PW_IDLEN, digest, sizeof(digest));
- out[l + AP_SHA1PW_IDLEN] = '\0';
-
- /*
- * output of base64 encoded SHA1 is always 28 chars + AP_SHA1PW_IDLEN
- */
-}
diff --git a/crypto/apr_sha1.c b/crypto/apr_sha1.c
deleted file mode 100644
index 1d4d9ea4..00000000
--- a/crypto/apr_sha1.c
+++ /dev/null
@@ -1,383 +0,0 @@
-/* ====================================================================
- * Copyright (c) 1996-1999 The Apache Group. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * 4. The names "Apache Server" and "Apache Group" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Group and was originally based
- * on public domain software written at the National Center for
- * Supercomputing Applications, University of Illinois, Urbana-Champaign.
- * For more information on the Apache Group and the Apache HTTP server
- * project, please see <http://www.apache.org/>.
- *
- * The exported function:
- *
- * ap_sha1_base64(const char *clear, int len, char *out);
- *
- * provides a means to SHA1 crypt/encode a plaintext password in
- * a way which makes password files compatible with those commonly
- * used in netscape web and ldap installations. It was put together
- * by Clinton Wong <clintdw@netcom.com>, who also notes that:
- *
- * Note: SHA1 support is useful for migration purposes, but is less
- * secure than Apache's password format, since Apache's (MD5)
- * password format uses a random eight character salt to generate
- * one of many possible hashes for the same password. Netscape
- * uses plain SHA1 without a salt, so the same password
- * will always generate the same hash, making it easier
- * to break since the search space is smaller.
- *
- * See also the documentation in support/SHA1 as to hints on how to
- * migrate an existing netscape installation and other supplied utitlites.
- *
- * This software also makes use of the following component:
- *
- * NIST Secure Hash Algorithm
- * heavily modified by Uwe Hollerbach uh@alumni.caltech edu
- * from Peter C. Gutmann's implementation as found in
- * Applied Cryptography by Bruce Schneier
- * This code is hereby placed in the public domain
- */
-
-#include <string.h>
-
-#include "ap_config.h"
-#include "ap_sha1.h"
-#include "ap.h"
-#ifdef CHARSET_EBCDIC
-#include "ebcdic.h"
-#endif /*CHARSET_EBCDIC*/
-
-/* a bit faster & bigger, if defined */
-#define UNROLL_LOOPS
-
-/* NIST's proposed modification to SHA, 7/11/94 */
-#define USE_MODIFIED_SHA
-
-/* SHA f()-functions */
-#define f1(x,y,z) ((x & y) | (~x & z))
-#define f2(x,y,z) (x ^ y ^ z)
-#define f3(x,y,z) ((x & y) | (x & z) | (y & z))
-#define f4(x,y,z) (x ^ y ^ z)
-
-/* SHA constants */
-#define CONST1 0x5a827999L
-#define CONST2 0x6ed9eba1L
-#define CONST3 0x8f1bbcdcL
-#define CONST4 0xca62c1d6L
-
-/* 32-bit rotate */
-
-#define ROT32(x,n) ((x << n) | (x >> (32 - n)))
-
-#define FUNC(n,i) \
- 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
-
-#define SHA_BLOCKSIZE 64
-
-typedef unsigned char AP_BYTE;
-
-/* do SHA transformation */
-static void sha_transform(AP_SHA1_CTX *sha_info)
-{
- int i;
- AP_LONG temp, A, B, C, D, E, W[80];
-
- for (i = 0; i < 16; ++i) {
- W[i] = sha_info->data[i];
- }
- for (i = 16; i < 80; ++i) {
- W[i] = W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16];
-#ifdef USE_MODIFIED_SHA
- W[i] = ROT32(W[i], 1);
-#endif /* USE_MODIFIED_SHA */
- }
- A = sha_info->digest[0];
- B = sha_info->digest[1];
- C = sha_info->digest[2];
- D = sha_info->digest[3];
- E = sha_info->digest[4];
-#ifdef UNROLL_LOOPS
- FUNC(1, 0); FUNC(1, 1); FUNC(1, 2); FUNC(1, 3); FUNC(1, 4);
- FUNC(1, 5); FUNC(1, 6); FUNC(1, 7); FUNC(1, 8); FUNC(1, 9);
- FUNC(1,10); FUNC(1,11); FUNC(1,12); FUNC(1,13); FUNC(1,14);
- FUNC(1,15); FUNC(1,16); FUNC(1,17); FUNC(1,18); FUNC(1,19);
-
- FUNC(2,20); FUNC(2,21); FUNC(2,22); FUNC(2,23); FUNC(2,24);
- FUNC(2,25); FUNC(2,26); FUNC(2,27); FUNC(2,28); FUNC(2,29);
- FUNC(2,30); FUNC(2,31); FUNC(2,32); FUNC(2,33); FUNC(2,34);
- FUNC(2,35); FUNC(2,36); FUNC(2,37); FUNC(2,38); FUNC(2,39);
-
- FUNC(3,40); FUNC(3,41); FUNC(3,42); FUNC(3,43); FUNC(3,44);
- FUNC(3,45); FUNC(3,46); FUNC(3,47); FUNC(3,48); FUNC(3,49);
- FUNC(3,50); FUNC(3,51); FUNC(3,52); FUNC(3,53); FUNC(3,54);
- FUNC(3,55); FUNC(3,56); FUNC(3,57); FUNC(3,58); FUNC(3,59);
-
- FUNC(4,60); FUNC(4,61); FUNC(4,62); FUNC(4,63); FUNC(4,64);
- FUNC(4,65); FUNC(4,66); FUNC(4,67); FUNC(4,68); FUNC(4,69);
- FUNC(4,70); FUNC(4,71); FUNC(4,72); FUNC(4,73); FUNC(4,74);
- FUNC(4,75); FUNC(4,76); FUNC(4,77); FUNC(4,78); FUNC(4,79);
-#else /* !UNROLL_LOOPS */
- for (i = 0; i < 20; ++i) {
- FUNC(1,i);
- }
- for (i = 20; i < 40; ++i) {
- FUNC(2,i);
- }
- for (i = 40; i < 60; ++i) {
- FUNC(3,i);
- }
- for (i = 60; i < 80; ++i) {
- FUNC(4,i);
- }
-#endif /* !UNROLL_LOOPS */
- sha_info->digest[0] += A;
- sha_info->digest[1] += B;
- sha_info->digest[2] += C;
- sha_info->digest[3] += D;
- sha_info->digest[4] += E;
-}
-
-union endianTest {
- long Long;
- char Char[sizeof(long)];
-};
-
-static char isLittleEndian(void)
-{
- static union endianTest u;
- u.Long = 1;
- return (u.Char[0] == 1);
-}
-
-/* change endianness of data */
-
-/* count is the number of bytes to do an endian flip */
-static void maybe_byte_reverse(AP_LONG *buffer, int count)
-{
- int i;
- AP_BYTE ct[4], *cp;
-
- if (isLittleEndian()) { /* do the swap only if it is little endian */
- count /= sizeof(AP_LONG);
- cp = (AP_BYTE *) buffer;
- for (i = 0; i < count; ++i) {
- ct[0] = cp[0];
- ct[1] = cp[1];
- ct[2] = cp[2];
- ct[3] = cp[3];
- cp[0] = ct[3];
- cp[1] = ct[2];
- cp[2] = ct[1];
- cp[3] = ct[0];
- cp += sizeof(AP_LONG);
- }
- }
-}
-
-/* initialize the SHA digest */
-
-API_EXPORT(void) ap_SHA1Init(AP_SHA1_CTX *sha_info)
-{
- sha_info->digest[0] = 0x67452301L;
- sha_info->digest[1] = 0xefcdab89L;
- sha_info->digest[2] = 0x98badcfeL;
- sha_info->digest[3] = 0x10325476L;
- sha_info->digest[4] = 0xc3d2e1f0L;
- sha_info->count_lo = 0L;
- sha_info->count_hi = 0L;
- sha_info->local = 0;
-}
-
-/* update the SHA digest */
-
-API_EXPORT(void) ap_SHA1Update_binary(AP_SHA1_CTX *sha_info,
- const unsigned char *buffer,
- unsigned int count)
-{
- unsigned int i;
-
- if ((sha_info->count_lo + ((AP_LONG) count << 3)) < sha_info->count_lo) {
- ++sha_info->count_hi;
- }
- 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(((AP_BYTE *) sha_info->data) + sha_info->local, buffer, i);
- count -= i;
- buffer += i;
- sha_info->local += i;
- if (sha_info->local == SHA_BLOCKSIZE) {
- maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE);
- sha_transform(sha_info);
- }
- else {
- return;
- }
- }
- while (count >= SHA_BLOCKSIZE) {
- memcpy(sha_info->data, buffer, SHA_BLOCKSIZE);
- buffer += SHA_BLOCKSIZE;
- count -= SHA_BLOCKSIZE;
- maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE);
- sha_transform(sha_info);
- }
- memcpy(sha_info->data, buffer, count);
- sha_info->local = count;
-}
-
-API_EXPORT(void) ap_SHA1Update(AP_SHA1_CTX *sha_info, const char *buf,
- unsigned int count)
-{
-#ifdef CHARSET_EBCDIC
- int i;
- const AP_BYTE *buffer = (const AP_BYTE *) buf;
-
- if ((sha_info->count_lo + ((AP_LONG) count << 3)) < sha_info->count_lo) {
- ++sha_info->count_hi;
- }
- sha_info->count_lo += (AP_LONG) count << 3;
- sha_info->count_hi += (AP_LONG) count >> 29;
- /* Is there a remainder of the previous Update operation? */
- if (sha_info->local) {
- i = SHA_BLOCKSIZE - sha_info->local;
- if (i > count) {
- i = count;
- }
- ebcdic2ascii_strictly(((AP_BYTE *) sha_info->data) + sha_info->local,
- buffer, i);
- count -= i;
- buffer += i;
- sha_info->local += i;
- if (sha_info->local == SHA_BLOCKSIZE) {
- maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE);
- sha_transform(sha_info);
- }
- else {
- return;
- }
- }
- while (count >= SHA_BLOCKSIZE) {
- ebcdic2ascii_strictly((AP_BYTE *)sha_info->data, buffer, SHA_BLOCKSIZE);
- buffer += SHA_BLOCKSIZE;
- count -= SHA_BLOCKSIZE;
- maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE);
- sha_transform(sha_info);
- }
- ebcdic2ascii_strictly((AP_BYTE *)sha_info->data, buffer, count);
- sha_info->local = count;
-#else
- ap_SHA1Update_binary(sha_info, (const unsigned char *) buf, count);
-#endif
-}
-
-/* finish computing the SHA digest */
-
-API_EXPORT(void) ap_SHA1Final(unsigned char digest[SHA_DIGESTSIZE],
- AP_SHA1_CTX *sha_info)
-{
- int count, i, j;
- AP_LONG lo_bit_count, hi_bit_count, k;
-
- lo_bit_count = sha_info->count_lo;
- hi_bit_count = sha_info->count_hi;
- count = (int) ((lo_bit_count >> 3) & 0x3f);
- ((AP_BYTE *) sha_info->data)[count++] = 0x80;
- if (count > SHA_BLOCKSIZE - 8) {
- memset(((AP_BYTE *) sha_info->data) + count, 0, SHA_BLOCKSIZE - count);
- maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE);
- sha_transform(sha_info);
- memset((AP_BYTE *) sha_info->data, 0, SHA_BLOCKSIZE - 8);
- }
- else {
- memset(((AP_BYTE *) sha_info->data) + count, 0,
- SHA_BLOCKSIZE - 8 - count);
- }
- maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE);
- sha_info->data[14] = hi_bit_count;
- sha_info->data[15] = lo_bit_count;
- sha_transform(sha_info);
-
- for (i = 0, j = 0; j < SHA_DIGESTSIZE; i++) {
- k = sha_info->digest[i];
- digest[j++] = (unsigned char) ((k >> 24) & 0xff);
- digest[j++] = (unsigned char) ((k >> 16) & 0xff);
- digest[j++] = (unsigned char) ((k >> 8) & 0xff);
- digest[j++] = (unsigned char) (k & 0xff);
- }
-}
-
-
-API_EXPORT(void) ap_sha1_base64(const char *clear, int len, char *out)
-{
- int l;
- AP_SHA1_CTX context;
- AP_BYTE digest[SHA_DIGESTSIZE];
-
- if (strncmp(clear, AP_SHA1PW_ID, AP_SHA1PW_IDLEN) == 0) {
- clear += AP_SHA1PW_IDLEN;
- }
-
- ap_SHA1Init(&context);
- ap_SHA1Update(&context, clear, len);
- ap_SHA1Final(digest, &context);
-
- /* private marker. */
- ap_cpystrn(out, AP_SHA1PW_ID, AP_SHA1PW_IDLEN + 1);
-
- /* SHA1 hash is always 20 chars */
- l = ap_base64encode_binary(out + AP_SHA1PW_IDLEN, digest, sizeof(digest));
- out[l + AP_SHA1PW_IDLEN] = '\0';
-
- /*
- * output of base64 encoded SHA1 is always 28 chars + AP_SHA1PW_IDLEN
- */
-}
diff --git a/encoding/ap_base64.c b/encoding/ap_base64.c
deleted file mode 100644
index 89cda4b5..00000000
--- a/encoding/ap_base64.c
+++ /dev/null
@@ -1,272 +0,0 @@
-/* ====================================================================
- * Copyright (c) 1995-1999 The Apache Group. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * 4. The names "Apache Server" and "Apache Group" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Group and was originally based
- * on public domain software written at the National Center for
- * Supercomputing Applications, University of Illinois, Urbana-Champaign.
- * For more information on the Apache Group and the Apache HTTP server
- * project, please see <http://www.apache.org/>.
- *
- */
-
-/* base64 encoder/decoder. Originally part of main/util.c
- * but moved here so that support/ab and ap_sha1.c could
- * use it. This meant removing the ap_palloc()s and adding
- * ugly 'len' functions, which is quite a nasty cost.
- */
-
-#include <string.h>
-
-#include "ap_config.h"
-#include "ap.h"
-
-#ifdef CHARSET_EBCDIC
-#include "ebcdic.h"
-#endif /* CHARSET_EBCDIC */
-
-/* aaaack but it's fast and const should make it shared text page. */
-static const unsigned char pr2six[256] =
-{
-#ifndef CHARSET_EBCDIC
- /* ASCII table */
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 64, 64, 64, 63,
- 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 64, 64, 64, 64, 64,
- 64, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 64, 64, 64, 64, 64,
- 64, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64
-#else /*CHARSET_EBCDIC*/
- /* EBCDIC table */
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 26, 27, 28, 29, 30, 31, 32, 33, 34, 64, 64, 64, 64, 64, 64,
- 64, 35, 36, 37, 38, 39, 40, 41, 42, 43, 64, 64, 64, 64, 64, 64,
- 64, 64, 44, 45, 46, 47, 48, 49, 50, 51, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 0, 1, 2, 3, 4, 5, 6, 7, 8, 64, 64, 64, 64, 64, 64,
- 64, 9, 10, 11, 12, 13, 14, 15, 16, 17, 64, 64, 64, 64, 64, 64,
- 64, 64, 18, 19, 20, 21, 22, 23, 24, 25, 64, 64, 64, 64, 64, 64,
- 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 64, 64, 64, 64, 64
-#endif /*CHARSET_EBCDIC*/
-};
-
-API_EXPORT(int) ap_base64decode_len(const char *bufcoded)
-{
- int nbytesdecoded;
- register const unsigned char *bufin;
- register int nprbytes;
-
- bufin = (const unsigned char *) bufcoded;
- while (pr2six[*(bufin++)] <= 63);
-
- nprbytes = (bufin - (const unsigned char *) bufcoded) - 1;
- nbytesdecoded = ((nprbytes + 3) / 4) * 3;
-
- return nbytesdecoded + 1;
-}
-
-API_EXPORT(int) ap_base64decode(char *bufplain, const char *bufcoded)
-{
-#ifdef CHARSET_EBCDIC
- int i;
-#endif /* CHARSET_EBCDIC */
- int len;
-
- len = ap_base64decode_binary((unsigned char *) bufplain, bufcoded);
-#ifdef CHARSET_EBCDIC
- for (i = 0; i < len; i++)
- bufplain[i] = os_toebcdic[bufplain[i]];
-#endif /* CHARSET_EBCDIC */
- return len;
-}
-
-/* This is the same as ap_base64udecode() except on EBCDIC machines, where
- * the conversion of the output to ebcdic is left out.
- */
-API_EXPORT(int) ap_base64decode_binary(unsigned char *bufplain,
- const char *bufcoded)
-{
- int nbytesdecoded;
- register const unsigned char *bufin;
- register unsigned char *bufout;
- register int nprbytes;
-
- bufin = (const unsigned char *) bufcoded;
- while (pr2six[*(bufin++)] <= 63);
- nprbytes = (bufin - (const unsigned char *) bufcoded) - 1;
- nbytesdecoded = ((nprbytes + 3) / 4) * 3;
-
- bufout = (unsigned char *) bufplain;
- bufin = (const unsigned char *) bufcoded;
-
- while (nprbytes > 4) {
- *(bufout++) =
- (unsigned char) (pr2six[*bufin] << 2 | pr2six[bufin[1]] >> 4);
- *(bufout++) =
- (unsigned char) (pr2six[bufin[1]] << 4 | pr2six[bufin[2]] >> 2);
- *(bufout++) =
- (unsigned char) (pr2six[bufin[2]] << 6 | pr2six[bufin[3]]);
- bufin += 4;
- nprbytes -= 4;
- }
-
- /* Note: (nprbytes == 1) would be an error, so just ingore that case */
- if (nprbytes > 1) {
- *(bufout++) =
- (unsigned char) (pr2six[*bufin] << 2 | pr2six[bufin[1]] >> 4);
- }
- if (nprbytes > 2) {
- *(bufout++) =
- (unsigned char) (pr2six[bufin[1]] << 4 | pr2six[bufin[2]] >> 2);
- }
- if (nprbytes > 3) {
- *(bufout++) =
- (unsigned char) (pr2six[bufin[2]] << 6 | pr2six[bufin[3]]);
- }
-
- *(bufout++) = '\0';
- nbytesdecoded -= (4 - nprbytes) & 3;
- return nbytesdecoded;
-}
-
-static const char basis_64[] =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
-API_EXPORT(int) ap_base64encode_len(int len)
-{
- return ((len + 2) / 3 * 4) + 1;
-}
-
-API_EXPORT(int) ap_base64encode(char *encoded, const char *string, int len)
-{
-#ifndef CHARSET_EBCDIC
- return ap_base64encode_binary(encoded, (const unsigned char *) string, len);
-#else /* CHARSET_EBCDIC */
- int i;
- char *p;
-
- p = encoded;
- for (i = 0; i < len - 2; i += 3) {
- *p++ = basis_64[(os_toascii[string[i]] >> 2) & 0x3F];
- *p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4) |
- ((int) (os_toascii[string[i + 1]] & 0xF0) >> 4)];
- *p++ = basis_64[((os_toascii[string[i + 1]] & 0xF) << 2) |
- ((int) (os_toascii[string[i + 2]] & 0xC0) >> 6)];
- *p++ = basis_64[os_toascii[string[i + 2]] & 0x3F];
- }
- if (i < len) {
- *p++ = basis_64[(os_toascii[string[i]] >> 2) & 0x3F];
- if (i == (len - 1)) {
- *p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4)];
- *p++ = '=';
- }
- else {
- *p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4) |
- ((int) (os_toascii[string[i + 1]] & 0xF0) >> 4)];
- *p++ = basis_64[((os_toascii[string[i + 1]] & 0xF) << 2)];
- }
- *p++ = '=';
- }
-
- *p++ = '\0';
- return p - encoded;
-#endif /* CHARSET_EBCDIC */
-}
-
-/* This is the same as ap_base64encode() except on EBCDIC machines, where
- * the conversion of the input to ascii is left out.
- */
-API_EXPORT(int) ap_base64encode_binary(char *encoded,
- const unsigned char *string, int len)
-{
- int i;
- char *p;
-
- p = encoded;
- for (i = 0; i < len - 2; i += 3) {
- *p++ = basis_64[(string[i] >> 2) & 0x3F];
- *p++ = basis_64[((string[i] & 0x3) << 4) |
- ((int) (string[i + 1] & 0xF0) >> 4)];
- *p++ = basis_64[((string[i + 1] & 0xF) << 2) |
- ((int) (string[i + 2] & 0xC0) >> 6)];
- *p++ = basis_64[string[i + 2] & 0x3F];
- }
- if (i < len) {
- *p++ = basis_64[(string[i] >> 2) & 0x3F];
- if (i == (len - 1)) {
- *p++ = basis_64[((string[i] & 0x3) << 4)];
- *p++ = '=';
- }
- else {
- *p++ = basis_64[((string[i] & 0x3) << 4) |
- ((int) (string[i + 1] & 0xF0) >> 4)];
- *p++ = basis_64[((string[i + 1] & 0xF) << 2)];
- }
- *p++ = '=';
- }
-
- *p++ = '\0';
- return p - encoded;
-}
diff --git a/encoding/apr_base64.c b/encoding/apr_base64.c
deleted file mode 100644
index 89cda4b5..00000000
--- a/encoding/apr_base64.c
+++ /dev/null
@@ -1,272 +0,0 @@
-/* ====================================================================
- * Copyright (c) 1995-1999 The Apache Group. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * 4. The names "Apache Server" and "Apache Group" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Group and was originally based
- * on public domain software written at the National Center for
- * Supercomputing Applications, University of Illinois, Urbana-Champaign.
- * For more information on the Apache Group and the Apache HTTP server
- * project, please see <http://www.apache.org/>.
- *
- */
-
-/* base64 encoder/decoder. Originally part of main/util.c
- * but moved here so that support/ab and ap_sha1.c could
- * use it. This meant removing the ap_palloc()s and adding
- * ugly 'len' functions, which is quite a nasty cost.
- */
-
-#include <string.h>
-
-#include "ap_config.h"
-#include "ap.h"
-
-#ifdef CHARSET_EBCDIC
-#include "ebcdic.h"
-#endif /* CHARSET_EBCDIC */
-
-/* aaaack but it's fast and const should make it shared text page. */
-static const unsigned char pr2six[256] =
-{
-#ifndef CHARSET_EBCDIC
- /* ASCII table */
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 64, 64, 64, 63,
- 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 64, 64, 64, 64, 64,
- 64, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 64, 64, 64, 64, 64,
- 64, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64
-#else /*CHARSET_EBCDIC*/
- /* EBCDIC table */
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 26, 27, 28, 29, 30, 31, 32, 33, 34, 64, 64, 64, 64, 64, 64,
- 64, 35, 36, 37, 38, 39, 40, 41, 42, 43, 64, 64, 64, 64, 64, 64,
- 64, 64, 44, 45, 46, 47, 48, 49, 50, 51, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 0, 1, 2, 3, 4, 5, 6, 7, 8, 64, 64, 64, 64, 64, 64,
- 64, 9, 10, 11, 12, 13, 14, 15, 16, 17, 64, 64, 64, 64, 64, 64,
- 64, 64, 18, 19, 20, 21, 22, 23, 24, 25, 64, 64, 64, 64, 64, 64,
- 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 64, 64, 64, 64, 64
-#endif /*CHARSET_EBCDIC*/
-};
-
-API_EXPORT(int) ap_base64decode_len(const char *bufcoded)
-{
- int nbytesdecoded;
- register const unsigned char *bufin;
- register int nprbytes;
-
- bufin = (const unsigned char *) bufcoded;
- while (pr2six[*(bufin++)] <= 63);
-
- nprbytes = (bufin - (const unsigned char *) bufcoded) - 1;
- nbytesdecoded = ((nprbytes + 3) / 4) * 3;
-
- return nbytesdecoded + 1;
-}
-
-API_EXPORT(int) ap_base64decode(char *bufplain, const char *bufcoded)
-{
-#ifdef CHARSET_EBCDIC
- int i;
-#endif /* CHARSET_EBCDIC */
- int len;
-
- len = ap_base64decode_binary((unsigned char *) bufplain, bufcoded);
-#ifdef CHARSET_EBCDIC
- for (i = 0; i < len; i++)
- bufplain[i] = os_toebcdic[bufplain[i]];
-#endif /* CHARSET_EBCDIC */
- return len;
-}
-
-/* This is the same as ap_base64udecode() except on EBCDIC machines, where
- * the conversion of the output to ebcdic is left out.
- */
-API_EXPORT(int) ap_base64decode_binary(unsigned char *bufplain,
- const char *bufcoded)
-{
- int nbytesdecoded;
- register const unsigned char *bufin;
- register unsigned char *bufout;
- register int nprbytes;
-
- bufin = (const unsigned char *) bufcoded;
- while (pr2six[*(bufin++)] <= 63);
- nprbytes = (bufin - (const unsigned char *) bufcoded) - 1;
- nbytesdecoded = ((nprbytes + 3) / 4) * 3;
-
- bufout = (unsigned char *) bufplain;
- bufin = (const unsigned char *) bufcoded;
-
- while (nprbytes > 4) {
- *(bufout++) =
- (unsigned char) (pr2six[*bufin] << 2 | pr2six[bufin[1]] >> 4);
- *(bufout++) =
- (unsigned char) (pr2six[bufin[1]] << 4 | pr2six[bufin[2]] >> 2);
- *(bufout++) =
- (unsigned char) (pr2six[bufin[2]] << 6 | pr2six[bufin[3]]);
- bufin += 4;
- nprbytes -= 4;
- }
-
- /* Note: (nprbytes == 1) would be an error, so just ingore that case */
- if (nprbytes > 1) {
- *(bufout++) =
- (unsigned char) (pr2six[*bufin] << 2 | pr2six[bufin[1]] >> 4);
- }
- if (nprbytes > 2) {
- *(bufout++) =
- (unsigned char) (pr2six[bufin[1]] << 4 | pr2six[bufin[2]] >> 2);
- }
- if (nprbytes > 3) {
- *(bufout++) =
- (unsigned char) (pr2six[bufin[2]] << 6 | pr2six[bufin[3]]);
- }
-
- *(bufout++) = '\0';
- nbytesdecoded -= (4 - nprbytes) & 3;
- return nbytesdecoded;
-}
-
-static const char basis_64[] =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
-API_EXPORT(int) ap_base64encode_len(int len)
-{
- return ((len + 2) / 3 * 4) + 1;
-}
-
-API_EXPORT(int) ap_base64encode(char *encoded, const char *string, int len)
-{
-#ifndef CHARSET_EBCDIC
- return ap_base64encode_binary(encoded, (const unsigned char *) string, len);
-#else /* CHARSET_EBCDIC */
- int i;
- char *p;
-
- p = encoded;
- for (i = 0; i < len - 2; i += 3) {
- *p++ = basis_64[(os_toascii[string[i]] >> 2) & 0x3F];
- *p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4) |
- ((int) (os_toascii[string[i + 1]] & 0xF0) >> 4)];
- *p++ = basis_64[((os_toascii[string[i + 1]] & 0xF) << 2) |
- ((int) (os_toascii[string[i + 2]] & 0xC0) >> 6)];
- *p++ = basis_64[os_toascii[string[i + 2]] & 0x3F];
- }
- if (i < len) {
- *p++ = basis_64[(os_toascii[string[i]] >> 2) & 0x3F];
- if (i == (len - 1)) {
- *p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4)];
- *p++ = '=';
- }
- else {
- *p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4) |
- ((int) (os_toascii[string[i + 1]] & 0xF0) >> 4)];
- *p++ = basis_64[((os_toascii[string[i + 1]] & 0xF) << 2)];
- }
- *p++ = '=';
- }
-
- *p++ = '\0';
- return p - encoded;
-#endif /* CHARSET_EBCDIC */
-}
-
-/* This is the same as ap_base64encode() except on EBCDIC machines, where
- * the conversion of the input to ascii is left out.
- */
-API_EXPORT(int) ap_base64encode_binary(char *encoded,
- const unsigned char *string, int len)
-{
- int i;
- char *p;
-
- p = encoded;
- for (i = 0; i < len - 2; i += 3) {
- *p++ = basis_64[(string[i] >> 2) & 0x3F];
- *p++ = basis_64[((string[i] & 0x3) << 4) |
- ((int) (string[i + 1] & 0xF0) >> 4)];
- *p++ = basis_64[((string[i + 1] & 0xF) << 2) |
- ((int) (string[i + 2] & 0xC0) >> 6)];
- *p++ = basis_64[string[i + 2] & 0x3F];
- }
- if (i < len) {
- *p++ = basis_64[(string[i] >> 2) & 0x3F];
- if (i == (len - 1)) {
- *p++ = basis_64[((string[i] & 0x3) << 4)];
- *p++ = '=';
- }
- else {
- *p++ = basis_64[((string[i] & 0x3) << 4) |
- ((int) (string[i + 1] & 0xF0) >> 4)];
- *p++ = basis_64[((string[i + 1] & 0xF) << 2)];
- }
- *p++ = '=';
- }
-
- *p++ = '\0';
- return p - encoded;
-}
diff --git a/hooks/ap_hooks.c b/hooks/ap_hooks.c
deleted file mode 100644
index 54adc6e5..00000000
--- a/hooks/ap_hooks.c
+++ /dev/null
@@ -1,220 +0,0 @@
-#include "httpd.h"
-#include "ap_hooks.h"
-#include <assert.h>
-
-#if 0
-#define ap_palloc(pool,size) malloc(size)
-#endif
-
-/* NB: This must echo the LINK_##name structure */
-typedef struct
-{
- void (*dummy)(void *);
- const char *szName;
- const char * const *aszPredecessors;
- const char * const *aszSuccessors;
- int nOrder;
-} TSortData;
-
-typedef struct tsort_
-{
- void *pData;
- int nPredecessors;
- struct tsort_ **ppPredecessors;
- struct tsort_ *pNext;
-} TSort;
-
-static int crude_order(const void *a_,const void *b_)
-{
- const TSortData *a=a_;
- const TSortData *b=b_;
-
- return a->nOrder-b->nOrder;
-}
-
-static TSort *prepare(pool *p,TSortData *pItems,int nItems)
-{
- TSort *pData=ap_palloc(p,nItems*sizeof *pData);
- int n;
-
- qsort(pItems,nItems,sizeof *pItems,crude_order);
- for(n=0 ; n < nItems ; ++n) {
- pData[n].nPredecessors=0;
- pData[n].ppPredecessors=ap_palloc(p,nItems*sizeof *pData[n].ppPredecessors);
- pData[n].pNext=NULL;
- pData[n].pData=&pItems[n];
- }
-
- for(n=0 ; n < nItems ; ++n) {
- int i,k;
-
- for(i=0 ; pItems[n].aszPredecessors && pItems[n].aszPredecessors[i] ; ++i)
- for(k=0 ; k < nItems ; ++k)
- if(!strcmp(pItems[k].szName,pItems[n].aszPredecessors[i])) {
- int l;
-
- for(l=0 ; l < pData[n].nPredecessors ; ++l)
- if(pData[n].ppPredecessors[l] == &pData[k])
- goto got_it;
- pData[n].ppPredecessors[pData[n].nPredecessors]=&pData[k];
- ++pData[n].nPredecessors;
- got_it:
- break;
- }
- for(i=0 ; pItems[n].aszSuccessors && pItems[n].aszSuccessors[i] ; ++i)
- for(k=0 ; k < nItems ; ++k)
- if(!strcmp(pItems[k].szName,pItems[n].aszSuccessors[i])) {
- int l;
-
- for(l=0 ; l < pData[k].nPredecessors ; ++l)
- if(pData[k].ppPredecessors[l] == &pData[n])
- goto got_it2;
- pData[k].ppPredecessors[pData[k].nPredecessors]=&pData[n];
- ++pData[k].nPredecessors;
- got_it2:
- break;
- }
- }
-
- return pData;
-}
-
-static TSort *tsort(TSort *pData,int nItems)
-{
- int nTotal;
- TSort *pHead=NULL;
- TSort *pTail=NULL;
-
- for(nTotal=0 ; nTotal < nItems ; ++nTotal) {
- int n,i,k;
-
- for(n=0 ; ; ++n) {
- if(n == nItems)
- assert(0); /* // we have a loop... */
- if(!pData[n].pNext && !pData[n].nPredecessors)
- break;
- }
- if(pTail)
- pTail->pNext=&pData[n];
- else
- pHead=&pData[n];
- pTail=&pData[n];
- pTail->pNext=pTail; /* // fudge it so it looks linked */
- for(i=0 ; i < nItems ; ++i)
- for(k=0 ; pData[i].ppPredecessors[k] ; ++k)
- if(pData[i].ppPredecessors[k] == &pData[n]) {
- --pData[i].nPredecessors;
- break;
- }
- }
- pTail->pNext=NULL; /* // unfudge the tail */
- return pHead;
-}
-
-static array_header *sort_hook(array_header *pHooks,const char *szName)
-{
- pool *p=ap_make_sub_pool(g_pHookPool);
- TSort *pSort;
- array_header *pNew;
- int n;
-
- pSort=prepare(p,(TSortData *)pHooks->elts,pHooks->nelts);
- tsort(pSort,pHooks->nelts);
- pNew=ap_make_array(g_pHookPool,pHooks->nelts,sizeof(TSortData));
- if(g_bDebugHooks)
- printf("Sorting %s:",szName);
- for(n=0 ; pSort ; pSort=pSort->pNext,++n) {
- TSortData *pHook;
- assert(n < pHooks->nelts);
- pHook=ap_push_array(pNew);
- memcpy(pHook,pSort->pData,sizeof *pHook);
- if(g_bDebugHooks)
- printf(" %s",pHook->szName);
- }
- if(g_bDebugHooks)
- fputc('\n',stdout);
- return pNew;
-}
-
-static array_header *s_aHooksToSort;
-typedef struct
-{
- const char *szHookName;
- array_header **paHooks;
-} HookSortEntry;
-
-void ap_hook_sort_register(const char *szHookName,array_header **paHooks)
-{
- HookSortEntry *pEntry;
-
- if(!s_aHooksToSort)
- s_aHooksToSort=ap_make_array(g_pHookPool,1,sizeof(HookSortEntry));
- pEntry=ap_push_array(s_aHooksToSort);
- pEntry->szHookName=szHookName;
- pEntry->paHooks=paHooks;
-}
-
-void ap_sort_hooks()
-{
- int n;
-
- for(n=0 ; n < s_aHooksToSort->nelts ; ++n) {
- HookSortEntry *pEntry=&((HookSortEntry *)s_aHooksToSort->elts)[n];
- *pEntry->paHooks=sort_hook(*pEntry->paHooks,pEntry->szHookName);
- }
-}
-
-void ap_show_hook(const char *szName,const char * const *aszPre,
- const char * const *aszSucc)
-{
- int nFirst;
-
- printf(" Hooked %s",szName);
- if(aszPre) {
- fputs(" pre(",stdout);
- nFirst=1;
- while(*aszPre) {
- if(!nFirst)
- fputc(',',stdout);
- nFirst=0;
- fputs(*aszPre,stdout);
- ++aszPre;
- }
- fputc(')',stdout);
- }
- if(aszSucc) {
- fputs(" succ(",stdout);
- nFirst=1;
- while(*aszSucc) {
- if(!nFirst)
- fputc(',',stdout);
- nFirst=0;
- fputs(*aszSucc,stdout);
- ++aszSucc;
- }
- fputc(')',stdout);
- }
- fputc('\n',stdout);
-}
-
-#if 0
-void main()
-{
- const char *aszAPre[]={"b","c",NULL};
- const char *aszBPost[]={"a",NULL};
- const char *aszCPost[]={"b",NULL};
- TSortData t1[]=
- {
- { "a",aszAPre,NULL },
- { "b",NULL,aszBPost },
- { "c",NULL,aszCPost }
- };
- TSort *pResult;
-
- pResult=prepare(t1,3);
- pResult=tsort(pResult,3);
-
- for( ; pResult ; pResult=pResult->pNext)
- printf("%s\n",pResult->pData->szName);
-}
-#endif
diff --git a/hooks/apr_hooks.c b/hooks/apr_hooks.c
deleted file mode 100644
index 54adc6e5..00000000
--- a/hooks/apr_hooks.c
+++ /dev/null
@@ -1,220 +0,0 @@
-#include "httpd.h"
-#include "ap_hooks.h"
-#include <assert.h>
-
-#if 0
-#define ap_palloc(pool,size) malloc(size)
-#endif
-
-/* NB: This must echo the LINK_##name structure */
-typedef struct
-{
- void (*dummy)(void *);
- const char *szName;
- const char * const *aszPredecessors;
- const char * const *aszSuccessors;
- int nOrder;
-} TSortData;
-
-typedef struct tsort_
-{
- void *pData;
- int nPredecessors;
- struct tsort_ **ppPredecessors;
- struct tsort_ *pNext;
-} TSort;
-
-static int crude_order(const void *a_,const void *b_)
-{
- const TSortData *a=a_;
- const TSortData *b=b_;
-
- return a->nOrder-b->nOrder;
-}
-
-static TSort *prepare(pool *p,TSortData *pItems,int nItems)
-{
- TSort *pData=ap_palloc(p,nItems*sizeof *pData);
- int n;
-
- qsort(pItems,nItems,sizeof *pItems,crude_order);
- for(n=0 ; n < nItems ; ++n) {
- pData[n].nPredecessors=0;
- pData[n].ppPredecessors=ap_palloc(p,nItems*sizeof *pData[n].ppPredecessors);
- pData[n].pNext=NULL;
- pData[n].pData=&pItems[n];
- }
-
- for(n=0 ; n < nItems ; ++n) {
- int i,k;
-
- for(i=0 ; pItems[n].aszPredecessors && pItems[n].aszPredecessors[i] ; ++i)
- for(k=0 ; k < nItems ; ++k)
- if(!strcmp(pItems[k].szName,pItems[n].aszPredecessors[i])) {
- int l;
-
- for(l=0 ; l < pData[n].nPredecessors ; ++l)
- if(pData[n].ppPredecessors[l] == &pData[k])
- goto got_it;
- pData[n].ppPredecessors[pData[n].nPredecessors]=&pData[k];
- ++pData[n].nPredecessors;
- got_it:
- break;
- }
- for(i=0 ; pItems[n].aszSuccessors && pItems[n].aszSuccessors[i] ; ++i)
- for(k=0 ; k < nItems ; ++k)
- if(!strcmp(pItems[k].szName,pItems[n].aszSuccessors[i])) {
- int l;
-
- for(l=0 ; l < pData[k].nPredecessors ; ++l)
- if(pData[k].ppPredecessors[l] == &pData[n])
- goto got_it2;
- pData[k].ppPredecessors[pData[k].nPredecessors]=&pData[n];
- ++pData[k].nPredecessors;
- got_it2:
- break;
- }
- }
-
- return pData;
-}
-
-static TSort *tsort(TSort *pData,int nItems)
-{
- int nTotal;
- TSort *pHead=NULL;
- TSort *pTail=NULL;
-
- for(nTotal=0 ; nTotal < nItems ; ++nTotal) {
- int n,i,k;
-
- for(n=0 ; ; ++n) {
- if(n == nItems)
- assert(0); /* // we have a loop... */
- if(!pData[n].pNext && !pData[n].nPredecessors)
- break;
- }
- if(pTail)
- pTail->pNext=&pData[n];
- else
- pHead=&pData[n];
- pTail=&pData[n];
- pTail->pNext=pTail; /* // fudge it so it looks linked */
- for(i=0 ; i < nItems ; ++i)
- for(k=0 ; pData[i].ppPredecessors[k] ; ++k)
- if(pData[i].ppPredecessors[k] == &pData[n]) {
- --pData[i].nPredecessors;
- break;
- }
- }
- pTail->pNext=NULL; /* // unfudge the tail */
- return pHead;
-}
-
-static array_header *sort_hook(array_header *pHooks,const char *szName)
-{
- pool *p=ap_make_sub_pool(g_pHookPool);
- TSort *pSort;
- array_header *pNew;
- int n;
-
- pSort=prepare(p,(TSortData *)pHooks->elts,pHooks->nelts);
- tsort(pSort,pHooks->nelts);
- pNew=ap_make_array(g_pHookPool,pHooks->nelts,sizeof(TSortData));
- if(g_bDebugHooks)
- printf("Sorting %s:",szName);
- for(n=0 ; pSort ; pSort=pSort->pNext,++n) {
- TSortData *pHook;
- assert(n < pHooks->nelts);
- pHook=ap_push_array(pNew);
- memcpy(pHook,pSort->pData,sizeof *pHook);
- if(g_bDebugHooks)
- printf(" %s",pHook->szName);
- }
- if(g_bDebugHooks)
- fputc('\n',stdout);
- return pNew;
-}
-
-static array_header *s_aHooksToSort;
-typedef struct
-{
- const char *szHookName;
- array_header **paHooks;
-} HookSortEntry;
-
-void ap_hook_sort_register(const char *szHookName,array_header **paHooks)
-{
- HookSortEntry *pEntry;
-
- if(!s_aHooksToSort)
- s_aHooksToSort=ap_make_array(g_pHookPool,1,sizeof(HookSortEntry));
- pEntry=ap_push_array(s_aHooksToSort);
- pEntry->szHookName=szHookName;
- pEntry->paHooks=paHooks;
-}
-
-void ap_sort_hooks()
-{
- int n;
-
- for(n=0 ; n < s_aHooksToSort->nelts ; ++n) {
- HookSortEntry *pEntry=&((HookSortEntry *)s_aHooksToSort->elts)[n];
- *pEntry->paHooks=sort_hook(*pEntry->paHooks,pEntry->szHookName);
- }
-}
-
-void ap_show_hook(const char *szName,const char * const *aszPre,
- const char * const *aszSucc)
-{
- int nFirst;
-
- printf(" Hooked %s",szName);
- if(aszPre) {
- fputs(" pre(",stdout);
- nFirst=1;
- while(*aszPre) {
- if(!nFirst)
- fputc(',',stdout);
- nFirst=0;
- fputs(*aszPre,stdout);
- ++aszPre;
- }
- fputc(')',stdout);
- }
- if(aszSucc) {
- fputs(" succ(",stdout);
- nFirst=1;
- while(*aszSucc) {
- if(!nFirst)
- fputc(',',stdout);
- nFirst=0;
- fputs(*aszSucc,stdout);
- ++aszSucc;
- }
- fputc(')',stdout);
- }
- fputc('\n',stdout);
-}
-
-#if 0
-void main()
-{
- const char *aszAPre[]={"b","c",NULL};
- const char *aszBPost[]={"a",NULL};
- const char *aszCPost[]={"b",NULL};
- TSortData t1[]=
- {
- { "a",aszAPre,NULL },
- { "b",NULL,aszBPost },
- { "c",NULL,aszCPost }
- };
- TSort *pResult;
-
- pResult=prepare(t1,3);
- pResult=tsort(pResult,3);
-
- for( ; pResult ; pResult=pResult->pNext)
- printf("%s\n",pResult->pData->szName);
-}
-#endif
diff --git a/include/apr_hooks.h b/include/apr_hooks.h
deleted file mode 100644
index 9c4821c4..00000000
--- a/include/apr_hooks.h
+++ /dev/null
@@ -1,127 +0,0 @@
-#ifndef APACHE_AP_HOOKS_H
-#define APACHE_AP_HOOKS_H
-
-#define DECLARE_HOOK(ret,name,args) \
-typedef ret HOOK_##name args; \
-void ap_hook_##name(HOOK_##name *pf,const char * const *aszPre, \
- const char * const *aszSucc,int nOrder); \
-ret ap_run_##name args; \
-typedef struct _LINK_##name \
- { \
- HOOK_##name *pFunc; \
- const char *szName; \
- const char * const *aszPredecessors; \
- const char * const *aszSuccessors; \
- int nOrder; \
- } LINK_##name;
-
-#define HOOK_STRUCT(members) \
-static struct { members } _hooks;
-
-#define HOOK_LINK(name) \
- array_header *link_##name;
-
-#define IMPLEMENT_HOOK_BASE(name) \
-void ap_hook_##name(HOOK_##name *pf,const char * const *aszPre, \
- const char * const *aszSucc,int nOrder) \
- { \
- LINK_##name *pHook; \
- if(!_hooks.link_##name) \
- { \
- _hooks.link_##name=ap_make_array(g_pHookPool,1,sizeof(LINK_##name)); \
- ap_hook_sort_register(#name,&_hooks.link_##name); \
- } \
- pHook=ap_push_array(_hooks.link_##name); \
- pHook->pFunc=pf; \
- pHook->aszPredecessors=aszPre; \
- pHook->aszSuccessors=aszSucc; \
- pHook->nOrder=nOrder; \
- pHook->szName=g_szCurrentHookName; \
- if(g_bDebugHooks) \
- ap_show_hook(#name,aszPre,aszSucc); \
- }
-
-/* RUN_ALL runs to the first one to return other than ok or decline
- RUN_FIRST runs to the first one to return other than decline
- VOID runs all
-*/
-
-#define IMPLEMENT_HOOK_VOID(name,args_decl,args_use) \
-IMPLEMENT_HOOK_BASE(name) \
-void ap_run_##name args_decl \
- { \
- LINK_##name *pHook; \
- int n; \
-\
- if(!_hooks.link_##name) \
- return; \
-\
- pHook=(LINK_##name *)_hooks.link_##name->elts; \
- for(n=0 ; n < _hooks.link_##name->nelts ; ++n) \
- pHook[n].pFunc args_use; \
- }
-
-/* FIXME: note that this returns ok when nothing is run. I suspect it should
- really return decline, but that breaks Apache currently - Ben
-*/
-#define IMPLEMENT_HOOK_RUN_ALL(ret,name,args_decl,args_use,ok,decline) \
-IMPLEMENT_HOOK_BASE(name) \
-ret ap_run_##name args_decl \
- { \
- LINK_##name *pHook; \
- int n; \
- ret rv; \
-\
- if(!_hooks.link_##name) \
- return ok; \
-\
- pHook=(LINK_##name *)_hooks.link_##name->elts; \
- for(n=0 ; n < _hooks.link_##name->nelts ; ++n) \
- { \
- rv=pHook[n].pFunc args_use; \
-\
- if(rv != ok && rv != decline) \
- return rv; \
- } \
- return ok; \
- }
-
-#define IMPLEMENT_HOOK_RUN_FIRST(ret,name,args_decl,args_use,decline) \
-IMPLEMENT_HOOK_BASE(name) \
-ret ap_run_##name args_decl \
- { \
- LINK_##name *pHook; \
- int n; \
- ret rv; \
-\
- if(!_hooks.link_##name) \
- return decline; \
-\
- pHook=(LINK_##name *)_hooks.link_##name->elts; \
- for(n=0 ; n < _hooks.link_##name->nelts ; ++n) \
- { \
- rv=pHook[n].pFunc args_use; \
-\
- if(rv != decline) \
- return rv; \
- } \
- return decline; \
- }
-
- /* Hook orderings */
-#define HOOK_REALLY_FIRST (-10)
-#define HOOK_FIRST 0
-#define HOOK_MIDDLE 10
-#define HOOK_LAST 20
-#define HOOK_REALLY_LAST 30
-
-extern pool *g_pHookPool;
-extern int g_bDebugHooks;
-extern const char *g_szCurrentHookName;
-
-void ap_hook_sort_register(const char *szHookName,array_header **aHooks);
-void ap_sort_hooks(void);
-void ap_show_hook(const char *szName,const char * const *aszPre,
- const char * const *aszSucc);
-
-#endif /* ndef(AP_HOOKS_H) */
diff --git a/include/apr_sha1.h b/include/apr_sha1.h
deleted file mode 100644
index 42a4f578..00000000
--- a/include/apr_sha1.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* ====================================================================
- * Copyright (c) 1996-1999 The Apache Group. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * 4. The names "Apache Server" and "Apache Group" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Group and was originally based
- * on public domain software written at the National Center for
- * Supercomputing Applications, University of Illinois, Urbana-Champaign.
- * For more information on the Apache Group and the Apache HTTP server
- * project, please see <http://www.apache.org/>.
- *
- * NIST Secure Hash Algorithm
- * heavily modified by Uwe Hollerbach uh@alumni.caltech edu
- * from Peter C. Gutmann's implementation as found in
- * Applied Cryptography by Bruce Schneier
- * This code is hereby placed in the public domain
- */
-
-#ifndef APACHE_SHA1_H
-#define APACHE_SHA1_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define SHA_DIGESTSIZE 20
-
-/*
- * Define the Magic String prefix that identifies a password as being
- * hashed using our algorithm.
- */
-#define AP_SHA1PW_ID "{SHA}"
-#define AP_SHA1PW_IDLEN 5
-
-typedef unsigned long AP_LONG; /* a 32-bit quantity */
-
-typedef struct {
- 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 */
-} AP_SHA1_CTX;
-
-API_EXPORT(void) ap_sha1_base64(const char *clear, int len, char *out);
-API_EXPORT(void) ap_SHA1Init(AP_SHA1_CTX *context);
-API_EXPORT(void) ap_SHA1Update(AP_SHA1_CTX *context, const char *input,
- unsigned int inputLen);
-API_EXPORT(void) ap_SHA1Update_binary(AP_SHA1_CTX *context,
- const unsigned char *input,
- unsigned int inputLen);
-API_EXPORT(void) ap_SHA1Final(unsigned char digest[SHA_DIGESTSIZE],
- AP_SHA1_CTX *context);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* !APACHE_SHA1_H */