--- parser3/src/lib/md5/pa_md5c.c 2004/02/11 15:33:15 1.12 +++ parser3/src/lib/md5/pa_md5c.c 2024/11/04 03:53:25 1.22 @@ -3,7 +3,7 @@ Replaced ap_ to pa_ prefixes. linked into all targets but Apache-module target, where linked targets/apache/pa_md5c.c stub instead. - Copyright (c) 2001-2004 ArtLebedev Group (http://www.artlebedev.com) + Copyright (c) 2001-2024 Art. Lebedev Studio (http://www.artlebedev.com) */ /* @@ -107,13 +107,9 @@ * ---------------------------------------------------------------------------- */ -static const char * const IDENT_MD5_C="$Date: 2004/02/11 15:33:15 $"; - -#include - #include "pa_md5.h" -#define pa_pa_cpystrn(strDest, strSource, count) strncpy(strDest, strSource, count) +volatile const char * IDENT_PA_MD5_C="$Id: pa_md5c.c,v 1.22 2024/11/04 03:53:25 moko Exp $" IDENT_PA_MD5_H; /* Constants for MD5Transform routine. */ @@ -185,7 +181,7 @@ static unsigned char PADDING[64] = /* MD5 initialization. Begins an MD5 operation, writing a new context. */ -PA_API_EXPORT(void) pa_MD5Init(PA_MD5_CTX *context) +void pa_MD5Init(PA_MD5_CTX *context) { context->count[0] = context->count[1] = 0; /* Load magic initialization constants. */ @@ -199,7 +195,7 @@ PA_API_EXPORT(void) pa_MD5Init(PA_MD5_CT operation, processing another message block, and updating the context. */ -PA_API_EXPORT(void) pa_MD5Update(PA_MD5_CTX *context, const unsigned char *input, +void pa_MD5Update(PA_MD5_CTX *context, const unsigned char *input, unsigned int inputLen) { unsigned int i, idx, partLen; @@ -259,7 +255,7 @@ PA_API_EXPORT(void) pa_MD5Update(PA_MD5_ /* MD5 finalization. Ends an MD5 message-digest operation, writing the the message digest and zeroizing the context. */ -PA_API_EXPORT(void) pa_MD5Final(unsigned char digest[16], PA_MD5_CTX *context) +void pa_MD5Final(unsigned char digest[16], PA_MD5_CTX *context) { unsigned char bits[8]; unsigned int idx, padLen; @@ -420,7 +416,7 @@ static void Decode(UINT4 *output, const * the FreeBSD 3.0 /usr/src/lib/libcrypt/crypt.c file, which is * licenced as stated at the top of this file. */ -PA_API_EXPORT(void) pa_to64(char *s, unsigned long v, int n) +void pa_to64(char *s, unsigned long v, int n) { static unsigned char itoa64[] = /* 0 ... 63 => ASCII - 64 */ "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; @@ -431,7 +427,7 @@ PA_API_EXPORT(void) pa_to64(char *s, uns } } -PA_API_EXPORT(void) pa_MD5Encode(const unsigned char *pw, +void pa_MD5Encode(const unsigned char *pw, const unsigned char *salt, char *result, size_t nbytes) { @@ -531,8 +527,8 @@ PA_API_EXPORT(void) pa_MD5Encode(const u * Now make the output string. We know our limitations, so we * can use the string routines without bounds checking. */ - pa_pa_cpystrn(passwd, PA_MD5PW_ID, PA_MD5PW_IDLEN + 1); - pa_pa_cpystrn(passwd + PA_MD5PW_IDLEN, (char *)sp, sl + 1); + strncpy(passwd, PA_MD5PW_ID, PA_MD5PW_IDLEN + 1); + strncpy(passwd + PA_MD5PW_IDLEN, (char *)sp, sl + 1); passwd[PA_MD5PW_IDLEN + sl] = '$'; passwd[PA_MD5PW_IDLEN + sl + 1] = '\0'; @@ -583,5 +579,5 @@ PA_API_EXPORT(void) pa_MD5Encode(const u */ memset(final, 0, sizeof(final)); - pa_pa_cpystrn(result, passwd, nbytes - 1); + strncpy(result, passwd, nbytes - 1); }