tests.com 11 KB

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