tests.com 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. $! TESTS.COM -- Performs the necessary tests
  2. $!
  3. $! P1 tests to be performed. Empty means all.
  4. $
  5. $ __proc = f$element(0,";",f$environment("procedure"))
  6. $ __here = f$parse(f$parse("A.;",__proc) - "A.;","[]A.;") - "A.;"
  7. $ __save_default = f$environment("default")
  8. $ __arch := VAX
  9. $ if f$getsyi("cpu") .ge. 128 then __arch := AXP
  10. $ texe_dir := sys$disk:[-.'__arch'.exe.test]
  11. $ exe_dir := sys$disk:[-.'__arch'.exe.apps]
  12. $
  13. $ set default '__here'
  14. $ on control_y then goto exit
  15. $ on error then goto exit
  16. $
  17. $ if p1 .nes. ""
  18. $ then
  19. $ tests = p1
  20. $ else
  21. $ tests := -
  22. test_des,test_idea,test_sha,test_md4,test_md5,test_hmac,-
  23. test_md2,test_mdc2,-
  24. test_rmd,test_rc2,test_rc4,test_rc5,test_bf,test_cast,test_rd,-
  25. test_rand,test_bn,test_ec,test_enc,test_x509,test_rsa,test_crl,test_sid,-
  26. test_gen,test_req,test_pkcs7,test_verify,test_dh,test_dsa,-
  27. test_ss,test_ca,test_engine,test_ssl,test_evp
  28. $ endif
  29. $ tests = f$edit(tests,"COLLAPSE")
  30. $
  31. $ BNTEST := bntest
  32. $ ECTEST := ectest
  33. $ EXPTEST := exptest
  34. $ IDEATEST := ideatest
  35. $ SHATEST := shatest
  36. $ SHA1TEST := sha1test
  37. $ MDC2TEST := mdc2test
  38. $ RMDTEST := rmdtest
  39. $ MD2TEST := md2test
  40. $ MD4TEST := md4test
  41. $ MD5TEST := md5test
  42. $ HMACTEST := hmactest
  43. $ RC2TEST := rc2test
  44. $ RC4TEST := rc4test
  45. $ RC5TEST := rc5test
  46. $ BFTEST := bftest
  47. $ CASTTEST := casttest
  48. $ DESTEST := destest
  49. $ RANDTEST := randtest
  50. $ DHTEST := dhtest
  51. $ DSATEST := dsatest
  52. $ METHTEST := methtest
  53. $ SSLTEST := ssltest
  54. $ RSATEST := rsa_test
  55. $ ENGINETEST := enginetest
  56. $ EVPTEST := evp_test
  57. $
  58. $ tests_i = 0
  59. $ loop_tests:
  60. $ tests_e = f$element(tests_i,",",tests)
  61. $ tests_i = tests_i + 1
  62. $ if tests_e .eqs. "," then goto exit
  63. $ gosub 'tests_e'
  64. $ goto loop_tests
  65. $
  66. $ test_evp:
  67. $ mcr 'texe_dir''evptest' evptests.txt
  68. $ return
  69. $ test_des:
  70. $ mcr 'texe_dir''destest'
  71. $ return
  72. $ test_idea:
  73. $ mcr 'texe_dir''ideatest'
  74. $ return
  75. $ test_sha:
  76. $ mcr 'texe_dir''shatest'
  77. $ mcr 'texe_dir''sha1test'
  78. $ return
  79. $ test_mdc2:
  80. $ mcr 'texe_dir''mdc2test'
  81. $ return
  82. $ test_md5:
  83. $ mcr 'texe_dir''md5test'
  84. $ return
  85. $ test_md4:
  86. $ mcr 'texe_dir''md4test'
  87. $ return
  88. $ test_hmac:
  89. $ mcr 'texe_dir''hmactest'
  90. $ return
  91. $ test_md2:
  92. $ mcr 'texe_dir''md2test'
  93. $ return
  94. $ test_rmd:
  95. $ mcr 'texe_dir''rmdtest'
  96. $ return
  97. $ test_bf:
  98. $ mcr 'texe_dir''bftest'
  99. $ return
  100. $ test_cast:
  101. $ mcr 'texe_dir''casttest'
  102. $ return
  103. $ test_rc2:
  104. $ mcr 'texe_dir''rc2test'
  105. $ return
  106. $ test_rc4:
  107. $ mcr 'texe_dir''rc4test'
  108. $ return
  109. $ test_rc5:
  110. $ mcr 'texe_dir''rc5test'
  111. $ return
  112. $ test_rand:
  113. $ mcr 'texe_dir''randtest'
  114. $ return
  115. $ test_enc:
  116. $ @testenc.com
  117. $ return
  118. $ test_x509:
  119. $ define sys$error nla0:
  120. $ write sys$output "test normal x509v1 certificate"
  121. $ @tx509.com
  122. $ write sys$output "test first x509v3 certificate"
  123. $ @tx509.com v3-cert1.pem
  124. $ write sys$output "test second x509v3 certificate"
  125. $ @tx509.com v3-cert2.pem
  126. $ deassign sys$error
  127. $ return
  128. $ test_rsa:
  129. $ define sys$error nla0:
  130. $ @trsa.com
  131. $ deassign sys$error
  132. $ mcr 'texe_dir''rsatest'
  133. $ return
  134. $ test_crl:
  135. $ define sys$error nla0:
  136. $ @tcrl.com
  137. $ deassign sys$error
  138. $ return
  139. $ test_sid:
  140. $ define sys$error nla0:
  141. $ @tsid.com
  142. $ deassign sys$error
  143. $ return
  144. $ test_req:
  145. $ define sys$error nla0:
  146. $ @treq.com
  147. $ @treq.com testreq2.pem
  148. $ deassign sys$error
  149. $ return
  150. $ test_pkcs7:
  151. $ define sys$error nla0:
  152. $ @tpkcs7.com
  153. $ @tpkcs7d.com
  154. $ deassign sys$error
  155. $ return
  156. $ test_bn:
  157. $ write sys$output "starting big number library test, could take a while..."
  158. $ create bntest-vms.fdl
  159. FILE
  160. ORGANIZATION sequential
  161. RECORD
  162. FORMAT stream_lf
  163. $ create/fdl=bntest-vms.fdl bntest-vms.sh
  164. $ open/append foo bntest-vms.sh
  165. $ type/output=foo: sys$input:
  166. << __FOO__ sh -c "`sh ./bctest`" | perl -e '$i=0; while (<STDIN>) {if (/^test (.*)/) {print STDERR "\nverify $1";} elsif (!/^0$/) {die "\nFailed! bc: $_";} else {print STDERR "."; $i++;}} print STDERR "\n$i tests passed\n"'
  167. $ define/user sys$output bntest-vms.tmp
  168. $ mcr 'texe_dir''bntest'
  169. $ copy bntest-vms.tmp foo:
  170. $ delete bntest-vms.tmp;*
  171. $ type/output=foo: sys$input:
  172. __FOO__
  173. $ close foo
  174. $ write sys$output "-- copy the [.test]bntest-vms.sh and [.test]bctest files to a Unix system and"
  175. $ write sys$output "-- run bntest-vms.sh through sh or bash to verify that the bignum operations"
  176. $ write sys$output "-- went well."
  177. $ write sys$output ""
  178. $ write sys$output "test a^b%c implementations"
  179. $ mcr 'texe_dir''exptest'
  180. $ return
  181. $ test_ec:
  182. $ write sys$output "test elliptic curves"
  183. $ mcr 'texe_dir''ectest'
  184. $ return
  185. $ test_verify:
  186. $ write sys$output "The following command should have some OK's and some failures"
  187. $ write sys$output "There are definitly a few expired certificates"
  188. $ @tverify.com
  189. $ return
  190. $ test_dh:
  191. $ write sys$output "Generate a set of DH parameters"
  192. $ mcr 'texe_dir''dhtest'
  193. $ return
  194. $ test_dsa:
  195. $ write sys$output "Generate a set of DSA parameters"
  196. $ mcr 'texe_dir''dsatest'
  197. $ return
  198. $ test_gen:
  199. $ write sys$output "Generate and verify a certificate request"
  200. $ @testgen.com
  201. $ return
  202. $ maybe_test_ss:
  203. $ testss_RDT = f$cvtime(f$file_attributes("testss.com","RDT"))
  204. $ if f$cvtime(f$file_attributes("keyU.ss","RDT")) .les. testss_RDT then -
  205. goto test_ss
  206. $ if f$cvtime(f$file_attributes("certU.ss","RDT")) .les. testss_RDT then -
  207. goto test_ss
  208. $ if f$cvtime(f$file_attributes("certCA.ss","RDT")) .les. testss_RDT then -
  209. goto test_ss
  210. $ return
  211. $ test_ss:
  212. $ write sys$output "Generate and certify a test certificate"
  213. $ @testss.com
  214. $ return
  215. $ test_engine:
  216. $ write sys$output "Manipulate the ENGINE structures"
  217. $ mcr 'texe_dir''enginetest'
  218. $ return
  219. $ test_ssl:
  220. $ write sys$output "test SSL protocol"
  221. $ gosub maybe_test_ss
  222. $ @testssl.com keyU.ss certU.ss certCA.ss
  223. $ return
  224. $ test_ca:
  225. $ set noon
  226. $ define/user sys$output nla0:
  227. $ mcr 'exe_dir'openssl no-rsa
  228. $ save_severity=$SEVERITY
  229. $ set on
  230. $ if save_severity
  231. $ then
  232. $ write sys$output "skipping CA.com test -- requires RSA"
  233. $ else
  234. $ write sys$output "Generate and certify a test certificate via the 'ca' program"
  235. $ @testca.com
  236. $ endif
  237. $ return
  238. $ test_rd:
  239. $ write sys$output "test Rijndael"
  240. $ !mcr 'texe_dir''rdtest'
  241. $ return
  242. $
  243. $
  244. $ exit:
  245. $ set default '__save_default'
  246. $ exit