summaryrefslogtreecommitdiff
path: root/src/lib/libssl/test
diff options
context:
space:
mode:
authordjm <>2011-11-03 02:32:24 +0000
committerdjm <>2011-11-03 02:32:24 +0000
commit1e8701dd2507fadf6d232d93eb4299a8b79c66d5 (patch)
tree4310bd4936061d7695b1c5a1bb1771e9807616c1 /src/lib/libssl/test
parentfa3384eda96e42a23f6d3208998246abda2535c1 (diff)
parent027d47f36d5e77b24a925d19c987fc43151baa17 (diff)
downloadopenbsd-1e8701dd2507fadf6d232d93eb4299a8b79c66d5.tar.gz
openbsd-1e8701dd2507fadf6d232d93eb4299a8b79c66d5.tar.bz2
openbsd-1e8701dd2507fadf6d232d93eb4299a8b79c66d5.zip
This commit was generated by cvs2git to track changes on a CVS vendor
branch.
Diffstat (limited to 'src/lib/libssl/test')
-rw-r--r--src/lib/libssl/test/bctest.com152
-rw-r--r--src/lib/libssl/test/bntest.com76
-rwxr-xr-xsrc/lib/libssl/test/clean_test.com35
-rw-r--r--src/lib/libssl/test/testtsa.com65
4 files changed, 299 insertions, 29 deletions
diff --git a/src/lib/libssl/test/bctest.com b/src/lib/libssl/test/bctest.com
new file mode 100644
index 0000000000..d7e5ec139e
--- /dev/null
+++ b/src/lib/libssl/test/bctest.com
@@ -0,0 +1,152 @@
1$!
2$! Check operation of "bc".
3$!
4$! 2010-04-05 SMS. New. Based (loosely) on "bctest".
5$!
6$!
7$ tmp_file_name = "tmp.bctest"
8$ failure = ""
9$!
10$! Basic command test.
11$!
12$ on warning then goto bc_fail
13$ bc
14$ on error then exit
15$!
16$! Test for SunOS 5.[78] bc bug.
17$!
18$ if (failure .eqs. "")
19$ then
20$!
21$ define /user_mode sys$output 'tmp_file_name'
22$ bc
23obase=16
24ibase=16
25a=AD88C418F31B3FC712D0425001D522B3AE9134FF3A98C13C1FCC1682211195406C1A6C66C6A\
26CEEC1A0EC16950233F77F1C2F2363D56DD71A36C57E0B2511FC4BA8F22D261FE2E9356D99AF57\
2710F3817C0E05BF79C423C3F66FDF321BE8D3F18F625D91B670931C1EF25F28E489BDA1C5422D1\
28C3F6F7A1AD21585746ECC4F10A14A778AF56F08898E965E9909E965E0CB6F85B514150C644759\
293BE731877B16EA07B552088FF2EA728AC5E0FF3A23EB939304519AB8B60F2C33D6BA0945B66F0\
304FC3CADF855448B24A9D7640BCF473E
31b=DCE91E7D120B983EA9A104B5A96D634DD644C37657B1C7860B45E6838999B3DCE5A555583C6\
329209E41F413422954175A06E67FFEF6746DD652F0F48AEFECC3D8CAC13523BDAAD3F5AF4212BD\
338B3CD64126E1A82E190228020C05B91C8B141F1110086FC2A4C6ED631EBA129D04BB9A19FC53D\
343ED0E2017D60A68775B75481449
35(a/b)*b + (a%b) - a
36$ status = $status
37$ output_expected = "0"
38$ gosub check_output
39$ if (output .ne. 1)
40$ then
41$ failure = "SunOStest"
42$ else
43$ delete 'f$parse( tmp_file_name)'
44$ endif
45$ endif
46$!
47$! Test for SCO bc bug.
48$!
49$ if (failure .eqs. "")
50$ then
51$!
52$ define /user_mode sys$output 'tmp_file_name'
53$ bc
54obase=16
55ibase=16
56-FFDD63BA1A4648F0D804F8A1C66C53F0D2110590E8A3907EC73B4AEC6F15AC177F176F2274D2\
579DC8022EA0D7DD3ABE9746D2D46DD3EA5B5F6F69DF12877E0AC5E7F5ADFACEE54573F5D256A06\
5811B5D2BC24947724E22AE4EC3FB0C39D9B4694A01AFE5E43B4D99FB9812A0E4A5773D8B254117\
591239157EC6E3D8D50199 * -FFDD63BA1A4648F0D804F8A1C66C53F0D2110590E8A3907EC73B4\
60AEC6F15AC177F176F2274D29DC8022EA0D7DD3ABE9746D2D46DD3EA5B5F6F69DF12877E0AC5E7\
61F5ADFACEE54573F5D256A0611B5D2BC24947724E22AE4EC3FB0C39D9B4694A01AFE5E43B4D99F\
62B9812A0E4A5773D8B2541171239157EC6E3D8D50199 - FFBACC221682DA464B6D7F123482522\
6302EDAEDCA38C3B69E9B7BBCD6165A9CD8716C4903417F23C09A85B851961F92C217258CEEB866\
6485EFCC5DD131853A02C07A873B8E2AF2E40C6D5ED598CD0E8F35AD49F3C3A17FDB7653E4E2DC4\
65A8D23CC34686EE4AD01F7407A7CD74429AC6D36DBF0CB6A3E302D0E5BDFCD048A3B90C1BE5AA8\
66E16C3D5884F9136B43FF7BB443764153D4AEC176C681B078F4CC53D6EB6AB76285537DDEE7C18\
678C72441B52EDBDDBC77E02D34E513F2AABF92F44109CAFE8242BD0ECBAC5604A94B02EA44D43C\
6804E9476E6FBC48043916BFA1485C6093603600273C9C33F13114D78064AE42F3DC466C7DA543D\
6989C8D71
70AD534AFBED2FA39EE9F40E20FCF9E2C861024DB98DDCBA1CD118C49CA55EEBC20D6BA51B2271C\
71928B693D6A73F67FEB1B4571448588B46194617D25D910C6A9A130CC963155CF34079CB218A44\
728A1F57E276D92A33386DDCA3D241DB78C8974ABD71DD05B0FA555709C9910D745185E6FE108E3\
7337F1907D0C56F8BFBF52B9704 % -E557905B56B13441574CAFCE2BD257A750B1A8B2C88D0E36\
74E18EF7C38DAC80D3948E17ED63AFF3B3467866E3B89D09A81B3D16B52F6A3C7134D3C6F5123E9\
75F617E3145BBFBE9AFD0D6E437EA4FF6F04BC67C4F1458B4F0F47B64 - 1C2BBBB19B74E86FD32\
769E8DB6A8C3B1B9986D57ED5419C2E855F7D5469E35E76334BB42F4C43E3F3A31B9697C171DAC4\
77D97935A7E1A14AD209D6CF811F55C6DB83AA9E6DFECFCD6669DED7171EE22A40C6181615CAF3F\
785296964
79$ status = $status
80$ output_expected = "0\0"
81$ gosub check_output
82$ if (output .ne. 1)
83$ then
84$ failure = "SCOtest"
85$ else
86$ delete 'f$parse( tmp_file_name)'
87$ endif
88$ endif
89$!
90$! Test for working 'print' command.
91$!
92$ if (failure .eqs. "")
93$ then
94$!
95$ define /user_mode sys$output 'tmp_file_name'
96$ bc
97print "OK"
98$ status = $status
99$ output_expected = "OK"
100$ gosub check_output
101$ if (output .ne. 1)
102$ then
103$ failure = "printtest"
104$ else
105$ delete 'f$parse( tmp_file_name)'
106$ endif
107$ endif
108$!
109$ if (failure .nes. "")
110$ then
111$ write sys$output -
112 "No working bc found. Consider installing GNU bc."
113$ exit %X00030000 ! %DCL-W-NORMAL
114$ endif
115$!
116$ exit
117$!
118$!
119$! Complete "bc" command failure.
120$!
121$ bc_fail:
122$ write sys$output -
123 "No ""bc"" program/symbol found. Consider installing GNU bc."
124$ exit %X00030000 ! %DCL-W-NORMAL
125$!
126$!
127$! Output check subroutine.
128$!
129$ check_output:
130$ eof = 0
131$ line_nr = 0
132$ open /read tmp_file 'tmp_file_name'
133$ c_o_loop:
134$ read /error = error_read tmp_file line
135$ goto ok_read
136$ error_read:
137$ eof = 1
138$ ok_read:
139$ line_expected = f$element( line_nr, "\", output_expected)
140$ line_nr = line_nr+ 1
141$ if ((line_expected .nes. "\") .and. (.not. eof) .and. -
142 (line_expected .eqs. line)) then goto c_o_loop
143$!
144$ if ((line_expected .eqs. "\") .and. eof)
145$ then
146$ output = 1
147$ else
148$ output = 0
149$ endif
150$ close tmp_file
151$ return
152$!
diff --git a/src/lib/libssl/test/bntest.com b/src/lib/libssl/test/bntest.com
new file mode 100644
index 0000000000..6545d2e5a5
--- /dev/null
+++ b/src/lib/libssl/test/bntest.com
@@ -0,0 +1,76 @@
1$!
2$! Analyze bntest output file.
3$!
4$! Exit status = 1 (success) if all tests passed,
5$! 0 (warning) if any test failed.
6$!
7$! 2011-02-20 SMS. Added code to skip "#" comments in the input file.
8$!
9$! 2010-04-05 SMS. New. Based (loosely) on perl code in bntest-vms.sh.
10$!
11$! Expect data like:
12$! test test_name1
13$! 0
14$! [...]
15$! test test_name2
16$! 0
17$! [...]
18$! [...]
19$!
20$! Some tests have no following "0" lines.
21$!
22$ result_file_name = f$edit( p1, "TRIM")
23$ if (result_file_name .eqs. "")
24$ then
25$ result_file_name = "bntest-vms.out"
26$ endif
27$!
28$ fail = 0
29$ passed = 0
30$ tests = 0
31$!
32$ on control_c then goto tidy
33$ on error then goto tidy
34$!
35$ open /read result_file 'result_file_name'
36$!
37$ read_loop:
38$ read /end = read_loop_end /error = tidy result_file line
39$ t1 = f$element( 0, " ", line)
40$!
41$! Skip "#" comment lines.
42$ if (f$extract( 0, 1, f$edit( line, "TRIM")) .eqs. "#") then -
43 goto read_loop
44$!
45$ if (t1 .eqs. "test")
46$ then
47$ passed = passed+ 1
48$ tests = tests+ 1
49$ fail = 1
50$ t2 = f$extract( 5, 1000, line)
51$ write sys$output "verify ''t2'"
52$ else
53$ if (t1 .nes. "0")
54$ then
55$ write sys$output "Failed! bc: ''line'"
56$ passed = passed- fail
57$ fail = 0
58$ endif
59$ endif
60$ goto read_loop
61$ read_loop_end:
62$ write sys$output "''passed'/''tests' tests passed"
63$!
64$ tidy:
65$ if f$trnlnm( "result_file", "LNM$PROCESS_TABLE", , "SUPERVISOR", , "CONFINE")
66$ then
67$ close result_file
68$ endif
69$!
70$ if ((tests .gt. 0) .and. (tests .eq. passed))
71$ then
72$ exit 1
73$ else
74$ exit 0
75$ endif
76$!
diff --git a/src/lib/libssl/test/clean_test.com b/src/lib/libssl/test/clean_test.com
new file mode 100755
index 0000000000..7df633fbef
--- /dev/null
+++ b/src/lib/libssl/test/clean_test.com
@@ -0,0 +1,35 @@
1$!
2$! Delete various test results files.
3$!
4$ def_orig = f$environment( "default")
5$ proc = f$environment( "procedure")
6$ proc_dev_dir = f$parse( "A.;", proc) - "A.;"
7$!
8$ on control_c then goto tidy
9$ on error then goto tidy
10$!
11$ set default 'proc_dev_dir'
12$!
13$ files := *.cms;*, *.srl;*, *.ss;*, -
14 cms.err;*, cms.out;*, newreq.pem;*, -
15 p.txt-zlib-cipher;*, -
16 smtst.txt;*, testkey.pem;*, testreq.pem;*, -
17 test_*.err;*, test_*.out;*, -
18 .rnd;*
19$!
20$ delim = ","
21$ i = 0
22$ loop:
23$ file = f$edit( f$element( i, delim, files), "trim")
24$ if (file .eqs. delim) then goto loop_end
25$ if (f$search( file) .nes. "") then -
26 delete 'p1' 'file'
27$ i = i+ 1
28$ goto loop
29$ loop_end:
30$!
31$ tidy:
32$
33$ if (f$type( def_orig) .nes. "") then -
34 set default 'def_orig'
35$!
diff --git a/src/lib/libssl/test/testtsa.com b/src/lib/libssl/test/testtsa.com
index e3c586f14a..29fb1d0e63 100644
--- a/src/lib/libssl/test/testtsa.com
+++ b/src/lib/libssl/test/testtsa.com
@@ -2,14 +2,17 @@ $!
2$! A few very basic tests for the 'ts' time stamping authority command. 2$! A few very basic tests for the 'ts' time stamping authority command.
3$! 3$!
4$ 4$
5$ __arch := VAX 5$ __arch = "VAX"
6$ if f$getsyi("cpu") .ge. 128 then - 6$ if f$getsyi("cpu") .ge. 128 then -
7 __arch = f$edit( f$getsyi( "ARCH_NAME"), "UPCASE") 7 __arch = f$edit( f$getsyi( "ARCH_NAME"), "UPCASE")
8$ if __arch .eqs. "" then __arch := UNK 8$ if __arch .eqs. "" then __arch = "UNK"
9$ exe_dir := sys$disk:[-.'__arch'.exe.apps] 9$!
10$ if (p4 .eqs. "64") then __arch = __arch+ "_64"
11$!
12$ exe_dir = "sys$disk:[-.''__arch'.exe.apps]"
10$ 13$
11$ openssl := mcr 'f$parse(exe_dir+"openssl.exe")' 14$ openssl = "mcr ''f$parse(exe_dir+"openssl.exe")'"
12$ OPENSSL_CONF := [-]CAtsa.cnf 15$ OPENSSL_CONF = "[-]CAtsa.cnf"
13$ ! Because that's what ../apps/CA.sh really looks at 16$ ! Because that's what ../apps/CA.sh really looks at
14$ SSLEAY_CONFIG = "-config " + OPENSSL_CONF 17$ SSLEAY_CONFIG = "-config " + OPENSSL_CONF
15$ 18$
@@ -114,8 +117,8 @@ $
114$ time_stamp_response_token_test: 117$ time_stamp_response_token_test:
115$ subroutine 118$ subroutine
116$ 119$
117$ RESPONSE2:='p2'.copy_tsr 120$ RESPONSE2 = p2+ "-copy_tsr"
118$ TOKEN_DER:='p2'.token_der 121$ TOKEN_DER = p2+ "-token_der"
119$ openssl ts -reply -in 'p2' -out 'TOKEN_DER' -token_out 122$ openssl ts -reply -in 'p2' -out 'TOKEN_DER' -token_out
120$ if $severity .ne. 1 then call error 123$ if $severity .ne. 1 then call error
121$ openssl ts -reply -in 'TOKEN_DER' -token_in -out 'RESPONSE2' 124$ openssl ts -reply -in 'TOKEN_DER' -token_in -out 'RESPONSE2'
@@ -145,13 +148,13 @@ $ verify_time_stamp_token:
145$ subroutine 148$ subroutine
146$ 149$
147$ ! create the token from the response first 150$ ! create the token from the response first
148$ openssl ts -reply -in 'p2' -out 'p2'.token -token_out 151$ openssl ts -reply -in "''p2'" -out "''p2'-token" -token_out
149$ if $severity .ne. 1 then call error 152$ if $severity .ne. 1 then call error
150$ openssl ts -verify -queryfile 'p1' -in 'p2'.token -token_in - 153$ openssl ts -verify -queryfile "''p1'" -in "''p2'-token" -
151 "-CAfile" tsaca.pem -untrusted tsa_cert1.pem 154 -token_in "-CAfile" tsaca.pem -untrusted tsa_cert1.pem
152$ if $severity .ne. 1 then call error 155$ if $severity .ne. 1 then call error
153$ openssl ts -verify -data 'p3' -in 'p2'.token -token_in - 156$ openssl ts -verify -data "''p3'" -in "''p2'-token" -
154 "-CAfile" tsaca.pem -untrusted tsa_cert1.pem 157 -token_in "-CAfile" tsaca.pem -untrusted tsa_cert1.pem
155$ if $severity .ne. 1 then call error 158$ if $severity .ne. 1 then call error
156$ endsubroutine 159$ endsubroutine
157$ 160$
@@ -167,6 +170,8 @@ $ endsubroutine
167$ 170$
168$ ! Main body ---------------------------------------------------------- 171$ ! Main body ----------------------------------------------------------
169$ 172$
173$ set noon
174$
170$ write sys$output "Setting up TSA test directory..." 175$ write sys$output "Setting up TSA test directory..."
171$ call setup_dir 176$ call setup_dir
172$ 177$
@@ -183,66 +188,68 @@ $ write sys$output "Creating req1.req time stamp request for file testtsa..."
183$ call create_time_stamp_request1 188$ call create_time_stamp_request1
184$ 189$
185$ write sys$output "Printing req1.req..." 190$ write sys$output "Printing req1.req..."
186$ call print_request req1.tsq 191$ call print_request "req1.tsq"
187$ 192$
188$ write sys$output "Generating valid response for req1.req..." 193$ write sys$output "Generating valid response for req1.req..."
189$ call create_time_stamp_response req1.tsq resp1.tsr tsa_config1 194$ call create_time_stamp_response "req1.tsq" "resp1.tsr" "tsa_config1"
190$ 195$
191$ write sys$output "Printing response..." 196$ write sys$output "Printing response..."
192$ call print_response resp1.tsr 197$ call print_response "resp1.tsr"
193$ 198$
194$ write sys$output "Verifying valid response..." 199$ write sys$output "Verifying valid response..."
195$ call verify_time_stamp_response req1.tsq resp1.tsr [-]testtsa.com 200$ call verify_time_stamp_response "req1.tsq" "resp1.tsr" "[-]testtsa.com"
196$ 201$
197$ write sys$output "Verifying valid token..." 202$ write sys$output "Verifying valid token..."
198$ call verify_time_stamp_token req1.tsq resp1.tsr [-]testtsa.com 203$ call verify_time_stamp_token "req1.tsq" "resp1.tsr" "[-]testtsa.com"
199$ 204$
200$ ! The tests below are commented out, because invalid signer certificates 205$ ! The tests below are commented out, because invalid signer certificates
201$ ! can no longer be specified in the config file. 206$ ! can no longer be specified in the config file.
202$ 207$
203$ ! write sys$output "Generating _invalid_ response for req1.req..." 208$ ! write sys$output "Generating _invalid_ response for req1.req..."
204$ ! call create_time_stamp_response req1.tsq resp1_bad.tsr tsa_config2 209$ ! call create_time_stamp_response "req1.tsq" "resp1_bad.tsr" "tsa_config2"
205$ 210$
206$ ! write sys$output "Printing response..." 211$ ! write sys$output "Printing response..."
207$ ! call print_response resp1_bad.tsr 212$ ! call print_response "resp1_bad.tsr"
208$ 213$
209$ ! write sys$output "Verifying invalid response, it should fail..." 214$ ! write sys$output "Verifying invalid response, it should fail..."
210$ ! call verify_time_stamp_response_fail req1.tsq resp1_bad.tsr 215$ ! call verify_time_stamp_response_fail "req1.tsq" "resp1_bad.tsr"
211$ 216$
212$ write sys$output "Creating req2.req time stamp request for file testtsa..." 217$ write sys$output "Creating req2.req time stamp request for file testtsa..."
213$ call create_time_stamp_request2 218$ call create_time_stamp_request2
214$ 219$
215$ write sys$output "Printing req2.req..." 220$ write sys$output "Printing req2.req..."
216$ call print_request req2.tsq 221$ call print_request "req2.tsq"
217$ 222$
218$ write sys$output "Generating valid response for req2.req..." 223$ write sys$output "Generating valid response for req2.req..."
219$ call create_time_stamp_response req2.tsq resp2.tsr tsa_config1 224$ call create_time_stamp_response "req2.tsq" "resp2.tsr" "tsa_config1"
220$ 225$
221$ write sys$output "Checking '-token_in' and '-token_out' options with '-reply'..." 226$ write sys$output "Checking '-token_in' and '-token_out' options with '-reply'..."
222$ call time_stamp_response_token_test req2.tsq resp2.tsr 227$ call time_stamp_response_token_test "req2.tsq" "resp2.tsr"
223$ 228$
224$ write sys$output "Printing response..." 229$ write sys$output "Printing response..."
225$ call print_response resp2.tsr 230$ call print_response "resp2.tsr"
226$ 231$
227$ write sys$output "Verifying valid response..." 232$ write sys$output "Verifying valid response..."
228$ call verify_time_stamp_response req2.tsq resp2.tsr [-]testtsa.com 233$ call verify_time_stamp_response "req2.tsq" "resp2.tsr" "[-]testtsa.com"
229$ 234$
230$ write sys$output "Verifying response against wrong request, it should fail..." 235$ write sys$output "Verifying response against wrong request, it should fail..."
231$ call verify_time_stamp_response_fail req1.tsq resp2.tsr 236$ call verify_time_stamp_response_fail "req1.tsq" "resp2.tsr"
232$ 237$
233$ write sys$output "Verifying response against wrong request, it should fail..." 238$ write sys$output "Verifying response against wrong request, it should fail..."
234$ call verify_time_stamp_response_fail req2.tsq resp1.tsr 239$ call verify_time_stamp_response_fail "req2.tsq" "resp1.tsr"
235$ 240$
236$ write sys$output "Creating req3.req time stamp request for file CAtsa.cnf..." 241$ write sys$output "Creating req3.req time stamp request for file CAtsa.cnf..."
237$ call create_time_stamp_request3 242$ call create_time_stamp_request3
238$ 243$
239$ write sys$output "Printing req3.req..." 244$ write sys$output "Printing req3.req..."
240$ call print_request req3.tsq 245$ call print_request "req3.tsq"
241$ 246$
242$ write sys$output "Verifying response against wrong request, it should fail..." 247$ write sys$output "Verifying response against wrong request, it should fail..."
243$ call verify_time_stamp_response_fail req3.tsq resp1.tsr 248$ call verify_time_stamp_response_fail "req3.tsq" "resp1.tsr"
244$ 249$
245$ write sys$output "Cleaning up..." 250$ write sys$output "Cleaning up..."
246$ call clean_up_dir 251$ call clean_up_dir
247$ 252$
253$ set on
254$
248$ exit 255$ exit