source: branches/samhain-2_2-branch/test/testhash.sh@ 87

Last change on this file since 87 was 27, checked in by rainer, 19 years ago

Support for server-to-server relay and more user policies

File size: 2.9 KB
Line 
1#! /bin/sh
2
3#
4# Copyright Rainer Wichmann (2006)
5#
6# License Information:
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, write to the Free Software
19# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20#
21
22RCFILE="$PW_DIR/testrc_1.dyn"; export RCFILE
23LOGFILE="$PW_DIR/.samhain_log"; export LOGFILE
24
25MAXTEST=1; export MAXTEST
26
27testhash ()
28{
29 log_start "HASH FUNCTION"
30 #
31 # test standalone compilation
32 #
33 TEST="${S}standalone agent${E}"
34 #
35 if test -r "Makefile"; then
36 $MAKE distclean
37 fi
38 #
39 ${TOP_SRCDIR}/configure --quiet $TRUST --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$RCFILE --with-log-file=$LOGFILE --with-pid-file=$PW_DIR/.samhain_lock --with-data-file=$PW_DIR/.samhain_file --enable-debug
40 #
41 fail=0
42 #
43 if test x$? = x0; then
44 [ -z "$verbose" ] || log_msg_ok "configure...";
45 $MAKE > /dev/null 2>> test_log
46 if test x$? = x0; then
47 [ -z "$verbose" ] || log_msg_ok "make...";
48 else
49 [ -z "$quiet" ] && log_msg_fail "make...";
50 fail=1
51 fi
52 else
53 [ -z "$quiet" ] && log_msg_fail "configure...";
54 fail=1
55 fi
56 #
57 if [ $fail -eq 1 ]; then
58 [ -z "$quiet" ] && log_fail 1 ${MAXTEST};
59 return 1
60 fi
61 #
62 echo "Test results of the TIGER hash algorithm" > testhash.tmp
63 echo >> testhash.tmp
64 echo "(use samhain -H string to test)" >> testhash.tmp
65 echo >> testhash.tmp
66 ./samhain -H "" >> testhash.tmp
67 ./samhain -H "abc" >> testhash.tmp
68 ./samhain -H "Tiger" >> testhash.tmp
69 ./samhain -H "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-" >> testhash.tmp
70 ./samhain -H "ABCDEFGHIJKLMNOPQRSTUVWXYZ=abcdefghijklmnopqrstuvwxyz+0123456789" >> testhash.tmp
71 ./samhain -H "Tiger - A Fast New Hash Function, by Ross Anderson and Eli Biham" >> testhash.tmp
72 ./samhain -H "Tiger - A Fast New Hash Function, by Ross Anderson and Eli Biham, proceedings of Fast Software Encryption 3, Cambridge." >> testhash.tmp
73 ./samhain -H "Tiger - A Fast New Hash Function, by Ross Anderson and Eli Biham, proceedings of Fast Software Encryption 3, Cambridge, 1996." >> testhash.tmp
74 ./samhain -H "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-" >> testhash.tmp
75 #
76 RESU=`diff testhash.tmp ${SCRIPTDIR}/testtiger.txt 2>/dev/null`
77 if test "x${RESU}" = "x"; then
78 [ -z "$quiet" ] && log_ok 1 ${MAXTEST};
79 else
80 [ -z "$quiet" ] && log_fail 1 ${MAXTEST};
81 return 1
82 fi
83 log_end "HASH FUNCTION"
84 return 0
85}
86
87
88
Note: See TracBrowser for help on using the repository browser.