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