summaryrefslogtreecommitdiff
path: root/testing/test_kul.sh
blob: 70b7b768735200169fdffe9d707b7154678befdb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/sh
#
# test_kul.sh
#
# Number of SUCCESSes:	2
#
# Run key localization tests and compare with data given in the USM
# documentation.
#
# FIX	CHECKEXACT() will produce 2 lines when SCAPI is built with
#	SNMP_TESTING_CODE, but only 1 line without the #define.  The script
#	assumes SNMP_TESTING_CODE is defined.
#
#


. eval_tools.sh

VERIFY ktest

STARTTEST


#------------------------------------ -o- 
# Declarations.
#
DATAFILE_PREFIX=data.kul-
DATAFILE_SUFFIXES="md5 sha1"

P=
Ku=
engineID=
kul=



#------------------------------------ -o- 
# Test.
#
for dfs in $DATAFILE_SUFFIXES; do
	OUTPUT "== Test of key localization correctness with transform \"$dfs\"."

	set x `awk '{ print $1 }' ${DATAFILE_PREFIX}$dfs`
	shift

	[ $# -lt 4 ] && FAILED 1 \
	    "Wrong number of lines ($#) in datafile \"$DATAFILE_PREFIX}$dfs\"."

	P=$1
	Ku=$2
	engineID=$3
	kul=$4

	CAPTURE "ktest -l -P $P -E $engineID "
	FAILED $? "ktest"

	CHECKEXACT $Ku
	[ $? -eq 2 ]
	FAILED $? "Master key was not generated."

	CHECKEXACT $kul
	[ $? -eq 2 ]
	FAILED $? "Localized key was not generated."


	SUCCESS "Key localization correctness test with transform \"$dfs\"."
done




#------------------------------------ -o- 
# Cleanup, exit.
#
STOPTEST

exit $failcount