tests.com 6.4 KB

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