xref: /minix3/crypto/external/bsd/openssl/dist/test/testgen.com (revision ebfedea0ce5bbe81e252ddf32d732e40fb633fae)
1*ebfedea0SLionel Sambuc$! TESTGEN.COM
2*ebfedea0SLionel Sambuc$
3*ebfedea0SLionel Sambuc$	__arch = "VAX"
4*ebfedea0SLionel Sambuc$	if f$getsyi("cpu") .ge. 128 then -
5*ebfedea0SLionel Sambuc	   __arch = f$edit( f$getsyi( "ARCH_NAME"), "UPCASE")
6*ebfedea0SLionel Sambuc$	if __arch .eqs. "" then __arch = "UNK"
7*ebfedea0SLionel Sambuc$	if (p1 .eqs. 64) then __arch = __arch+ "_64"
8*ebfedea0SLionel Sambuc$	exe_dir = "sys$disk:[-.''__arch'.exe.apps]"
9*ebfedea0SLionel Sambuc$
10*ebfedea0SLionel Sambuc$	T = "testcert"
11*ebfedea0SLionel Sambuc$	KEY = 512
12*ebfedea0SLionel Sambuc$	CA = "[-.certs]testca.pem"
13*ebfedea0SLionel Sambuc$
14*ebfedea0SLionel Sambuc$	set noon
15*ebfedea0SLionel Sambuc$	if f$search(T+".1;*") .nes. "" then delete 'T'.1;*
16*ebfedea0SLionel Sambuc$	if f$search(T+".2;*") .nes. "" then delete 'T'.2;*
17*ebfedea0SLionel Sambuc$	if f$search(T+".key;*") .nes. "" then delete 'T'.key;*
18*ebfedea0SLionel Sambuc$	set on
19*ebfedea0SLionel Sambuc$
20*ebfedea0SLionel Sambuc$	write sys$output "generating certificate request"
21*ebfedea0SLionel Sambuc$
22*ebfedea0SLionel Sambuc$	append/new nl: .rnd
23*ebfedea0SLionel Sambuc$	open/append random_file .rnd
24*ebfedea0SLionel Sambuc$	write random_file -
25*ebfedea0SLionel Sambuc	 "string to make the random number generator think it has entropy"
26*ebfedea0SLionel Sambuc$	close random_file
27*ebfedea0SLionel Sambuc$
28*ebfedea0SLionel Sambuc$	set noon
29*ebfedea0SLionel Sambuc$	define/user sys$output nla0:
30*ebfedea0SLionel Sambuc$	mcr 'exe_dir'openssl no-rsa
31*ebfedea0SLionel Sambuc$	save_severity=$SEVERITY
32*ebfedea0SLionel Sambuc$	set on
33*ebfedea0SLionel Sambuc$	if save_severity
34*ebfedea0SLionel Sambuc$	then
35*ebfedea0SLionel Sambuc$	    req_new="-newkey dsa:[-.apps]dsa512.pem"
36*ebfedea0SLionel Sambuc$	else
37*ebfedea0SLionel Sambuc$	    req_new="-new"
38*ebfedea0SLionel Sambuc$	    write sys$output -
39*ebfedea0SLionel Sambuc	     "There should be a 2 sequences of .'s and some +'s."
40*ebfedea0SLionel Sambuc$	    write sys$output -
41*ebfedea0SLionel Sambuc	     "There should not be more that at most 80 per line"
42*ebfedea0SLionel Sambuc$	endif
43*ebfedea0SLionel Sambuc$
44*ebfedea0SLionel Sambuc$	write sys$output "This could take some time."
45*ebfedea0SLionel Sambuc$
46*ebfedea0SLionel Sambuc$	mcr 'exe_dir'openssl req -config test.cnf 'req_new' -out testreq.pem
47*ebfedea0SLionel Sambuc$	if $severity .ne. 1
48*ebfedea0SLionel Sambuc$	then
49*ebfedea0SLionel Sambuc$	    write sys$output "problems creating request"
50*ebfedea0SLionel Sambuc$	    exit 3
51*ebfedea0SLionel Sambuc$	endif
52*ebfedea0SLionel Sambuc$
53*ebfedea0SLionel Sambuc$	mcr 'exe_dir'openssl req -config test.cnf -verify -in testreq.pem -noout
54*ebfedea0SLionel Sambuc$	if $severity .ne. 1
55*ebfedea0SLionel Sambuc$	then
56*ebfedea0SLionel Sambuc$	    write sys$output "signature on req is wrong"
57*ebfedea0SLionel Sambuc$	    exit 3
58*ebfedea0SLionel Sambuc$	endif
59