tests.com 9.2 KB

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