tests.com 5.7 KB
Newer Older
U
Ulf Möller 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
$! TESTS.COM  --  Performs the necessary tests
$!
$! P1	tests to be performed.  Empty means all.
$
$	__proc = f$element(0,";",f$environment("procedure"))
$	__here = f$parse(f$parse("A.;",__proc) - "A.;","[]A.;") - "A.;"
$	__save_default = f$environment("default")
$	__arch := VAX
$	if f$getsyi("cpu") .ge. 128 then __arch := AXP
$	texe_dir := sys$disk:[-.'__arch'.exe.test]
$	exe_dir := sys$disk:[-.'__arch'.exe.apps]
$
$	set default '__here'
$	on control_y then goto exit
$	on error then goto exit
$
$	if p1 .nes. ""
$	then
$	    tests = p1
$	else
$	    tests := -
22 23
	test_des,test_idea,test_sha,test_md4,test_md5,test_hmac,-
	test_md2,test_mdc2,-
24
	test_rmd,test_rc2,test_rc4,test_rc5,test_bf,test_cast,test_rd,-
25
	test_rand,test_bn,test_ec,test_enc,test_x509,test_rsa,test_crl,test_sid,-
26
	test_gen,test_req,test_pkcs7,test_verify,test_dh,test_dsa,-
27
	test_ss,test_ca,test_engine,test_ssl
U
Ulf Möller 已提交
28 29 30 31
$	endif
$	tests = f$edit(tests,"COLLAPSE")
$
$	BNTEST :=	bntest
32
$	ECTEST :=	ectest
U
Ulf Möller 已提交
33 34 35 36 37 38 39
$	EXPTEST :=	exptest
$	IDEATEST :=	ideatest
$	SHATEST :=	shatest
$	SHA1TEST :=	sha1test
$	MDC2TEST :=	mdc2test
$	RMDTEST :=	rmdtest
$	MD2TEST :=	md2test
40
$	MD4TEST :=	md4test
U
Ulf Möller 已提交
41 42 43 44 45 46 47 48 49 50 51 52 53
$	MD5TEST :=	md5test
$	HMACTEST :=	hmactest
$	RC2TEST :=	rc2test
$	RC4TEST :=	rc4test
$	RC5TEST :=	rc5test
$	BFTEST :=	bftest
$	CASTTEST :=	casttest
$	DESTEST :=	destest
$	RANDTEST :=	randtest
$	DHTEST :=	dhtest
$	DSATEST :=	dsatest
$	METHTEST :=	methtest
$	SSLTEST :=	ssltest
54
$	RSATEST :=	rsa_test
55
$	ENGINETEST :=	enginetest
U
Ulf Möller 已提交
56 57 58 59 60 61
$
$	tests_i = 0
$ loop_tests:
$	tests_e = f$element(tests_i,",",tests)
$	tests_i = tests_i + 1
$	if tests_e .eqs. "," then goto exit
R
Richard Levitte 已提交
62 63
$	gosub 'tests_e'
$	goto loop_tests
U
Ulf Möller 已提交
64 65 66
$
$ test_des:
$	mcr 'texe_dir''destest'
R
Richard Levitte 已提交
67
$	return
U
Ulf Möller 已提交
68 69
$ test_idea:
$	mcr 'texe_dir''ideatest'
R
Richard Levitte 已提交
70
$	return
U
Ulf Möller 已提交
71 72 73
$ test_sha:
$	mcr 'texe_dir''shatest'
$	mcr 'texe_dir''sha1test'
R
Richard Levitte 已提交
74
$	return
U
Ulf Möller 已提交
75 76
$ test_mdc2:
$	mcr 'texe_dir''mdc2test'
R
Richard Levitte 已提交
77
$	return
U
Ulf Möller 已提交
78 79
$ test_md5:
$	mcr 'texe_dir''md5test'
R
Richard Levitte 已提交
80
$	return
81 82 83
$ test_md4:
$	mcr 'texe_dir''md4test'
$	return
U
Ulf Möller 已提交
84 85
$ test_hmac:
$	mcr 'texe_dir''hmactest'
R
Richard Levitte 已提交
86
$	return
U
Ulf Möller 已提交
87 88
$ test_md2:
$	mcr 'texe_dir''md2test'
R
Richard Levitte 已提交
89
$	return
U
Ulf Möller 已提交
90 91
$ test_rmd:
$	mcr 'texe_dir''rmdtest'
R
Richard Levitte 已提交
92
$	return
U
Ulf Möller 已提交
93 94
$ test_bf:
$	mcr 'texe_dir''bftest'
R
Richard Levitte 已提交
95
$	return
U
Ulf Möller 已提交
96 97
$ test_cast:
$	mcr 'texe_dir''casttest'
R
Richard Levitte 已提交
98
$	return
U
Ulf Möller 已提交
99 100
$ test_rc2:
$	mcr 'texe_dir''rc2test'
R
Richard Levitte 已提交
101
$	return
U
Ulf Möller 已提交
102 103
$ test_rc4:
$	mcr 'texe_dir''rc4test'
R
Richard Levitte 已提交
104
$	return
U
Ulf Möller 已提交
105 106
$ test_rc5:
$	mcr 'texe_dir''rc5test'
R
Richard Levitte 已提交
107
$	return
U
Ulf Möller 已提交
108 109
$ test_rand:
$	mcr 'texe_dir''randtest'
R
Richard Levitte 已提交
110
$	return
U
Ulf Möller 已提交
111 112
$ test_enc:
$	@testenc.com
R
Richard Levitte 已提交
113
$	return
U
Ulf Möller 已提交
114 115 116 117 118 119 120 121 122
$ test_x509:
$	define sys$error nla0:
$	write sys$output "test normal x509v1 certificate"
$	@tx509.com
$	write sys$output "test first x509v3 certificate"
$	@tx509.com v3-cert1.pem
$	write sys$output "test second x509v3 certificate"
$	@tx509.com v3-cert2.pem
$	deassign sys$error
R
Richard Levitte 已提交
123
$	return
U
Ulf Möller 已提交
124 125 126 127 128
$ test_rsa:
$	define sys$error nla0:
$	@trsa.com
$	deassign sys$error
$	mcr 'texe_dir''rsatest'
R
Richard Levitte 已提交
129
$	return
U
Ulf Möller 已提交
130 131 132 133
$ test_crl:
$	define sys$error nla0:
$	@tcrl.com
$	deassign sys$error
R
Richard Levitte 已提交
134
$	return
U
Ulf Möller 已提交
135 136 137 138
$ test_sid:
$	define sys$error nla0:
$	@tsid.com
$	deassign sys$error
R
Richard Levitte 已提交
139
$	return
U
Ulf Möller 已提交
140 141 142 143 144
$ test_req:
$	define sys$error nla0:
$	@treq.com
$	@treq.com testreq2.pem
$	deassign sys$error
R
Richard Levitte 已提交
145
$	return
U
Ulf Möller 已提交
146 147 148 149 150
$ test_pkcs7:
$	define sys$error nla0:
$	@tpkcs7.com
$	@tpkcs7d.com
$	deassign sys$error
R
Richard Levitte 已提交
151
$	return
U
Ulf Möller 已提交
152 153 154 155 156 157 158 159 160 161
$ test_bn:
$	write sys$output "starting big number library test, could take a while..."
$	create bntest-vms.fdl
FILE
	ORGANIZATION	sequential
