Revert "Revert "and added files""
[bcm963xx.git] / userapps / opensource / net-snmp / testing / test_kul.sh
1 #!/bin/sh
2 #
3 # test_kul.sh
4 #
5 # Number of SUCCESSes:  2
6 #
7 # Run key localization tests and compare with data given in the USM
8 # documentation.
9 #
10 # FIX   CHECKEXACT() will produce 2 lines when SCAPI is built with
11 #       SNMP_TESTING_CODE, but only 1 line without the #define.  The script
12 #       assumes SNMP_TESTING_CODE is defined.
13 #
14 #
15
16
17 . eval_tools.sh
18
19 VERIFY ktest
20
21 STARTTEST
22
23
24 #------------------------------------ -o- 
25 # Declarations.
26 #
27 DATAFILE_PREFIX=data.kul-
28 DATAFILE_SUFFIXES="md5 sha1"
29
30 P=
31 Ku=
32 engineID=
33 kul=
34
35
36
37 #------------------------------------ -o- 
38 # Test.
39 #
40 for dfs in $DATAFILE_SUFFIXES; do
41         OUTPUT "== Test of key localization correctness with transform \"$dfs\"."
42
43         set x `awk '{ print $1 }' ${DATAFILE_PREFIX}$dfs`
44         shift
45
46         [ $# -lt 4 ] && FAILED 1 \
47             "Wrong number of lines ($#) in datafile \"$DATAFILE_PREFIX}$dfs\"."
48
49         P=$1
50         Ku=$2
51         engineID=$3
52         kul=$4
53
54         CAPTURE "ktest -l -P $P -E $engineID "
55         FAILED $? "ktest"
56
57         CHECKEXACT $Ku
58         [ $? -eq 2 ]
59         FAILED $? "Master key was not generated."
60
61         CHECKEXACT $kul
62         [ $? -eq 2 ]
63         FAILED $? "Localized key was not generated."
64
65
66         SUCCESS "Key localization correctness test with transform \"$dfs\"."
67 done
68
69
70
71
72 #------------------------------------ -o- 
73 # Cleanup, exit.
74 #
75 STOPTEST
76
77 exit $failcount
78