]> The Tcpdump Group git mirrors - tcpdump/blob - tests/crypto.sh
VRRP: Add a test capture file
[tcpdump] / tests / crypto.sh
1 #!/bin/sh
2
3 #
4 # Get the tests directory from $0.
5 #
6 testsdir=`dirname "$0"`
7
8 exitcode=0
9 passed=`cat .passed`
10 failed=`cat .failed`
11
12 # Only attempt OpenSSL-specific tests when compiled with the library.
13
14 if grep '^#define HAVE_LIBCRYPTO 1$' ../config.h >/dev/null
15 then
16 if ${testsdir}/TESTonce esp1 ${testsdir}/02-sunrise-sunset-esp.pcap ${testsdir}/esp1.out '-E "0x12345678@192.1.2.45 3des-cbc-hmac96:0x4043434545464649494a4a4c4c4f4f515152525454575758"'
17 then
18 passed=`expr $passed + 1`
19 echo $passed >.passed
20 else
21 failed=`expr $failed + 1`
22 echo $failed >.failed
23 exitcode=1
24 fi
25 if ${testsdir}/TESTonce esp2 ${testsdir}/08-sunrise-sunset-esp2.pcap ${testsdir}/esp2.out '-E "0x12345678@192.1.2.45 3des-cbc-hmac96:0x43434545464649494a4a4c4c4f4f51515252545457575840,0xabcdabcd@192.0.1.1 3des-cbc-hmac96:0x434545464649494a4a4c4c4f4f5151525254545757584043"'
26 then
27 passed=`expr $passed + 1`
28 echo $passed >.passed
29 else
30 failed=`expr $failed + 1`
31 echo $failed >.failed
32 exitcode=1
33 fi
34 if ${testsdir}/TESTonce esp3 ${testsdir}/02-sunrise-sunset-esp.pcap ${testsdir}/esp1.out '-E "3des-cbc-hmac96:0x4043434545464649494a4a4c4c4f4f515152525454575758"'
35 then
36 passed=`expr $passed + 1`
37 echo $passed >.passed
38 else
39 failed=`expr $failed + 1`
40 echo $failed >.failed
41 exitcode=1
42 fi
43 # Reading the secret(s) from a file does not work with Capsicum.
44 if grep '^#define HAVE_CAPSICUM 1$' ../config.h >/dev/null
45 then
46 FORMAT=' %-35s: TEST SKIPPED (compiled w/Capsicum)\n'
47 printf "$FORMAT" esp4
48 printf "$FORMAT" esp5
49 printf "$FORMAT" espudp1
50 printf "$FORMAT" ikev2pI2
51 printf "$FORMAT" isakmp4
52 else
53 if ${testsdir}/TESTonce esp4 ${testsdir}/08-sunrise-sunset-esp2.pcap ${testsdir}/esp2.out "-E \"file ${testsdir}/esp-secrets.txt\""
54 then
55 passed=`expr $passed + 1`
56 echo $passed >.passed
57 else
58 failed=`expr $failed + 1`
59 echo $failed >.failed
60 exitcode=1
61 fi
62 if ${testsdir}/TESTonce esp5 ${testsdir}/08-sunrise-sunset-aes.pcap ${testsdir}/esp5.out "-E \"file ${testsdir}/esp-secrets.txt\""
63 then
64 passed=`expr $passed + 1`
65 echo $passed >.passed
66 else
67 failed=`expr $failed + 1`
68 echo $failed >.failed
69 exitcode=1
70 fi
71 if ${testsdir}/TESTonce espudp1 ${testsdir}/espudp1.pcap ${testsdir}/espudp1.out "-nnnn -E \"file ${testsdir}/esp-secrets.txt\""
72 then
73 passed=`expr $passed + 1`
74 echo $passed >.passed
75 else
76 failed=`expr $failed + 1`
77 echo $failed >.failed
78 exitcode=1
79 fi
80 if ${testsdir}/TESTonce ikev2pI2 ${testsdir}/ikev2pI2.pcap ${testsdir}/ikev2pI2.out "-E \"file ${testsdir}/ikev2pI2-secrets.txt\" -v -v -v -v"
81 then
82 passed=`expr $passed + 1`
83 echo $passed >.passed
84 else
85 failed=`expr $failed + 1`
86 echo $failed >.failed
87 exitcode=1
88 fi
89 if ${testsdir}/TESTonce isakmp4 ${testsdir}/isakmp4500.pcap ${testsdir}/isakmp4.out "-E \"file ${testsdir}/esp-secrets.txt\""
90 then
91 passed=`expr $passed + 1`
92 echo $passed >.passed
93 else
94 failed=`expr $failed + 1`
95 echo $failed >.failed
96 exitcode=1
97 fi
98 fi
99 if ${testsdir}/TESTonce bgp-as-path-oobr-ssl ${testsdir}/bgp-as-path-oobr.pcap ${testsdir}/bgp-as-path-oobr-ssl.out '-vvv -e'
100 then
101 passed=`expr $passed + 1`
102 echo $passed >.passed
103 else
104 failed=`expr $failed + 1`
105 echo $failed >.failed
106 exitcode=1
107 fi
108 if ${testsdir}/TESTonce bgp-aigp-oobr-ssl ${testsdir}/bgp-aigp-oobr.pcap ${testsdir}/bgp-aigp-oobr-ssl.out '-vvv -e'
109 then
110 passed=`expr $passed + 1`
111 echo $passed >.passed
112 else
113 failed=`expr $failed + 1`
114 echo $failed >.failed
115 exitcode=1
116 fi
117 FORMAT=' %-35s: TEST SKIPPED (compiled w/OpenSSL)\n'
118 printf "$FORMAT" bgp-as-path-oobr-nossl
119 printf "$FORMAT" bgp-aigp-oobr-nossl
120 else
121 FORMAT=' %-35s: TEST SKIPPED (compiled w/o OpenSSL)\n'
122 printf "$FORMAT" esp1
123 printf "$FORMAT" esp2
124 printf "$FORMAT" esp3
125 printf "$FORMAT" esp4
126 printf "$FORMAT" esp5
127 printf "$FORMAT" espudp1
128 printf "$FORMAT" ikev2pI2
129 printf "$FORMAT" isakmp4
130 printf "$FORMAT" bgp-as-path-oobr-ssl
131 printf "$FORMAT" bgp-aigp-oobr-ssl
132 if ${testsdir}/TESTonce bgp-as-path-oobr-nossl ${testsdir}/bgp-as-path-oobr.pcap ${testsdir}/bgp-as-path-oobr-nossl.out '-vvv -e'
133 then
134 passed=`expr $passed + 1`
135 echo $passed >.passed
136 else
137 failed=`expr $failed + 1`
138 echo $failed >.failed
139 exitcode=1
140 fi
141 if ${testsdir}/TESTonce bgp-aigp-oobr-nossl ${testsdir}/bgp-aigp-oobr.pcap ${testsdir}/bgp-aigp-oobr-nossl.out '-vvv -e'
142 then
143 passed=`expr $passed + 1`
144 echo $passed >.passed
145 else
146 failed=`expr $failed + 1`
147 echo $failed >.failed
148 exitcode=1
149 fi
150 fi
151
152 exit $exitcode