Author: fitz Date: Thu Dec 8 09:56:53 2005 New Revision: 355159 URL: http://svn.apache.org/viewcvs?rev=355159&view=rev Log: Port r354824 from trunk. * random/unix/sha2.h, random/unix/sha2_glue.c, random/unix/sha2.c: Prefix non-static symbols with 'apr__' to avoid namespace conflicts. Modified: apr/apr/branches/1.2.x/random/unix/sha2.c apr/apr/branches/1.2.x/random/unix/sha2.h apr/apr/branches/1.2.x/random/unix/sha2_glue.c Modified: apr/apr/branches/1.2.x/random/unix/sha2.c URL: http://svn.apache.org/viewcvs/apr/apr/branches/1.2.x/random/unix/sha2.c?rev=355159&r1=355158&r2=355159&view=diff ============================================================================== --- apr/apr/branches/1.2.x/random/unix/sha2.c (original) +++ apr/apr/branches/1.2.x/random/unix/sha2.c Thu Dec 8 09:56:53 2005 @@ -151,8 +151,8 @@ * only. */ void SHA512_Last(SHA512_CTX*); -void SHA256_Transform(SHA256_CTX*, const sha2_word32*); -void SHA512_Transform(SHA512_CTX*, const sha2_word64*); +void apr__SHA256_Transform(SHA256_CTX*, const sha2_word32*); +void apr__SHA512_Transform(SHA512_CTX*, const sha2_word64*); /*** SHA-XYZ INITIAL HASH VALUES AND CONSTANTS ************************/ @@ -264,7 +264,7 @@ /*** SHA-256: *********************************************************/ -void SHA256_Init(SHA256_CTX* context) { +void apr__SHA256_Init(SHA256_CTX* context) { if (context == (SHA256_CTX*)0) { return; } @@ -310,7 +310,7 @@ (h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \ j++ -void SHA256_Transform(SHA256_CTX* context, const sha2_word32* data) { +void apr__SHA256_Transform(SHA256_CTX* context, const sha2_word32* data) { sha2_word32 a, b, c, d, e, f, g, h, s0, s1; sha2_word32 T1, *W256; int j; @@ -368,7 +368,7 @@ #else /* SHA2_UNROLL_TRANSFORM */ -void SHA256_Transform(SHA256_CTX* context, const sha2_word32* data) { +void apr__SHA256_Transform(SHA256_CTX* context, const sha2_word32* data) { sha2_word32 a, b, c, d, e, f, g, h, s0, s1; sha2_word32 T1, T2, *W256; int j; @@ -448,7 +448,7 @@ #endif /* SHA2_UNROLL_TRANSFORM */ -void SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len) { +void apr__SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len) { unsigned int freespace, usedspace; if (len == 0) { @@ -471,7 +471,7 @@ context->bitcount += freespace << 3; len -= freespace; data += freespace; - SHA256_Transform(context, (sha2_word32*)context->buffer); + apr__SHA256_Transform(context, (sha2_word32*)context->buffer); } else { /* The buffer is not yet full */ MEMCPY_BCOPY(&context->buffer[usedspace], data, len); @@ -483,7 +483,7 @@ } while (len >= SHA256_BLOCK_LENGTH) { /* Process as many complete blocks as we can */ - SHA256_Transform(context, (sha2_word32*)data); + apr__SHA256_Transform(context, (sha2_word32*)data); context->bitcount += SHA256_BLOCK_LENGTH << 3; len -= SHA256_BLOCK_LENGTH; data += SHA256_BLOCK_LENGTH; @@ -497,7 +497,7 @@ usedspace = freespace = 0; } -void SHA256_Final(sha2_byte digest[], SHA256_CTX* context) { +void apr__SHA256_Final(sha2_byte digest[], SHA256_CTX* context) { sha2_word32 *d = (sha2_word32*)digest; unsigned int usedspace; @@ -524,7 +524,7 @@ MEMSET_BZERO(&context->buffer[usedspace], SHA256_BLOCK_LENGTH - usedspace); } /* Do second-to-last transform: */ - SHA256_Transform(context, (sha2_word32*)context->buffer); + apr__SHA256_Transform(context, (sha2_word32*)context->buffer); /* And set-up for the last transform: */ MEMSET_BZERO(context->buffer, SHA256_SHORT_BLOCK_LENGTH); @@ -540,7 +540,7 @@ *(sha2_word64*)&context->buffer[SHA256_SHORT_BLOCK_LENGTH] = context->bitcount; /* Final transform: */ - SHA256_Transform(context, (sha2_word32*)context->buffer); + apr__SHA256_Transform(context, (sha2_word32*)context->buffer); #if !APR_IS_BIGENDIAN { @@ -569,7 +569,7 @@ assert(context != (SHA256_CTX*)0); if (buffer != (char*)0) { - SHA256_Final(digest, context); + apr__SHA256_Final(digest, context); for (i = 0; i < SHA256_DIGEST_LENGTH; i++) { *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4]; @@ -587,14 +587,14 @@ char* SHA256_Data(const sha2_byte* data, size_t len, char digest[SHA256_DIGEST_STRING_LENGTH]) { SHA256_CTX context; - SHA256_Init(&context); - SHA256_Update(&context, data, len); + apr__SHA256_Init(&context); + apr__SHA256_Update(&context, data, len); return SHA256_End(&context, digest); } /*** SHA-512: *********************************************************/ -void SHA512_Init(SHA512_CTX* context) { +void apr__SHA512_Init(SHA512_CTX* context) { if (context == (SHA512_CTX*)0) { return; } @@ -639,7 +639,7 @@ (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)); \ j++ -void SHA512_Transform(SHA512_CTX* context, const sha2_word64* data) { +void apr__SHA512_Transform(SHA512_CTX* context, const sha2_word64* data) { sha2_word64 a, b, c, d, e, f, g, h, s0, s1; sha2_word64 T1, *W512 = (sha2_word64*)context->buffer; int j; @@ -694,7 +694,7 @@ #else /* SHA2_UNROLL_TRANSFORM */ -void SHA512_Transform(SHA512_CTX* context, const sha2_word64* data) { +void apr__SHA512_Transform(SHA512_CTX* context, const sha2_word64* data) { sha2_word64 a, b, c, d, e, f, g, h, s0, s1; sha2_word64 T1, T2, *W512 = (sha2_word64*)context->buffer; int j; @@ -772,7 +772,7 @@ #endif /* SHA2_UNROLL_TRANSFORM */ -void SHA512_Update(SHA512_CTX* context, const sha2_byte *data, size_t len) { +void apr__SHA512_Update(SHA512_CTX* context, const sha2_byte *data, size_t len) { unsigned int freespace, usedspace; if (len == 0) { @@ -795,7 +795,7 @@ ADDINC128(context->bitcount, freespace << 3); len -= freespace; data += freespace; - SHA512_Transform(context, (sha2_word64*)context->buffer); + apr__SHA512_Transform(context, (sha2_word64*)context->buffer); } else { /* The buffer is not yet full */ MEMCPY_BCOPY(&context->buffer[usedspace], data, len); @@ -807,7 +807,7 @@ } while (len >= SHA512_BLOCK_LENGTH) { /* Process as many complete blocks as we can */ - SHA512_Transform(context, (sha2_word64*)data); + apr__SHA512_Transform(context, (sha2_word64*)data); ADDINC128(context->bitcount, SHA512_BLOCK_LENGTH << 3); len -= SHA512_BLOCK_LENGTH; data += SHA512_BLOCK_LENGTH; @@ -843,7 +843,7 @@ MEMSET_BZERO(&context->buffer[usedspace], SHA512_BLOCK_LENGTH - usedspace); } /* Do second-to-last transform: */ - SHA512_Transform(context, (sha2_word64*)context->buffer); + apr__SHA512_Transform(context, (sha2_word64*)context->buffer); /* And set-up for the last transform: */ MEMSET_BZERO(context->buffer, SHA512_BLOCK_LENGTH - 2); @@ -860,10 +860,10 @@ *(sha2_word64*)&context->buffer[SHA512_SHORT_BLOCK_LENGTH+8] = context->bitcount[0]; /* Final transform: */ - SHA512_Transform(context, (sha2_word64*)context->buffer); + apr__SHA512_Transform(context, (sha2_word64*)context->buffer); } -void SHA512_Final(sha2_byte digest[], SHA512_CTX* context) { +void apr__SHA512_Final(sha2_byte digest[], SHA512_CTX* context) { sha2_word64 *d = (sha2_word64*)digest; /* Sanity check: */ @@ -900,7 +900,7 @@ assert(context != (SHA512_CTX*)0); if (buffer != (char*)0) { - SHA512_Final(digest, context); + apr__SHA512_Final(digest, context); for (i = 0; i < SHA512_DIGEST_LENGTH; i++) { *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4]; @@ -918,14 +918,14 @@ char* SHA512_Data(const sha2_byte* data, size_t len, char digest[SHA512_DIGEST_STRING_LENGTH]) { SHA512_CTX context; - SHA512_Init(&context); - SHA512_Update(&context, data, len); + apr__SHA512_Init(&context); + apr__SHA512_Update(&context, data, len); return SHA512_End(&context, digest); } /*** SHA-384: *********************************************************/ -void SHA384_Init(SHA384_CTX* context) { +void apr__SHA384_Init(SHA384_CTX* context) { if (context == (SHA384_CTX*)0) { return; } @@ -934,11 +934,11 @@ context->bitcount[0] = context->bitcount[1] = 0; } -void SHA384_Update(SHA384_CTX* context, const sha2_byte* data, size_t len) { - SHA512_Update((SHA512_CTX*)context, data, len); +void apr__SHA384_Update(SHA384_CTX* context, const sha2_byte* data, size_t len) { + apr__SHA512_Update((SHA512_CTX*)context, data, len); } -void SHA384_Final(sha2_byte digest[], SHA384_CTX* context) { +void apr__SHA384_Final(sha2_byte digest[], SHA384_CTX* context) { sha2_word64 *d = (sha2_word64*)digest; /* Sanity check: */ @@ -975,7 +975,7 @@ assert(context != (SHA384_CTX*)0); if (buffer != (char*)0) { - SHA384_Final(digest, context); + apr__SHA384_Final(digest, context); for (i = 0; i < SHA384_DIGEST_LENGTH; i++) { *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4]; @@ -993,8 +993,8 @@ char* SHA384_Data(const sha2_byte* data, size_t len, char digest[SHA384_DIGEST_STRING_LENGTH]) { SHA384_CTX context; - SHA384_Init(&context); - SHA384_Update(&context, data, len); + apr__SHA384_Init(&context); + apr__SHA384_Update(&context, data, len); return SHA384_End(&context, digest); } Modified: apr/apr/branches/1.2.x/random/unix/sha2.h URL: http://svn.apache.org/viewcvs/apr/apr/branches/1.2.x/random/unix/sha2.h?rev=355159&r1=355158&r2=355159&view=diff ============================================================================== --- apr/apr/branches/1.2.x/random/unix/sha2.h (original) +++ apr/apr/branches/1.2.x/random/unix/sha2.h Thu Dec 8 09:56:53 2005 @@ -57,23 +57,23 @@ /*** SHA-256/384/512 Function Prototypes ******************************/ -void SHA256_Init(SHA256_CTX *); -void SHA256_Update(SHA256_CTX *, const apr_byte_t *, size_t); -void SHA256_Final(apr_byte_t [SHA256_DIGEST_LENGTH], SHA256_CTX *); +void apr__SHA256_Init(SHA256_CTX *); +void apr__SHA256_Update(SHA256_CTX *, const apr_byte_t *, size_t); +void apr__SHA256_Final(apr_byte_t [SHA256_DIGEST_LENGTH], SHA256_CTX *); char* SHA256_End(SHA256_CTX *, char [SHA256_DIGEST_STRING_LENGTH]); char* SHA256_Data(const apr_byte_t *, size_t, char [SHA256_DIGEST_STRING_LENGTH]); -void SHA384_Init(SHA384_CTX *); -void SHA384_Update(SHA384_CTX *, const apr_byte_t *, size_t); -void SHA384_Final(apr_byte_t [SHA384_DIGEST_LENGTH], SHA384_CTX *); +void apr__SHA384_Init(SHA384_CTX *); +void apr__SHA384_Update(SHA384_CTX *, const apr_byte_t *, size_t); +void apr__SHA384_Final(apr_byte_t [SHA384_DIGEST_LENGTH], SHA384_CTX *); char* SHA384_End(SHA384_CTX *, char [SHA384_DIGEST_STRING_LENGTH]); char* SHA384_Data(const apr_byte_t *, size_t, char [SHA384_DIGEST_STRING_LENGTH]); -void SHA512_Init(SHA512_CTX *); -void SHA512_Update(SHA512_CTX *, const apr_byte_t *, size_t); -void SHA512_Final(apr_byte_t [SHA512_DIGEST_LENGTH], SHA512_CTX *); +void apr__SHA512_Init(SHA512_CTX *); +void apr__SHA512_Update(SHA512_CTX *, const apr_byte_t *, size_t); +void apr__SHA512_Final(apr_byte_t [SHA512_DIGEST_LENGTH], SHA512_CTX *); char* SHA512_End(SHA512_CTX *, char [SHA512_DIGEST_STRING_LENGTH]); char* SHA512_Data(const apr_byte_t *, size_t, char [SHA512_DIGEST_STRING_LENGTH]); Modified: apr/apr/branches/1.2.x/random/unix/sha2_glue.c URL: http://svn.apache.org/viewcvs/apr/apr/branches/1.2.x/random/unix/sha2_glue.c?rev=355159&r1=355158&r2=355159&view=diff ============================================================================== --- apr/apr/branches/1.2.x/random/unix/sha2_glue.c (original) +++ apr/apr/branches/1.2.x/random/unix/sha2_glue.c Thu Dec 8 09:56:53 2005 @@ -5,18 +5,18 @@ static void sha256_init(apr_crypto_hash_t *h) { - SHA256_Init(h->data); + apr__SHA256_Init(h->data); } static void sha256_add(apr_crypto_hash_t *h,const void *data, apr_size_t bytes) { - SHA256_Update(h->data,data,bytes); + apr__SHA256_Update(h->data,data,bytes); } static void sha256_finish(apr_crypto_hash_t *h,unsigned char *result) { - SHA256_Final(result,h->data); + apr__SHA256_Final(result,h->data); } APR_DECLARE(apr_crypto_hash_t *) apr_crypto_sha256_new(apr_pool_t *p)