blob: 07a3c7f16dfc6b10ed457b891d6d6368603ec67a [file] [log] [blame]
Ulf Möller7d7d2cb1999-05-13 11:37:32 +00001$! 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 __arch := AXP
10$ texe_dir := sys$disk:[-.'__arch'.exe.test]
11$ exe_dir := sys$disk:[-.'__arch'.exe.apps]
12$
13$ set default '__here'
14$ on control_y then goto exit
15$ on error then goto exit
16$
17$ if p1 .nes. ""
18$ then
19$ tests = p1
20$ else
21$ tests := -
Richard Levitteeec79f92000-09-08 20:25:49 +000022 test_des,test_idea,test_sha,test_md4,test_md5,test_hmac,-
23 test_md2,test_mdc2,-
Richard Levitte66a0def2000-12-28 22:26:11 +000024 test_rmd,test_rc2,test_rc4,test_rc5,test_bf,test_cast,test_rd,-
Richard Levittee0a9ba92001-03-08 14:40:20 +000025 test_rand,test_bn,test_ec,test_enc,test_x509,test_rsa,test_crl,test_sid,-
Richard Levitted5939832000-01-16 02:11:19 +000026 test_gen,test_req,test_pkcs7,test_verify,test_dh,test_dsa,-
Richard Levittee32587d2001-09-27 16:07:36 +000027 test_ss,test_ca,test_engine,test_ssl,test_evp
Ulf Möller7d7d2cb1999-05-13 11:37:32 +000028$ endif
29$ tests = f$edit(tests,"COLLAPSE")
30$
31$ BNTEST := bntest
Richard Levittee0a9ba92001-03-08 14:40:20 +000032$ ECTEST := ectest
Ulf Möller7d7d2cb1999-05-13 11:37:32 +000033$ EXPTEST := exptest
34$ IDEATEST := ideatest
35$ SHATEST := shatest
36$ SHA1TEST := sha1test
37$ MDC2TEST := mdc2test
38$ RMDTEST := rmdtest
39$ MD2TEST := md2test
Richard Levitteeec79f92000-09-08 20:25:49 +000040$ MD4TEST := md4test
Ulf Möller7d7d2cb1999-05-13 11:37:32 +000041$ MD5TEST := md5test
42$ HMACTEST := hmactest
43$ RC2TEST := rc2test
44$ RC4TEST := rc4test
45$ RC5TEST := rc5test
46$ BFTEST := bftest
47$ CASTTEST := casttest
48$ DESTEST := destest
49$ RANDTEST := randtest
50$ DHTEST := dhtest
51$ DSATEST := dsatest
52$ METHTEST := methtest
53$ SSLTEST := ssltest
Ulf Möller721b5b22000-01-18 15:08:49 +000054$ RSATEST := rsa_test
Richard Levitte5270e702000-10-26 21:07:28 +000055$ ENGINETEST := enginetest
Richard Levittee32587d2001-09-27 16:07:36 +000056$ EVPTEST := evp_test
Ulf Möller7d7d2cb1999-05-13 11:37:32 +000057$
58$ tests_i = 0
59$ loop_tests:
60$ tests_e = f$element(tests_i,",",tests)
61$ tests_i = tests_i + 1
62$ if tests_e .eqs. "," then goto exit
Richard Levittec13ee212000-03-13 22:27:52 +000063$ gosub 'tests_e'
64$ goto loop_tests
Ulf Möller7d7d2cb1999-05-13 11:37:32 +000065$
Richard Levittee32587d2001-09-27 16:07:36 +000066$ test_evp:
67$ mcr 'texe_dir''evptest' evptests.txt
68$ return
Ulf Möller7d7d2cb1999-05-13 11:37:32 +000069$ test_des:
70$ mcr 'texe_dir''destest'
Richard Levittec13ee212000-03-13 22:27:52 +000071$ return
Ulf Möller7d7d2cb1999-05-13 11:37:32 +000072$ test_idea:
73$ mcr 'texe_dir''ideatest'
Richard Levittec13ee212000-03-13 22:27:52 +000074$ return
Ulf Möller7d7d2cb1999-05-13 11:37:32 +000075$ test_sha:
76$ mcr 'texe_dir''shatest'
77$ mcr 'texe_dir''sha1test'
Richard Levittec13ee212000-03-13 22:27:52 +000078$ return
Ulf Möller7d7d2cb1999-05-13 11:37:32 +000079$ test_mdc2:
80$ mcr 'texe_dir''mdc2test'
Richard Levittec13ee212000-03-13 22:27:52 +000081$ return
Ulf Möller7d7d2cb1999-05-13 11:37:32 +000082$ test_md5:
83$ mcr 'texe_dir''md5test'
Richard Levittec13ee212000-03-13 22:27:52 +000084$ return
Richard Levitteeec79f92000-09-08 20:25:49 +000085$ test_md4:
86$ mcr 'texe_dir''md4test'
87$ return
Ulf Möller7d7d2cb1999-05-13 11:37:32 +000088$ test_hmac:
89$ mcr 'texe_dir''hmactest'
Richard Levittec13ee212000-03-13 22:27:52 +000090$ return
Ulf Möller7d7d2cb1999-05-13 11:37:32 +000091$ test_md2:
92$ mcr 'texe_dir''md2test'
Richard Levittec13ee212000-03-13 22:27:52 +000093$ return
Ulf Möller7d7d2cb1999-05-13 11:37:32 +000094$ test_rmd:
95$ mcr 'texe_dir''rmdtest'
Richard Levittec13ee212000-03-13 22:27:52 +000096$ return
Ulf Möller7d7d2cb1999-05-13 11:37:32 +000097$ test_bf:
98$ mcr 'texe_dir''bftest'
Richard Levittec13ee212000-03-13 22:27:52 +000099$ return
Ulf Möller7d7d2cb1999-05-13 11:37:32 +0000100$ test_cast:
101$ mcr 'texe_dir''casttest'
Richard Levittec13ee212000-03-13 22:27:52 +0000102$ return
Ulf Möller7d7d2cb1999-05-13 11:37:32 +0000103$ test_rc2:
104$ mcr 'texe_dir''rc2test'
Richard Levittec13ee212000-03-13 22:27:52 +0000105$ return
Ulf Möller7d7d2cb1999-05-13 11:37:32 +0000106$ test_rc4:
107$ mcr 'texe_dir''rc4test'
Richard Levittec13ee212000-03-13 22:27:52 +0000108$ return
Ulf Möller7d7d2cb1999-05-13 11:37:32 +0000109$ test_rc5:
110$ mcr 'texe_dir''rc5test'
Richard Levittec13ee212000-03-13 22:27:52 +0000111$ return
Ulf Möller7d7d2cb1999-05-13 11:37:32 +0000112$ test_rand:
113$ mcr 'texe_dir''randtest'
Richard Levittec13ee212000-03-13 22:27:52 +0000114$ return
Ulf Möller7d7d2cb1999-05-13 11:37:32 +0000115$ test_enc:
116$ @testenc.com
Richard Levittec13ee212000-03-13 22:27:52 +0000117$ return
Ulf Möller7d7d2cb1999-05-13 11:37:32 +0000118$ test_x509:
119$ define sys$error nla0:
120$ write sys$output "test normal x509v1 certificate"
121$ @tx509.com
122$ write sys$output "test first x509v3 certificate"
123$ @tx509.com v3-cert1.pem
124$ write sys$output "test second x509v3 certificate"
125$ @tx509.com v3-cert2.pem
126$ deassign sys$error
Richard Levittec13ee212000-03-13 22:27:52 +0000127$ return
Ulf Möller7d7d2cb1999-05-13 11:37:32 +0000128$ test_rsa:
129$ define sys$error nla0:
130$ @trsa.com
131$ deassign sys$error
132$ mcr 'texe_dir''rsatest'
Richard Levittec13ee212000-03-13 22:27:52 +0000133$ return
Ulf Möller7d7d2cb1999-05-13 11:37:32 +0000134$ test_crl:
135$ define sys$error nla0:
136$ @tcrl.com
137$ deassign sys$error
Richard Levittec13ee212000-03-13 22:27:52 +0000138$ return
Ulf Möller7d7d2cb1999-05-13 11:37:32 +0000139$ test_sid:
140$ define sys$error nla0:
141$ @tsid.com
142$ deassign sys$error
Richard Levittec13ee212000-03-13 22:27:52 +0000143$ return
Ulf Möller7d7d2cb1999-05-13 11:37:32 +0000144$ test_req:
145$ define sys$error nla0:
146$ @treq.com
147$ @treq.com testreq2.pem
148$ deassign sys$error
Richard Levittec13ee212000-03-13 22:27:52 +0000149$ return
Ulf Möller7d7d2cb1999-05-13 11:37:32 +0000150$ test_pkcs7:
151$ define sys$error nla0:
152$ @tpkcs7.com
153$ @tpkcs7d.com
154$ deassign sys$error
Richard Levittec13ee212000-03-13 22:27:52 +0000155$ return
Ulf Möller7d7d2cb1999-05-13 11:37:32 +0000156$ test_bn:
157$ write sys$output "starting big number library test, could take a while..."
158$ create bntest-vms.fdl
159FILE
160 ORGANIZATION sequential
161RECORD
162 FORMAT stream_lf
163$ create/fdl=bntest-vms.fdl bntest-vms.sh
164$ open/append foo bntest-vms.sh
165$ type/output=foo: sys$input:
Richard Levitte20a9b1a2001-03-08 21:12:58 +0000166<< __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"'
Ulf Möller7d7d2cb1999-05-13 11:37:32 +0000167$ define/user sys$output bntest-vms.tmp
168$ mcr 'texe_dir''bntest'
169$ copy bntest-vms.tmp foo:
170$ delete bntest-vms.tmp;*
171$ type/output=foo: sys$input:
172__FOO__
173$ close foo
Richard Levitte20a9b1a2001-03-08 21:12:58 +0000174$ write sys$output "-- copy the [.test]bntest-vms.sh and [.test]bctest files to a Unix system and"
175$ write sys$output "-- run bntest-vms.sh through sh or bash to verify that the bignum operations"
176$ write sys$output "-- went well."
Ulf Möller7d7d2cb1999-05-13 11:37:32 +0000177$ write sys$output ""
178$ write sys$output "test a^b%c implementations"
179$ mcr 'texe_dir''exptest'
Richard Levittec13ee212000-03-13 22:27:52 +0000180$ return
Richard Levittee0a9ba92001-03-08 14:40:20 +0000181$ test_ec:
Richard Levittea2b03692001-03-08 17:22:38 +0000182$ write sys$output "test elliptic curves"
Richard Levittee0a9ba92001-03-08 14:40:20 +0000183$ mcr 'texe_dir''ectest'
184$ return
Ulf Möller7d7d2cb1999-05-13 11:37:32 +0000185$ test_verify:
186$ write sys$output "The following command should have some OK's and some failures"
187$ write sys$output "There are definitly a few expired certificates"
188$ @tverify.com
Richard Levittec13ee212000-03-13 22:27:52 +0000189$ return
Ulf Möller7d7d2cb1999-05-13 11:37:32 +0000190$ test_dh:
Richard Levitteda0fc5b2000-01-30 13:44:08 +0000191$ write sys$output "Generate a set of DH parameters"
Ulf Möller7d7d2cb1999-05-13 11:37:32 +0000192$ mcr 'texe_dir''dhtest'
Richard Levittec13ee212000-03-13 22:27:52 +0000193$ return
Ulf Möller7d7d2cb1999-05-13 11:37:32 +0000194$ test_dsa:
Richard Levitteda0fc5b2000-01-30 13:44:08 +0000195$ write sys$output "Generate a set of DSA parameters"
Ulf Möller7d7d2cb1999-05-13 11:37:32 +0000196$ mcr 'texe_dir''dsatest'
Richard Levittec13ee212000-03-13 22:27:52 +0000197$ return
Richard Levitted5939832000-01-16 02:11:19 +0000198$ test_gen:
Ulf Möller7d7d2cb1999-05-13 11:37:32 +0000199$ write sys$output "Generate and verify a certificate request"
200$ @testgen.com
Richard Levittec13ee212000-03-13 22:27:52 +0000201$ return
202$ maybe_test_ss:
203$ testss_RDT = f$cvtime(f$file_attributes("testss.com","RDT"))
204$ if f$cvtime(f$file_attributes("keyU.ss","RDT")) .les. testss_RDT then -
205 goto test_ss
206$ if f$cvtime(f$file_attributes("certU.ss","RDT")) .les. testss_RDT then -
207 goto test_ss
208$ if f$cvtime(f$file_attributes("certCA.ss","RDT")) .les. testss_RDT then -
209 goto test_ss
210$ return
Ulf Möller7d7d2cb1999-05-13 11:37:32 +0000211$ test_ss:
212$ write sys$output "Generate and certify a test certificate"
213$ @testss.com
Richard Levittec13ee212000-03-13 22:27:52 +0000214$ return
Richard Levitte5270e702000-10-26 21:07:28 +0000215$ test_engine:
216$ write sys$output "Manipulate the ENGINE structures"
217$ mcr 'texe_dir''enginetest'
218$ return
Ulf Möller7d7d2cb1999-05-13 11:37:32 +0000219$ test_ssl:
220$ write sys$output "test SSL protocol"
Richard Levittec13ee212000-03-13 22:27:52 +0000221$ gosub maybe_test_ss
222$ @testssl.com keyU.ss certU.ss certCA.ss
223$ return
Ulf Möller7d7d2cb1999-05-13 11:37:32 +0000224$ test_ca:
Richard Levittec13ee212000-03-13 22:27:52 +0000225$ set noon
226$ define/user sys$output nla0:
227$ mcr 'exe_dir'openssl no-rsa
228$ save_severity=$SEVERITY
229$ set on
230$ if save_severity
231$ then
232$ write sys$output "skipping CA.com test -- requires RSA"
233$ else
234$ write sys$output "Generate and certify a test certificate via the 'ca' program"
235$ @testca.com
236$ endif
237$ return
Richard Levitte66a0def2000-12-28 22:26:11 +0000238$ test_rd:
Richard Levitted53d2712000-11-22 18:17:16 +0000239$ write sys$output "test Rijndael"
240$ !mcr 'texe_dir''rdtest'
241$ return
Ulf Möller7d7d2cb1999-05-13 11:37:32 +0000242$
243$
244$ exit:
245$ set default '__save_default'
246$ exit