diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-11-11 00:14:42 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-11-11 00:14:42 +0200 |
commit | 75767d432e61a4e8a9be5de612740faa42fdc2d0 (patch) | |
tree | e37fcc66d9fe554da1bb61b0b1581fe105869b23 | |
parent | ccac64fee5b42b6463f328510086c5616142e283 (diff) | |
download | anubis-75767d432e61a4e8a9be5de612740faa42fdc2d0.tar.gz anubis-75767d432e61a4e8a9be5de612740faa42fdc2d0.tar.bz2 |
Housekeeping changes.
* build/ylwrap: Remove.
* src/rcfile.y: Remove to..
* src/rc-gram.y: .. this.
* src/rcfile.l: Remove to..
* src/rc-lex.l: .. this.
* po/POTFILES.in: Reflect the above changes.
* src/Makefile.am: Likewise.
(YLWRAP): Remove.
(EXTRA_DIST,BUILT_SOURCES): Remove rcfile.y rcfile.l and
the generated counterparts.
(rcfile-lex.c, rcfile-gram.c): Remove.
* src/getopt.m4 (print_help): Minor change.
* src/md5.c: Reindent.
(F1): Revert to the optimized version.
* .gitignore, build/.gitignore, src/.gitignore: Update.
* build/Makefile.am (EXTRA_DIST): Remove ylwrap.
* configure.ac (AM_INIT_AUTOMAKE): Add more options.
* doc/anubis.texi: Update.
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | build/.gitignore | 1 | ||||
-rw-r--r-- | build/Makefile.am | 4 | ||||
-rwxr-xr-x | build/ylwrap | 170 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | doc/anubis.texi | 4 | ||||
-rw-r--r-- | po/POTFILES.in | 4 | ||||
-rw-r--r-- | src/.gitignore | 8 | ||||
-rw-r--r-- | src/Makefile.am | 24 | ||||
-rw-r--r-- | src/getopt.m4 | 4 | ||||
-rw-r--r-- | src/md5.c | 416 | ||||
-rw-r--r-- | src/rc-gram.y (renamed from src/rcfile.y) | 0 | ||||
-rw-r--r-- | src/rc-lex.l (renamed from src/rcfile.l) | 2 |
14 files changed, 237 insertions, 407 deletions
@@ -1,5 +1,7 @@ *.a *.o +*.tar.bz2 +*.tar.gz *~ .deps .emacs* @@ -16,6 +18,5 @@ config.h.in config.log config.status configure -intl m4 stamp-h1 diff --git a/Makefile.am b/Makefile.am index 05dd8e4..95190d6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,7 +2,7 @@ ## Makefile.am ## ## This file is part of GNU Anubis. -## Copyright (C) 2001, 2002, 2003, 2004, 2007, 2008 The Anubis Team. +## Copyright (C) 2001, 2002, 2003, 2004, 2007, 2008, 2009 The Anubis Team. ## ## GNU Anubis is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the diff --git a/build/.gitignore b/build/.gitignore index 27a67ad..f95ad11 100644 --- a/build/.gitignore +++ b/build/.gitignore @@ -12,3 +12,4 @@ mdate-sh missing mkinstalldirs texinfo.tex +ylwrap diff --git a/build/Makefile.am b/build/Makefile.am index b59b0fd..0982cb9 100644 --- a/build/Makefile.am +++ b/build/Makefile.am @@ -2,7 +2,7 @@ ## build/Makefile.am ## ## This file is part of GNU Anubis. -## Copyright (C) 2001, 2002, 2003, 2007 The Anubis Team. +## Copyright (C) 2001, 2002, 2003, 2007, 2009 The Anubis Team. ## ## GNU Anubis is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the @@ -19,7 +19,7 @@ ## SUBDIRS = guile-1.6 -EXTRA_DIST = keygen.sh specgen.sh ylwrap cflow.rc +EXTRA_DIST = keygen.sh specgen.sh cflow.rc ## EOF diff --git a/build/ylwrap b/build/ylwrap deleted file mode 100755 index 0f96fb0..0000000 --- a/build/ylwrap +++ /dev/null @@ -1,170 +0,0 @@ -#! /bin/sh -# ylwrap - wrapper for lex/yacc invocations. -# Copyright 1996, 1997, 1998, 1999 Free Software Foundation, Inc. -# Written by Tom Tromey <tromey@cygnus.com>. -# -yy modification by Sergey Poznyakoff <gray@farlep.net> -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -# Usage: -# ylwrap PROGRAM [ARGS] INPUT [OUTPUT DESIRED]... -- [-yy repl] [ARGS]... -# * PROGRAM is program to run; options can follow but must start with `-'. -# * INPUT is the input file -# * OUTPUT is file PROG generates -# * DESIRED is file we actually want -# * ARGS are passed to PROG -# * Optional -yy introduces the sequence to replace yy prefixes with. -# Any number of OUTPUT,DESIRED pairs may be used. - -# The program to run. -prog="$1" -shift -# Make any relative path in $prog absolute. -case "$prog" in - /* | [A-Za-z]:*) ;; - */*) prog="`pwd`/$prog" ;; -esac - -# We also have to accept options here and append them to the program. -# Why? Suppose YACC is set to `bison -y'. Clearly nobody uses -# ylwrap, or this would have been discovered earlier! -while :; do - case "$1" in - -*) - prog="$prog $1" - shift - ;; - *) - break - ;; - esac -done - -# The input. -input="$1" -shift -case "$input" in - /* | [A-Za-z]:*) - # Absolute path; do nothing. - ;; - *) - # Relative path. Make it absolute. - input="`pwd`/$input" - ;; -esac - -# The directory holding the input. -input_dir="`echo $input | sed -e 's,/[^/]*$,,'`" -# Quote $INPUT_DIR so we can use it in a regexp. -# FIXME: really we should care about more than `.'. -input_rx="`echo $input_dir | sed -e 's,\.,\\\.,g'`" - -pairlist= -while test "$#" -ne 0; do - if test "$1" = "--"; then - shift - break - fi - pairlist="$pairlist $1" - shift -done - -if [ $# -ne 0 ]; then - if [ "x$1" = "x-yy" ]; then - shift - if [ $# -eq 0 ]; then - echo "ylwrap: -yy requires an argument" - exit 1 - fi - YYREPL=$1 - shift - fi -fi - -# FIXME: add hostname here for parallel makes that run commands on -# other machines. But that might take us over the 14-char limit. -dirname=ylwrap$$ -trap "cd `pwd`; rm -rf $dirname > /dev/null 2>&1" 1 2 3 15 -mkdir $dirname || exit 1 - -cd $dirname - -$prog ${1+"$@"} "$input" -status=$? - -if test $status -eq 0; then - set X $pairlist - shift - first=yes - # Since DOS filename conventions don't allow two dots, - # the DOS version of Bison writes out y_tab.c instead of y.tab.c - # and y_tab.h instead of y.tab.h. Test to see if this is the case. - y_tab_nodot="no" - if test -f y_tab.c || test -f y_tab.h; then - y_tab_nodot="yes" - fi - - while test "$#" -ne 0; do - from="$1" - # Handle y_tab.c and y_tab.h output by DOS - if test $y_tab_nodot = "yes"; then - if test $from = "y.tab.c"; then - from="y_tab.c" - else - if test $from = "y.tab.h"; then - from="y_tab.h" - fi - fi - fi - if test -f "$from"; then - # If $2 is an absolute path name, then just use that, - # otherwise prepend `../'. - case "$2" in - /* | [A-Za-z]:*) target="$2";; - *) target="../$2";; - esac - - # Edit out `#line' or `#' directives. We don't want the - # resulting debug information to point at an absolute srcdir; - # it is better for it to just mention the .y file with no - # path. - EXPR="/^#/ s,$input_rx/,," - if [ ! -z "$YYREPL" ]; then - EXPR="$EXPR;s/yy/$YYREPL/g" - fi - sed -e "$EXPR" "$from" > "$target" || status=$? - else - # A missing file is only an error for the first file. This - # is a blatant hack to let us support using "yacc -d". If -d - # is not specified, we don't want an error when the header - # file is "missing". - if test $first = yes; then - status=1 - fi - fi - shift - shift - first=no - done -else - status=$? -fi - -# Remove the directory. -cd .. -rm -rf $dirname - -exit $status - diff --git a/configure.ac b/configure.ac index 09a3379..8536913 100644 --- a/configure.ac +++ b/configure.ac @@ -24,7 +24,7 @@ AC_PREREQ([2.63]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_AUX_DIR([build]) AC_CONFIG_SRCDIR([src/main.c]) -AM_INIT_AUTOMAKE([1.11 gnits]) +AM_INIT_AUTOMAKE([1.11 gnits tar-ustar dist-bzip2 std-options silent-rules]) AC_GNU_SOURCE dnl Enable silent rules by default: diff --git a/doc/anubis.texi b/doc/anubis.texi index 012ef3a..1fb42eb 100644 --- a/doc/anubis.texi +++ b/doc/anubis.texi @@ -1607,9 +1607,7 @@ user-notprivileged "anubis" @end smallexample @strong{Caution:} This user must exist in the system user database -(@file{/etc/passwd}). @FIXME{Verify if this is true:}If GNU Anubis is -using PAM support, it is recommended to add this user to the -@w{@file{/etc/anubis.allow}} file. +(@file{/etc/passwd}). @end deffn @deffn Option rule-priority @var{value} diff --git a/po/POTFILES.in b/po/POTFILES.in index 6d5212c..04c02e3 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -23,8 +23,8 @@ src/net.c src/socks.c src/quit.c src/rcfile.c -src/rcfile.l -src/rcfile.y +src/rc-lex.l +src/rc-gram.y src/regex.c src/tls.c src/transmode.c diff --git a/src/.gitignore b/src/.gitignore index 72982e8..5f88fe3 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -6,10 +6,10 @@ anubis anubisadm anubisusr libanubisdb.a -y.output -rcfile-lex.c -rcfile-gram.c -rcfile-gram.h +rc-lex.c +rc-gram.c +rc-gram.h +rc-gram.output usr.c adm.c env.c diff --git a/src/Makefile.am b/src/Makefile.am index 2a59654..d892344 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -56,9 +56,9 @@ anubis_SOURCES = \ quit.c \ rcfile.c \ rcfile.h \ - rcfile-gram.c \ - rcfile-gram.h \ - rcfile-lex.c \ + rc-gram.y \ + rc-gram.h \ + rc-lex.l \ regex.c \ socks.c \ transmode.c \ @@ -86,24 +86,10 @@ libanubisdb_a_SOURCES = \ tls.c \ url.c -YLWRAP = $(SHELL) $(top_srcdir)/build/ylwrap AM_YFLAGS = -dtv -EXTRA_DIST = rcfile.y rcfile.l getopt.m4 env.opt +EXTRA_DIST = getopt.m4 env.opt -BUILT_SOURCES= \ - rcfile-gram.c rcfile-gram.h \ - rcfile-lex.c env.c - -rcfile-lex.c: $(srcdir)/rcfile.l rcfile-gram.h - $(YLWRAP) "$(LEX) $(AM_LEXFLAGS) $(LEXFLAGS)" \ - $(srcdir)/rcfile.l lex.yy.c rcfile-lex.c \ - -- -yy rc_yy - -rcfile-gram.c rcfile-gram.h: $(srcdir)/rcfile.y - $(YLWRAP) "$(YACC) $(AM_YFLAGS) $(YFLAGS)" $(srcdir)/rcfile.y \ - y.tab.c rcfile-gram.c y.tab.h rcfile-gram.h \ - y.output y.output \ - -- -yy rc_yy +BUILT_SOURCES = env.c localedir = $(datadir)/locale DEFS = @DEFS@ -DLOCALEDIR=\"$(localedir)\" diff --git a/src/getopt.m4 b/src/getopt.m4 index 4c78394..568a51b 100644 --- a/src/getopt.m4 +++ b/src/getopt.m4 @@ -1,5 +1,5 @@ dnl This file is part of GNU Anubis. -dnl Copyright (C) 2007, 2008 The Anubis Team. +dnl Copyright (C) 2007, 2008, 2009 The Anubis Team. dnl dnl GNU Anubis is free software; you can redistribute it and/or modify it dnl under the terms of the GNU General Public License as published by the @@ -262,7 +262,7 @@ print_help(void) printf ("%s %s [%s]... %s\n", _("Usage:"), [<$2>], _("[<OPTION>]"), gettext (args_doc)); - if (doc && doc[0]) + if (doc[0]) print_option_descr(gettext (doc), 0, RMARGIN); putchar ('\n'); @@ -21,48 +21,54 @@ # include <config.h> #endif -#include <string.h> /* for memcpy() */ +#include <string.h> /* for memcpy() */ #include <unistd.h> /* FIXME: should be configurable */ -typedef unsigned long anubis_uint32_t; +typedef unsigned long anubis_uint32_t; -struct MD5Context { - anubis_uint32_t buf[4]; - anubis_uint32_t bits[2]; - unsigned char in[64]; +struct MD5Context +{ + anubis_uint32_t buf[4]; + anubis_uint32_t bits[2]; + unsigned char in[64]; }; -static void anubis_MD5Init(struct MD5Context *context); -static void anubis_MD5Update(struct MD5Context *context, unsigned char const *buf, - unsigned len); -static void anubis_MD5Final(unsigned char digest[16], struct MD5Context *context); -static void anubis_MD5Transform(anubis_uint32_t buf[4], anubis_uint32_t const in[16]); +static void anubis_MD5Init (struct MD5Context *context); +static void anubis_MD5Update (struct MD5Context *context, + unsigned char const *buf, unsigned len); +static void anubis_MD5Final (unsigned char digest[16], + struct MD5Context *context); +static void anubis_MD5Transform (anubis_uint32_t buf[4], + anubis_uint32_t const in[16]); static void -bytes_encode(unsigned char *output, anubis_uint32_t *input, unsigned int len) +bytes_encode (unsigned char *output, anubis_uint32_t * input, + unsigned int len) { - unsigned int i, j; - - for (i = 0, j = 0; j < len; i++, j += 4) { - output[j] = (unsigned char)(input[i] & 0xff); - output[j+1] = (unsigned char)((input[i] >> 8) & 0xff); - output[j+2] = (unsigned char)((input[i] >> 16) & 0xff); - output[j+3] = (unsigned char)((input[i] >> 24) & 0xff); - } + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) + { + output[j] = (unsigned char) (input[i] & 0xff); + output[j + 1] = (unsigned char) ((input[i] >> 8) & 0xff); + output[j + 2] = (unsigned char) ((input[i] >> 16) & 0xff); + output[j + 3] = (unsigned char) ((input[i] >> 24) & 0xff); + } } -static void -bytes_decode(anubis_uint32_t *output, unsigned char *input, unsigned int len) +static void +bytes_decode (anubis_uint32_t * output, unsigned char *input, + unsigned int len) { - unsigned int i, j; - - for (i = 0, j = 0; j < len; i++, j += 4) - output[i] = ((anubis_uint32_t)input[j]) | - (((anubis_uint32_t)input[j+1]) << 8) | - (((anubis_uint32_t)input[j+2]) << 16) | - (((anubis_uint32_t)input[j+3]) << 24); + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) + output[i] = ((anubis_uint32_t) input[j]) | + (((anubis_uint32_t) input[j + 1]) << 8) | + (((anubis_uint32_t) input[j + 2]) << 16) | + (((anubis_uint32_t) input[j + 3]) << 24); } /* @@ -70,15 +76,15 @@ bytes_decode(anubis_uint32_t *output, unsigned char *input, unsigned int len) * initialization constants. */ static void -anubis_MD5Init(struct MD5Context *ctx) +anubis_MD5Init (struct MD5Context *ctx) { - ctx->buf[0] = 0x67452301; - ctx->buf[1] = 0xefcdab89; - ctx->buf[2] = 0x98badcfe; - ctx->buf[3] = 0x10325476; + ctx->buf[0] = 0x67452301; + ctx->buf[1] = 0xefcdab89; + ctx->buf[2] = 0x98badcfe; + ctx->buf[3] = 0x10325476; - ctx->bits[0] = 0; - ctx->bits[1] = 0; + ctx->bits[0] = 0; + ctx->bits[1] = 0; } /* @@ -86,44 +92,48 @@ anubis_MD5Init(struct MD5Context *ctx) * of bytes. */ static void -anubis_MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len) +anubis_MD5Update (struct MD5Context *ctx, unsigned char const *buf, + unsigned len) { - anubis_uint32_t t; - - /* Update bitcount */ - - t = ctx->bits[0]; - if ((ctx->bits[0] = t + ((anubis_uint32_t) len << 3)) < t) - ctx->bits[1]++; /* Carry from low to high */ - ctx->bits[1] += len >> 29; - - t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */ - /* Handle any leading odd-sized chunks */ - - if (t) { - unsigned char *p = (unsigned char *) ctx->in + t; - t = 64 - t; - if (len < t) { - memcpy(p, buf, len); - return; - } - memcpy(p, buf, t); - anubis_MD5Transform(ctx->buf, (anubis_uint32_t *) ctx->in); - buf += t; - len -= t; + anubis_uint32_t t; + + /* Update bitcount */ + + t = ctx->bits[0]; + if ((ctx->bits[0] = t + ((anubis_uint32_t) len << 3)) < t) + ctx->bits[1]++; /* Carry from low to high */ + ctx->bits[1] += len >> 29; + + t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */ + /* Handle any leading odd-sized chunks */ + + if (t) + { + unsigned char *p = (unsigned char *) ctx->in + t; + t = 64 - t; + if (len < t) + { + memcpy (p, buf, len); + return; + } + memcpy (p, buf, t); + anubis_MD5Transform (ctx->buf, (anubis_uint32_t *) ctx->in); + buf += t; + len -= t; } - /* Process data in 64-byte chunks */ + /* Process data in 64-byte chunks */ - while (len >= 64) { - memcpy(ctx->in, buf, 64); - anubis_MD5Transform(ctx->buf, (anubis_uint32_t const *) buf); - buf += 64; - len -= 64; + while (len >= 64) + { + memcpy (ctx->in, buf, 64); + anubis_MD5Transform (ctx->buf, (anubis_uint32_t const *) buf); + buf += 64; + len -= 64; } - /* Handle any remaining bytes of data. */ + /* Handle any remaining bytes of data. */ - memcpy(ctx->in, buf, len); + memcpy (ctx->in, buf, len); } /* @@ -131,63 +141,67 @@ anubis_MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len) * 1 0* (64-bit count of bits processed, MSB-first) */ static void -anubis_MD5Final(unsigned char digest[16], struct MD5Context *ctx) +anubis_MD5Final (unsigned char digest[16], struct MD5Context *ctx) { - unsigned count; - unsigned char *p; - - /* Compute number of bytes mod 64 */ - count = (ctx->bits[0] >> 3) & 0x3F; - - /* Set the first char of padding to 0x80. This is safe since there is - always at least one byte free */ - p = ctx->in + count; - *p++ = 0x80; - - /* Bytes of padding needed to make 64 bytes */ - count = 64 - 1 - count; - - /* Pad out to 56 mod 64 */ - if (count < 8) { - /* Two lots of padding: Pad the first block to 64 bytes */ - memset(p, 0, count); - anubis_MD5Transform(ctx->buf, (anubis_uint32_t *) ctx->in); - - /* Now fill the next block with 56 bytes */ - memset(ctx->in, 0, 56); - } else { - /* Pad block to 56 bytes */ - memset(p, 0, count - 8); + unsigned count; + unsigned char *p; + + /* Compute number of bytes mod 64 */ + count = (ctx->bits[0] >> 3) & 0x3F; + + /* Set the first char of padding to 0x80. This is safe since there is + always at least one byte free */ + p = ctx->in + count; + *p++ = 0x80; + + /* Bytes of padding needed to make 64 bytes */ + count = 64 - 1 - count; + + /* Pad out to 56 mod 64 */ + if (count < 8) + { + /* Two lots of padding: Pad the first block to 64 bytes */ + memset (p, 0, count); + anubis_MD5Transform (ctx->buf, (anubis_uint32_t *) ctx->in); + + /* Now fill the next block with 56 bytes */ + memset (ctx->in, 0, 56); + } + else + { + /* Pad block to 56 bytes */ + memset (p, 0, count - 8); } - /* Append length in bits and transform */ - bytes_encode((unsigned char*)((anubis_uint32_t *) ctx->in + 14), ctx->bits, 8); - anubis_MD5Transform(ctx->buf, (anubis_uint32_t *) ctx->in); - bytes_encode(digest,ctx->buf,16); - memset((char *) ctx, 0, sizeof(ctx)); /* In case it's sensitive */ + /* Append length in bits and transform */ + bytes_encode ((unsigned char *) ((anubis_uint32_t *) ctx->in + 14), + ctx->bits, 8); + anubis_MD5Transform (ctx->buf, (anubis_uint32_t *) ctx->in); + bytes_encode (digest, ctx->buf, 16); + memset ((char *) ctx, 0, sizeof (ctx)); /* In case it's sensitive */ } /* The four core functions - F1 is optimized somewhat */ -#define F1(x, y, z) (x & y | ~x & z) -/*#define F1(x, y, z) (z ^ (x & (y ^ z))) */ +/*#define F1(x, y, z) ((x & y) | (~x & z))*/ +#define F1(x, y, z) (z ^ (x & (y ^ z))) #define F2(x, y, z) F1(z, x, y) #define F3(x, y, z) (x ^ y ^ z) #define F4(x, y, z) (y ^ (x | ~z)) /* This is the central step in the MD5 algorithm. */ #define MD5STEP(f, w, x, y, z, data, s) \ - ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x ); + ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x ); #if 0 -dump(char *label,unsigned char *p, int len) +dump (char *label, unsigned char *p, int len) { - int i; - return; - printf("dump: %s\n", label); - for (i=0; i<len; i++) - printf("%x\n", p[i]); - printf("--\n"); + int i; + return; + printf ("dump: %s\n", label); + for (i = 0; i < len; i++) + printf ("%x\n", p[i]); + printf ("--\n"); } #endif @@ -198,90 +212,90 @@ dump(char *label,unsigned char *p, int len) * the data and converts bytes into longwords for this routine. */ static void -anubis_MD5Transform(anubis_uint32_t buf[4], anubis_uint32_t const cin[16]) +anubis_MD5Transform (anubis_uint32_t buf[4], anubis_uint32_t const cin[16]) { - register anubis_uint32_t a, b, c, d; - anubis_uint32_t in[16]; - - bytes_decode(in, (unsigned char *) cin, 64); - - a = buf[0]; - b = buf[1]; - c = buf[2]; - d = buf[3]; - - MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); - MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); - MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); - MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); - MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); - MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12); - MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17); - MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22); - MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7); - MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); - MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); - MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); - MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); - MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); - MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); - MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); - - MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); - MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); - MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); - MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); - MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5); - MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); - MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); - MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); - MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); - MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); - MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); - MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20); - MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); - MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); - MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); - MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); - - MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); - MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); - MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); - MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); - MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4); - MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); - MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); - MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); - MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); - MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); - MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); - MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23); - MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); - MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); - MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); - MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); - - MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); - MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); - MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); - MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21); - MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); - MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); - MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); - MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21); - MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); - MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); - MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15); - MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); - MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6); - MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); - MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); - MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); - - buf[0] += a; - buf[1] += b; - buf[2] += c; - buf[3] += d; + register anubis_uint32_t a, b, c, d; + anubis_uint32_t in[16]; + + bytes_decode (in, (unsigned char *) cin, 64); + + a = buf[0]; + b = buf[1]; + c = buf[2]; + d = buf[3]; + + MD5STEP (F1, a, b, c, d, in[0] + 0xd76aa478, 7); + MD5STEP (F1, d, a, b, c, in[1] + 0xe8c7b756, 12); + MD5STEP (F1, c, d, a, b, in[2] + 0x242070db, 17); + MD5STEP (F1, b, c, d, a, in[3] + 0xc1bdceee, 22); + MD5STEP (F1, a, b, c, d, in[4] + 0xf57c0faf, 7); + MD5STEP (F1, d, a, b, c, in[5] + 0x4787c62a, 12); + MD5STEP (F1, c, d, a, b, in[6] + 0xa8304613, 17); + MD5STEP (F1, b, c, d, a, in[7] + 0xfd469501, 22); + MD5STEP (F1, a, b, c, d, in[8] + 0x698098d8, 7); + MD5STEP (F1, d, a, b, c, in[9] + 0x8b44f7af, 12); + MD5STEP (F1, c, d, a, b, in[10] + 0xffff5bb1, 17); + MD5STEP (F1, b, c, d, a, in[11] + 0x895cd7be, 22); + MD5STEP (F1, a, b, c, d, in[12] + 0x6b901122, 7); + MD5STEP (F1, d, a, b, c, in[13] + 0xfd987193, 12); + MD5STEP (F1, c, d, a, b, in[14] + 0xa679438e, 17); + MD5STEP (F1, b, c, d, a, in[15] + 0x49b40821, 22); + + MD5STEP (F2, a, b, c, d, in[1] + 0xf61e2562, 5); + MD5STEP (F2, d, a, b, c, in[6] + 0xc040b340, 9); + MD5STEP (F2, c, d, a, b, in[11] + 0x265e5a51, 14); + MD5STEP (F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); + MD5STEP (F2, a, b, c, d, in[5] + 0xd62f105d, 5); + MD5STEP (F2, d, a, b, c, in[10] + 0x02441453, 9); + MD5STEP (F2, c, d, a, b, in[15] + 0xd8a1e681, 14); + MD5STEP (F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); + MD5STEP (F2, a, b, c, d, in[9] + 0x21e1cde6, 5); + MD5STEP (F2, d, a, b, c, in[14] + 0xc33707d6, 9); + MD5STEP (F2, c, d, a, b, in[3] + 0xf4d50d87, 14); + MD5STEP (F2, b, c, d, a, in[8] + 0x455a14ed, 20); + MD5STEP (F2, a, b, c, d, in[13] + 0xa9e3e905, 5); + MD5STEP (F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); + MD5STEP (F2, c, d, a, b, in[7] + 0x676f02d9, 14); + MD5STEP (F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); + + MD5STEP (F3, a, b, c, d, in[5] + 0xfffa3942, 4); + MD5STEP (F3, d, a, b, c, in[8] + 0x8771f681, 11); + MD5STEP (F3, c, d, a, b, in[11] + 0x6d9d6122, 16); + MD5STEP (F3, b, c, d, a, in[14] + 0xfde5380c, 23); + MD5STEP (F3, a, b, c, d, in[1] + 0xa4beea44, 4); + MD5STEP (F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); + MD5STEP (F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); + MD5STEP (F3, b, c, d, a, in[10] + 0xbebfbc70, 23); + MD5STEP (F3, a, b, c, d, in[13] + 0x289b7ec6, 4); + MD5STEP (F3, d, a, b, c, in[0] + 0xeaa127fa, 11); + MD5STEP (F3, c, d, a, b, in[3] + 0xd4ef3085, 16); + MD5STEP (F3, b, c, d, a, in[6] + 0x04881d05, 23); + MD5STEP (F3, a, b, c, d, in[9] + 0xd9d4d039, 4); + MD5STEP (F3, d, a, b, c, in[12] + 0xe6db99e5, 11); + MD5STEP (F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); + MD5STEP (F3, b, c, d, a, in[2] + 0xc4ac5665, 23); + + MD5STEP (F4, a, b, c, d, in[0] + 0xf4292244, 6); + MD5STEP (F4, d, a, b, c, in[7] + 0x432aff97, 10); + MD5STEP (F4, c, d, a, b, in[14] + 0xab9423a7, 15); + MD5STEP (F4, b, c, d, a, in[5] + 0xfc93a039, 21); + MD5STEP (F4, a, b, c, d, in[12] + 0x655b59c3, 6); + MD5STEP (F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); + MD5STEP (F4, c, d, a, b, in[10] + 0xffeff47d, 15); + MD5STEP (F4, b, c, d, a, in[1] + 0x85845dd1, 21); + MD5STEP (F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); + MD5STEP (F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); + MD5STEP (F4, c, d, a, b, in[6] + 0xa3014314, 15); + MD5STEP (F4, b, c, d, a, in[13] + 0x4e0811a1, 21); + MD5STEP (F4, a, b, c, d, in[4] + 0xf7537e82, 6); + MD5STEP (F4, d, a, b, c, in[11] + 0xbd3af235, 10); + MD5STEP (F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); + MD5STEP (F4, b, c, d, a, in[9] + 0xeb86d391, 21); + + buf[0] += a; + buf[1] += b; + buf[2] += c; + buf[3] += d; } @@ -290,11 +304,11 @@ anubis_MD5Transform(anubis_uint32_t buf[4], anubis_uint32_t const cin[16]) int anubis_md5_file (unsigned char *digest, int fd) { - char buf[BLOCKSIZE + 72]; + unsigned char buf[BLOCKSIZE + 72]; int stop = 0; struct MD5Context context; - anubis_MD5Init(&context); + anubis_MD5Init (&context); while (!stop) { size_t len = 0; @@ -312,9 +326,9 @@ anubis_md5_file (unsigned char *digest, int fd) len += nread; } - anubis_MD5Update(&context, buf, len); + anubis_MD5Update (&context, buf, len); } - anubis_MD5Final(digest, &context); + anubis_MD5Final (digest, &context); return 0; } @@ -328,18 +342,18 @@ string_hex_to_bin (unsigned char *output, unsigned char *input, int inlen) { int i; unsigned char *p, *q; - + if (inlen % 2) return -1; - + inlen /= 2; p = input; q = output; for (i = 0; i < inlen; i++) { char *c1, *c2; - if (!(c1 = memchr(xlet, p[i << 1], sizeof xlet)) - || !(c2 = memchr(xlet, p[(i << 1) + 1], sizeof xlet))) + if (!(c1 = memchr (xlet, p[i << 1], sizeof xlet)) + || !(c2 = memchr (xlet, p[(i << 1) + 1], sizeof xlet))) return -2; q[i] = ((c1 - xlet) << 4) + (c2 - xlet); } @@ -354,7 +368,7 @@ void string_bin_to_hex (unsigned char *output, unsigned char *input, int inlen) { int i; - + for (i = 0; i < inlen; i++) { output[i << 1] = xlet[input[i] >> 4]; diff --git a/src/rcfile.y b/src/rc-gram.y index d215156..d215156 100644 --- a/src/rcfile.y +++ b/src/rc-gram.y diff --git a/src/rcfile.l b/src/rc-lex.l index 6e7de34..105451b 100644 --- a/src/rcfile.l +++ b/src/rc-lex.l @@ -28,7 +28,7 @@ #include "headers.h" #include "extern.h" #include "rcfile.h" -#include "rcfile-gram.h" +#include "rc-gram.h" struct string_list { |