tests.com 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  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_evp_extra,test_ssl,test_tsa,test_ige,-
  59. test_jpake,test_srp,test_cms,test_ocsp,test_v3name,test_heartbeat,-
  60. test_constant_time,test_verify_extra,test_clienthello,test_sslv2conftest,test_dtls
  61. $ endif
  62. $ tests = f$edit(tests,"COLLAPSE")
  63. $
  64. $ BNTEST := bntest
  65. $ ECTEST := ectest
  66. $ ECDSATEST := ecdsatest
  67. $ ECDHTEST := ecdhtest
  68. $ EXPTEST := exptest
  69. $ IDEATEST := ideatest
  70. $ SHATEST := shatest
  71. $ SHA1TEST := sha1test
  72. $ SHA256TEST := sha256t
  73. $ SHA512TEST := sha512t
  74. $ MDC2TEST := mdc2test
  75. $ RMDTEST := rmdtest
  76. $ MD2TEST := md2test
  77. $ MD4TEST := md4test
  78. $ MD5TEST := md5test
  79. $ HMACTEST := hmactest
  80. $ WPTEST := wp_test
  81. $ RC2TEST := rc2test
  82. $ RC4TEST := rc4test
  83. $ RC5TEST := rc5test
  84. $ BFTEST := bftest
  85. $ CASTTEST := casttest
  86. $ DESTEST := destest
  87. $ RANDTEST := randtest
  88. $ DHTEST := dhtest
  89. $ DSATEST := dsatest
  90. $ METHTEST := methtest
  91. $ SSLTEST := ssltest
  92. $ RSATEST := rsa_test
  93. $ ENGINETEST := enginetest
  94. $ EVPTEST := evp_test
  95. $ EVPEXTRATEST := evp_extra_test
  96. $ IGETEST := igetest
  97. $ JPAKETEST := jpaketest
  98. $ SRPTEST := srptest
  99. $ V3NAMETEST := v3nametest
  100. $ ASN1TEST := asn1test
  101. $ HEARTBEATTEST := heartbeat_test
  102. $ CONSTTIMETEST := constant_time_test
  103. $ VERIFYEXTRATEST := verify_extra_test
  104. $ CLIENTHELLOTEST := clienthellotest
  105. $ SSLV2CONFTEST := sslv2conftest
  106. $ DTLSTEST := dtlstest
  107. $!
  108. $ tests_i = 0
  109. $ loop_tests:
  110. $ tests_e = f$element(tests_i,",",tests)
  111. $ tests_i = tests_i + 1
  112. $ if tests_e .eqs. "," then goto exit
  113. $ write sys$output "---> ''tests_e'"
  114. $ gosub 'tests_e'
  115. $ goto loop_tests
  116. $
  117. $ test_evp:
  118. $ mcr 'texe_dir''evptest' 'ROOT'.CRYPTO.EVP]evptests.txt
  119. $ return
  120. $ test_evp_extra:
  121. $ mcr 'texe_dir''evpextratest'
  122. $ return
  123. $ test_des:
  124. $ mcr 'texe_dir''destest'
  125. $ return
  126. $ test_idea:
  127. $ mcr 'texe_dir''ideatest'
  128. $ return
  129. $ test_sha:
  130. $ mcr 'texe_dir''shatest'
  131. $ mcr 'texe_dir''sha1test'
  132. $ mcr 'texe_dir''sha256test'
  133. $ mcr 'texe_dir''sha512test'
  134. $ return
  135. $ test_mdc2:
  136. $ mcr 'texe_dir''mdc2test'
  137. $ return
  138. $ test_md5:
  139. $ mcr 'texe_dir''md5test'
  140. $ return
  141. $ test_md4:
  142. $ mcr 'texe_dir''md4test'
  143. $ return
  144. $ test_hmac:
  145. $ mcr 'texe_dir''hmactest'
  146. $ return
  147. $ test_wp:
  148. $ mcr 'texe_dir''wptest'
  149. $ return
  150. $ test_md2:
  151. $ mcr 'texe_dir''md2test'
  152. $ return
  153. $ test_rmd:
  154. $ mcr 'texe_dir''rmdtest'
  155. $ return
  156. $ test_bf:
  157. $ mcr 'texe_dir''bftest'
  158. $ return
  159. $ test_cast:
  160. $ mcr 'texe_dir''casttest'
  161. $ return
  162. $ test_rc2:
  163. $ mcr 'texe_dir''rc2test'
  164. $ return
  165. $ test_rc4:
  166. $ mcr 'texe_dir''rc4test'
  167. $ return
  168. $ test_rc5:
  169. $ mcr 'texe_dir''rc5test'
  170. $ return
  171. $ test_rand:
  172. $ mcr 'texe_dir''randtest'
  173. $ return
  174. $ test_enc:
  175. $ @testenc.com 'pointer_size'
  176. $ return
  177. $ test_x509:
  178. $ set noon
  179. $ define sys$error test_x509.err
  180. $ write sys$output "test normal x509v1 certificate"
  181. $ @tx509.com "" 'pointer_size'
  182. $ write sys$output "test first x509v3 certificate"
  183. $ @tx509.com v3-cert1.pem 'pointer_size'
  184. $ write sys$output "test second x509v3 certificate"
  185. $ @tx509.com v3-cert2.pem 'pointer_size'
  186. $ deassign sys$error
  187. $ set on
  188. $ return
  189. $ test_rsa:
  190. $ set noon
  191. $ define sys$error test_rsa.err
  192. $ @trsa.com "" 'pointer_size'
  193. $ deassign sys$error
  194. $ mcr 'texe_dir''rsatest'
  195. $ set on
  196. $ return
  197. $ test_crl:
  198. $ set noon
  199. $ define sys$error test_crl.err
  200. $ @tcrl.com "" 'pointer_size'
  201. $ deassign sys$error
  202. $ set on
  203. $ return
  204. $ test_sid:
  205. $ set noon
  206. $ define sys$error test_sid.err
  207. $ @tsid.com "" 'pointer_size'
  208. $ deassign sys$error
  209. $ set on
  210. $ return
  211. $ test_req:
  212. $ set noon
  213. $ define sys$error test_req.err
  214. $ @treq.com "" 'pointer_size'
  215. $ @treq.com testreq2.pem 'pointer_size'
  216. $ deassign sys$error
  217. $ set on
  218. $ return
  219. $ test_pkcs7:
  220. $ set noon
  221. $ define sys$error test_pkcs7.err
  222. $ @tpkcs7.com "" 'pointer_size'
  223. $ @tpkcs7d.com "" 'pointer_size'
  224. $ deassign sys$error
  225. $ set on
  226. $ return
  227. $ test_bn:
  228. $ write sys$output -
  229. "starting big number library test, could take a while..."
  230. $ set noon
  231. $ define sys$error test_bn.err
  232. $ define sys$output test_bn.out
  233. $ @ bctest.com
  234. $ status = $status
  235. $ deassign sys$error
  236. $ deassign sys$output
  237. $ set on
  238. $ if (status)
  239. $ then
  240. $ create /fdl = sys$input bntest-vms.tmp
  241. FILE
  242. ORGANIZATION sequential
  243. RECORD
  244. FORMAT stream_lf
  245. $ define /user_mode sys$output bntest-vms.tmp
  246. $ mcr 'texe_dir''bntest'
  247. $ define /user_mode sys$input bntest-vms.tmp
  248. $ define /user_mode sys$output bntest-vms.out
  249. $ bc
  250. $ @ bntest.com bntest-vms.out
  251. $ status = $status
  252. $ if (status)
  253. $ then
  254. $ delete bntest-vms.out;*
  255. $ delete bntest-vms.tmp;*
  256. $ endif
  257. $ else
  258. $ create /fdl = sys$input bntest-vms.sh
  259. FILE
  260. ORGANIZATION sequential
  261. RECORD
  262. FORMAT stream_lf
  263. $ open /append bntest_file bntest-vms.sh
  264. $ type /output = bntest_file sys$input:
  265. << __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"'
  266. $ define /user_mode sys$output bntest-vms.tmp
  267. $ mcr 'texe_dir''bntest'
  268. $ copy bntest-vms.tmp bntest_file
  269. $ delete bntest-vms.tmp;*
  270. $ type /output = bntest_file sys$input:
  271. __FOO__
  272. $ close bntest_file
  273. $ write sys$output "-- copy the [.test]bntest-vms.sh and [.test]bctest files to a Unix system and"
  274. $ write sys$output "-- run bntest-vms.sh through sh or bash to verify that the bignum operations"
  275. $ write sys$output "-- went well."
  276. $ write sys$output ""
  277. $ endif
  278. $ write sys$output "test a^b%c implementations"
  279. $ mcr 'texe_dir''exptest'
  280. $ return
  281. $ test_ec:
  282. $ write sys$output "test elliptic curves"
  283. $ mcr 'texe_dir''ectest'
  284. $ return
  285. $ test_ecdsa:
  286. $ write sys$output "test ecdsa"
  287. $ mcr 'texe_dir''ecdsatest'
  288. $ return
  289. $ test_ecdh:
  290. $ write sys$output "test ecdh"
  291. $ mcr 'texe_dir''ecdhtest'
  292. $ return
  293. $ test_verify:
  294. $ write sys$output "The following command should have some OK's and some failures"
  295. $ write sys$output "There are definitly a few expired certificates"
  296. $ @tverify.com 'pointer_size'
  297. $ return
  298. $ test_dh:
  299. $ write sys$output "Generate a set of DH parameters"
  300. $ mcr 'texe_dir''dhtest'
  301. $ return
  302. $ test_dsa:
  303. $ write sys$output "Generate a set of DSA parameters"
  304. $ mcr 'texe_dir''dsatest'
  305. $ return
  306. $ test_gen:
  307. $ write sys$output "Generate and verify a certificate request"
  308. $ @testgen.com 'pointer_size'
  309. $ return
  310. $ maybe_test_ss:
  311. $ testss_RDT = f$cvtime(f$file_attributes("testss.com","RDT"))
  312. $ if f$cvtime(f$file_attributes("keyU.ss","RDT")) .les. testss_RDT then -
  313. goto test_ss
  314. $ if f$cvtime(f$file_attributes("certU.ss","RDT")) .les. testss_RDT then -
  315. goto test_ss
  316. $ if f$cvtime(f$file_attributes("certCA.ss","RDT")) .les. testss_RDT then -
  317. goto test_ss
  318. $ return
  319. $ test_ss:
  320. $ write sys$output "Generate and certify a test certificate"
  321. $ @testss.com 'pointer_size'
  322. $ return
  323. $ test_engine:
  324. $ write sys$output "Manipulate the ENGINE structures"
  325. $ mcr 'texe_dir''enginetest'
  326. $ return
  327. $ test_ssl:
  328. $ write sys$output "test SSL protocol"
  329. $ gosub maybe_test_ss
  330. $ @testssl.com keyU.ss certU.ss certCA.ss 'pointer_size'
  331. $ return
  332. $ test_ca:
  333. $ set noon
  334. $ define /user_mode sys$output test_ca.out
  335. $ mcr 'exe_dir'openssl no-rsa
  336. $ save_severity=$SEVERITY
  337. $ set on
  338. $ if save_severity
  339. $ then
  340. $ write sys$output "skipping CA.com test -- requires RSA"
  341. $ else
  342. $ write sys$output "Generate and certify a test certificate via the 'ca' program"
  343. $ @testca.com 'pointer_size'
  344. $ endif
  345. $ return
  346. $ test_aes:
  347. $! write sys$output "test AES"
  348. $! !mcr 'texe_dir''aestest'
  349. $ return
  350. $ test_tsa:
  351. $ set noon
  352. $ define /user_mode sys$output nla0:
  353. $ mcr 'exe_dir'openssl no-rsa
  354. $ save_severity=$SEVERITY
  355. $ set on
  356. $ if save_severity
  357. $ then
  358. $ write sys$output "skipping testtsa.com test -- requires RSA"
  359. $ else
  360. $ @testtsa.com "" "" "" 'pointer_size'
  361. $ endif
  362. $ return
  363. $ test_ige:
  364. $ write sys$output "Test IGE mode"
  365. $ mcr 'texe_dir''igetest'
  366. $ return
  367. $ test_jpake:
  368. $ write sys$output "Test JPAKE"
  369. $ mcr 'texe_dir''jpaketest'
  370. $ return
  371. $ test_cms:
  372. $ write sys$output "CMS consistency test"
  373. $ ! Define the logical name used to find openssl.exe in the perl script.
  374. $ define /user_mode osslx 'exe_dir'
  375. $ perl CMS-TEST.PL
  376. $ return
  377. $ test_srp:
  378. $ write sys$output "Test SRP"
  379. $ mcr 'texe_dir''srptest'
  380. $ return
  381. $ test_ocsp:
  382. $ write sys$output "Test OCSP"
  383. $ @tocsp.com
  384. $ return
  385. $ test_v3name:
  386. $ write sys$output "Test V3NAME"
  387. $ mcr 'texe_dir''v3nametest'
  388. $ return
  389. $ test_heartbeat:
  390. $ write sys$output "Test HEARTBEAT"
  391. $ mcr 'texe_dir''heartbeattest'
  392. $ return
  393. $ test_constant_time:
  394. $ write sys$output "Test constant time utilities"
  395. $ mcr 'texe_dir''consttimetest'
  396. $ return
  397. $ test_verify_extra:
  398. $ write sys$output "''START' test_verify_extra"
  399. $ mcr 'texe_dir''verifyextratest'
  400. $ return
  401. $ test_clienthello:
  402. $ write sys$output "''START' test_clienthello"
  403. $ mcr 'texe_dir''clienthellotest'
  404. $ return
  405. $ test_sslv2conftest:
  406. $ write sys$output "''START' test_sslv2conftest"
  407. $ mcr 'texe_dir''sslv2conftest'
  408. $ return
  409. $ test_dtls:
  410. $ write sys$output "''START' test_dtls"
  411. $ mcr 'texe_dir''dtlstest' 'ROOT'.APPS]server.pem 'ROOT'.APPS]server.pem
  412. $ return
  413. $
  414. $ exit:
  415. $ on error then goto exit2 ! In case openssl.exe didn't build.
  416. $ mcr 'exe_dir'openssl version -a
  417. $ exit2:
  418. $ set default '__save_default'
  419. $ deassign sslroot
  420. $ exit