From: rousskov <> Date: Wed, 3 Jun 1998 22:35:33 +0000 (+0000) Subject: - use memcpy and memset in md5.c instead of MD5_memcpy and MD5_memset X-Git-Tag: SQUID_3_0_PRE1~3188 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dac27377821e08080e87d33fa3751c8a47a16298;p=thirdparty%2Fsquid.git - use memcpy and memset in md5.c instead of MD5_memcpy and MD5_memset if we can --- diff --git a/configure b/configure index 76e664b5af..305f2d4943 100755 --- a/configure +++ b/configure @@ -3523,6 +3523,7 @@ for ac_func in \ mallopt \ memcpy \ memmove \ + memset \ mktime \ mstats \ random \ @@ -3546,12 +3547,12 @@ for ac_func in \ do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3550: checking for $ac_func" >&5 +echo "configure:3551: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3579: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3612,12 +3613,12 @@ case "$host" in ;; *) echo $ac_n "checking for poll""... $ac_c" 1>&6 -echo "configure:3616: checking for poll" >&5 +echo "configure:3617: checking for poll" >&5 if eval "test \"`echo '$''{'ac_cv_func_poll'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3645: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_poll=yes" else @@ -3663,7 +3664,7 @@ fi esac echo $ac_n "checking if setresuid is implemented""... $ac_c" 1>&6 -echo "configure:3667: checking if setresuid is implemented" >&5 +echo "configure:3668: checking if setresuid is implemented" >&5 if eval "test \"`echo '$''{'ac_cv_func_setresuid'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3671,7 +3672,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < @@ -3684,7 +3685,7 @@ else } EOF -if { (eval echo configure:3688: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3689: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_func_setresuid="yes" else @@ -3718,13 +3719,13 @@ if test -z "$USE_GNUREGEX" ; then esac fi echo $ac_n "checking if GNUregex needs to be compiled""... $ac_c" 1>&6 -echo "configure:3722: checking if GNUregex needs to be compiled" >&5 +echo "configure:3723: checking if GNUregex needs to be compiled" >&5 if test -z "$USE_GNUREGEX"; then if test "$ac_cv_func_regcomp" = "no" || test "$USE_GNUREGEX" = "yes" ; then USE_GNUREGEX="yes" else cat > conftest.$ac_ext < #include @@ -3732,7 +3733,7 @@ int main() { regex_t t; regcomp(&t,"",0); ; return 0; } EOF -if { (eval echo configure:3736: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3737: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* USE_GNUREGEX="no" else @@ -3762,12 +3763,12 @@ for ac_func in \ do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3766: checking for $ac_func" >&5 +echo "configure:3767: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3795: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3818,12 +3819,12 @@ done echo $ac_n "checking Default FD_SETSIZE value""... $ac_c" 1>&6 -echo "configure:3822: checking Default FD_SETSIZE value" >&5 +echo "configure:3823: checking Default FD_SETSIZE value" >&5 if test "$cross_compiling" = yes; then DEFAULT_FD_SETSIZE=256 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3852: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then DEFAULT_FD_SETSIZE=`cat conftestval` else @@ -3866,12 +3867,12 @@ EOF echo $ac_n "checking Maximum number of filedescriptors we can open""... $ac_c" 1>&6 -echo "configure:3870: checking Maximum number of filedescriptors we can open" >&5 +echo "configure:3871: checking Maximum number of filedescriptors we can open" >&5 if test "$cross_compiling" = yes; then SQUID_MAXFD=256 else cat > conftest.$ac_ext < @@ -3930,7 +3931,7 @@ main() { } EOF -if { (eval echo configure:3934: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3935: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then SQUID_MAXFD=`cat conftestval` else @@ -3956,12 +3957,12 @@ if test "$SQUID_MAXFD" -lt 512 ; then fi echo $ac_n "checking Default UDP send buffer size""... $ac_c" 1>&6 -echo "configure:3960: checking Default UDP send buffer size" >&5 +echo "configure:3961: checking Default UDP send buffer size" >&5 if test "$cross_compiling" = yes; then SQUID_UDP_SO_SNDBUF=16384 else cat > conftest.$ac_ext < @@ -3980,7 +3981,7 @@ main () } EOF -if { (eval echo configure:3984: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3985: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then SQUID_UDP_SO_SNDBUF=`cat conftestval` else @@ -3999,12 +4000,12 @@ EOF echo $ac_n "checking Default UDP receive buffer size""... $ac_c" 1>&6 -echo "configure:4003: checking Default UDP receive buffer size" >&5 +echo "configure:4004: checking Default UDP receive buffer size" >&5 if test "$cross_compiling" = yes; then SQUID_UDP_SO_RCVBUF=16384 else cat > conftest.$ac_ext < @@ -4023,7 +4024,7 @@ main () } EOF -if { (eval echo configure:4027: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4028: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then SQUID_UDP_SO_RCVBUF=`cat conftestval` else @@ -4042,12 +4043,12 @@ EOF echo $ac_n "checking Default TCP send buffer size""... $ac_c" 1>&6 -echo "configure:4046: checking Default TCP send buffer size" >&5 +echo "configure:4047: checking Default TCP send buffer size" >&5 if test "$cross_compiling" = yes; then SQUID_TCP_SO_SNDBUF=16384 else cat > conftest.$ac_ext < @@ -4066,7 +4067,7 @@ main () } EOF -if { (eval echo configure:4070: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4071: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then SQUID_TCP_SO_SNDBUF=`cat conftestval` else @@ -4085,12 +4086,12 @@ EOF echo $ac_n "checking Default TCP receive buffer size""... $ac_c" 1>&6 -echo "configure:4089: checking Default TCP receive buffer size" >&5 +echo "configure:4090: checking Default TCP receive buffer size" >&5 if test "$cross_compiling" = yes; then SQUID_TCP_SO_RCVBUF=16384 else cat > conftest.$ac_ext < @@ -4109,7 +4110,7 @@ main () } EOF -if { (eval echo configure:4113: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4114: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then SQUID_TCP_SO_RCVBUF=`cat conftestval` else @@ -4127,56 +4128,20 @@ cat >> confdefs.h <&6 -echo "configure:4133: checking what snprintf() returns when truncating" >&5 - if test "$cross_compiling" = yes; then - SNPRINTF_TRUNC_RET=-1 -else - cat > conftest.$ac_ext < - main () - { - char buf[10]; - int x; - x = snprintf(buf, 10, "ABCDEFGHIJKLM"); - fprintf (fopen("conftestval", "w"), "%d\n", x); - exit(0); - } - -EOF -if { (eval echo configure:4152: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null -then - SNPRINTF_TRUNC_RET=`cat conftestval` -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - SNPRINTF_TRUNC_RET=-1 -fi -rm -fr conftest* -fi - - echo "$ac_t""$SNPRINTF_TRUNC_RET" 1>&6 -fi - echo $ac_n "checking if sys_errlist is already defined""... $ac_c" 1>&6 -echo "configure:4168: checking if sys_errlist is already defined" >&5 +echo "configure:4133: checking if sys_errlist is already defined" >&5 if eval "test \"`echo '$''{'ac_cv_needs_sys_errlist'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { char *s = sys_errlist0; ; return 0; } EOF -if { (eval echo configure:4180: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4145: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_needs_sys_errlist="no" else @@ -4198,16 +4163,16 @@ EOF fi echo $ac_n "checking for libresolv _dns_ttl_ hack""... $ac_c" 1>&6 -echo "configure:4202: checking for libresolv _dns_ttl_ hack" >&5 +echo "configure:4167: checking for libresolv _dns_ttl_ hack" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4176: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF diff --git a/configure.in b/configure.in index 52b78c3a4e..12e75a7b0f 100644 --- a/configure.in +++ b/configure.in @@ -3,13 +3,13 @@ dnl Configuration input file for Squid dnl dnl Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.9) dnl -dnl $Id: configure.in,v 1.130 1998/05/28 16:07:36 wessels Exp $ +dnl $Id: configure.in,v 1.131 1998/06/03 16:35:34 rousskov Exp $ dnl dnl dnl AC_INIT(src/main.c) AC_CONFIG_HEADER(include/autoconf.h) -AC_REVISION($Revision: 1.130 $)dnl +AC_REVISION($Revision: 1.131 $)dnl AC_PREFIX_DEFAULT(/usr/local/squid) AC_CONFIG_AUX_DIR(cfgaux) @@ -659,6 +659,7 @@ AC_CHECK_FUNCS(\ mallopt \ memcpy \ memmove \ + memset \ mktime \ mstats \ random \ diff --git a/include/autoconf.h.in b/include/autoconf.h.in index 59a6f32272..9ca1ad7aa5 100644 --- a/include/autoconf.h.in +++ b/include/autoconf.h.in @@ -263,6 +263,9 @@ /* Define if you have the memmove function. */ #undef HAVE_MEMMOVE +/* Define if you have the memset function. */ +#undef HAVE_MEMSET + /* Define if you have the mktime function. */ #undef HAVE_MKTIME diff --git a/lib/md5.c b/lib/md5.c index 2435214043..27f43318c5 100644 --- a/lib/md5.c +++ b/lib/md5.c @@ -37,6 +37,10 @@ * and by the SNMP routines. */ +#if HAVE_STRING_H +#include +#endif + #include "md5.h" /* @@ -62,8 +66,18 @@ static void MD5Transform(u_num32[4], unsigned char[64]); static void Encode(unsigned char *, u_num32 *, unsigned int); static void Decode(u_num32 *, unsigned char *, unsigned int); + +#if HAVE_MEMCPY +#define MD5_memcpy(to,from,count) memcpy(to,from,count) +#else static void MD5_memcpy(unsigned char *, unsigned char *, unsigned int); +#endif + +#if HAVE_MEMSET +#define MD5_memset(buf,chr,count) memset(buf,chr,count) +#else static void MD5_memset(char *, int, unsigned int); +#endif static unsigned char PADDING[64] = { @@ -319,6 +333,7 @@ Decode(u_num32 * output, unsigned char *input, unsigned int len) (((u_num32) input[j + 2]) << 16) | (((u_num32) input[j + 3]) << 24); } +#if !HAVE_MEMCPY /* * Note: Replace "for loop" with standard memcpy if possible. */ @@ -330,7 +345,9 @@ MD5_memcpy(unsigned char *output, unsigned char *input, unsigned int len) for (i = 0; i < len; i++) output[i] = input[i]; } +#endif +#if !HAVE_MEMSET /* * Note: Replace "for loop" with standard memset if possible. */ @@ -341,3 +358,4 @@ MD5_memset(char *output, int value, unsigned int len) for (i = 0; i < len; i++) output[i] = (char) value; } +#endif