tests.com 8.4 KB

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