RECORD
	FORMAT		stream_lf
$	create/fdl=bntest-vms.fdl bntest-vms.sh
$	open/append foo bntest-vms.sh
$	type/output=foo: sys$input:
162
<< __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"'
U
Ulf Möller 已提交
163 164 165 166 167 168 169 170 171 172 173 174
$	define/user sys$output bntest-vms.tmp
$	mcr 'texe_dir''bntest'
$	copy bntest-vms.tmp foo:
$	delete bntest-vms.tmp;*
$	type/output=foo: sys$input:
__FOO__
$	close foo
$	write sys$output "-- copy the [.test]bntest-vms.sh file to a Unix system and run it"
$	write sys$output "-- through sh or bash to verify that the bignum operations went well."
$	write sys$output ""
$	write sys$output "test a^b%c implementations"
$	mcr 'texe_dir''exptest'
R
Richard Levitte 已提交
175
$	return
176
$ test_ec:
177
$	write sys$output "test elliptic curves"
178 179
$	mcr 'texe_dir''ectest'
$	return
U
Ulf Möller 已提交
180 181 182 183
$ test_verify:
$	write sys$output "The following command should have some OK's and some failures"
$	write sys$output "There are definitly a few expired certificates"
$	@tverify.com
R
Richard Levitte 已提交
184
$	return
U
Ulf Möller 已提交
185
$ test_dh:
R
Richard Levitte 已提交
186
$	write sys$output "Generate a set of DH parameters"
U
Ulf Möller 已提交
187
$	mcr 'texe_dir''dhtest'
R
Richard Levitte 已提交
188
$	return
U
Ulf Möller 已提交
189
$ test_dsa:
R
Richard Levitte 已提交
190
$	write sys$output "Generate a set of DSA parameters"
U
Ulf Möller 已提交
191
$	mcr 'texe_dir''dsatest'
R
Richard Levitte 已提交
192
$	return
193
$ test_gen:
U
Ulf Möller 已提交
194 195
$	write sys$output "Generate and verify a certificate request"
$	@testgen.com
R
Richard Levitte 已提交
196 197 198 199 200 201 202 203 204 205
$	return
$ maybe_test_ss:
$	testss_RDT = f$cvtime(f$file_attributes("testss.com","RDT"))
$	if f$cvtime(f$file_attributes("keyU.ss","RDT")) .les. testss_RDT then -
		goto test_ss
$	if f$cvtime(f$file_attributes("certU.ss","RDT")) .les. testss_RDT then -
		goto test_ss
$	if f$cvtime(f$file_attributes("certCA.ss","RDT")) .les. testss_RDT then -
		goto test_ss
$	return
U
Ulf Möller 已提交
206 207 208
$ test_ss:
$	write sys$output "Generate and certify a test certificate"
$	@testss.com
R
Richard Levitte 已提交
209
$	return
210 211 212 213
$ test_engine: 
$	write sys$output "Manipulate the ENGINE structures"
$	mcr 'texe_dir''enginetest'
$	return
U
Ulf Möller 已提交
214 215
$ test_ssl:
$	write sys$output "test SSL protocol"
R
Richard Levitte 已提交
216 217 218
$	gosub maybe_test_ss
$	@testssl.com keyU.ss certU.ss certCA.ss
$	return
U
Ulf Möller 已提交
219
$ test_ca:
R
Richard Levitte 已提交
220 221 222 223 224 225 226 227 228 229 230 231 232
$	set noon
$	define/user sys$output nla0:
$	mcr 'exe_dir'openssl no-rsa
$	save_severity=$SEVERITY
$	set on
$	if save_severity
$	then
$	    write sys$output "skipping CA.com test -- requires RSA"
$	else
$	    write sys$output "Generate and certify a test certificate via the 'ca' program"
$	    @testca.com
$	endif
$	return
233
$ test_rd: 
234 235 236
$	write sys$output "test Rijndael"
$	!mcr 'texe_dir''rdtest'
$	return
U
Ulf Möller 已提交
237 238 239 240 241
$
$
$ exit:
$	set default '__save_default'
$	exit