crypto.sh 3.9 KB

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