2
0

tests.com 6.1 KB

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