tests.com 6.9 KB

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