80-test_ssl_old.t 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635
  1. #! /usr/bin/env perl
  2. # Copyright 2015-2022 The OpenSSL Project Authors. All Rights Reserved.
  3. #
  4. # Licensed under the OpenSSL license (the "License"). You may not use
  5. # this file except in compliance with the License. You can obtain a copy
  6. # in the file LICENSE in the source distribution or at
  7. # https://www.openssl.org/source/license.html
  8. use strict;
  9. use warnings;
  10. use POSIX;
  11. use File::Basename;
  12. use File::Copy;
  13. use OpenSSL::Test qw/:DEFAULT with bldtop_file srctop_file cmdstr/;
  14. use OpenSSL::Test::Utils;
  15. setup("test_ssl");
  16. $ENV{CTLOG_FILE} = srctop_file("test", "ct", "log_list.conf");
  17. my ($no_rsa, $no_dsa, $no_dh, $no_ec, $no_psk,
  18. $no_ssl3, $no_tls1, $no_tls1_1, $no_tls1_2, $no_tls1_3,
  19. $no_dtls, $no_dtls1, $no_dtls1_2, $no_ct) =
  20. anydisabled qw/rsa dsa dh ec psk
  21. ssl3 tls1 tls1_1 tls1_2 tls1_3
  22. dtls dtls1 dtls1_2 ct/;
  23. my $no_anytls = alldisabled(available_protocols("tls"));
  24. my $no_anydtls = alldisabled(available_protocols("dtls"));
  25. plan skip_all => "No SSL/TLS/DTLS protocol is support by this OpenSSL build"
  26. if $no_anytls && $no_anydtls;
  27. my $digest = "-sha1";
  28. my @reqcmd = ("openssl", "req");
  29. my @x509cmd = ("openssl", "x509", $digest);
  30. my @verifycmd = ("openssl", "verify");
  31. my @gendsacmd = ("openssl", "gendsa");
  32. my $dummycnf = srctop_file("apps", "openssl.cnf");
  33. my $CAkey = "keyCA.ss";
  34. my $CAcert="certCA.ss";
  35. my $CAserial="certCA.srl";
  36. my $CAreq="reqCA.ss";
  37. my $CAconf=srctop_file("test","CAss.cnf");
  38. my $CAreq2="req2CA.ss"; # temp
  39. my $Uconf=srctop_file("test","Uss.cnf");
  40. my $Ukey="keyU.ss";
  41. my $Ureq="reqU.ss";
  42. my $Ucert="certU.ss";
  43. my $Dkey="keyD.ss";
  44. my $Dreq="reqD.ss";
  45. my $Dcert="certD.ss";
  46. my $Ekey="keyE.ss";
  47. my $Ereq="reqE.ss";
  48. my $Ecert="certE.ss";
  49. my $P1conf=srctop_file("test","P1ss.cnf");
  50. my $P1key="keyP1.ss";
  51. my $P1req="reqP1.ss";
  52. my $P1cert="certP1.ss";
  53. my $P1intermediate="tmp_intP1.ss";
  54. my $P2conf=srctop_file("test","P2ss.cnf");
  55. my $P2key="keyP2.ss";
  56. my $P2req="reqP2.ss";
  57. my $P2cert="certP2.ss";
  58. my $P2intermediate="tmp_intP2.ss";
  59. my $server_sess="server.ss";
  60. my $client_sess="client.ss";
  61. # ssltest_old.c is deprecated in favour of the new framework in ssl_test.c
  62. # If you're adding tests here, you probably want to convert them to the
  63. # new format in ssl_test.c and add recipes to 80-test_ssl_new.t instead.
  64. plan tests =>
  65. 1 # For testss
  66. +5 # For the first testssl
  67. ;
  68. subtest 'test_ss' => sub {
  69. if (testss()) {
  70. open OUT, ">", "intP1.ss";
  71. copy($CAcert, \*OUT); copy($Ucert, \*OUT);
  72. close OUT;
  73. open OUT, ">", "intP2.ss";
  74. copy($CAcert, \*OUT); copy($Ucert, \*OUT); copy($P1cert, \*OUT);
  75. close OUT;
  76. }
  77. };
  78. note('test_ssl -- key U');
  79. testssl("keyU.ss", $Ucert, $CAcert);
  80. # -----------
  81. # subtest functions
  82. sub testss {
  83. open RND, ">>", ".rnd";
  84. print RND "string to make the random number generator think it has randomness";
  85. close RND;
  86. my @req_dsa = ("-newkey",
  87. "dsa:".srctop_file("apps", "dsa1024.pem"));
  88. my $dsaparams = srctop_file("apps", "dsa1024.pem");
  89. my @req_new;
  90. if ($no_rsa) {
  91. @req_new = @req_dsa;
  92. } else {
  93. @req_new = ("-new");
  94. }
  95. plan tests => 17;
  96. SKIP: {
  97. skip 'failure', 16 unless
  98. ok(run(app([@reqcmd, "-config", $CAconf,
  99. "-out", $CAreq, "-keyout", $CAkey,
  100. @req_new])),
  101. 'make cert request');
  102. skip 'failure', 15 unless
  103. ok(run(app([@x509cmd, "-CAcreateserial", "-in", $CAreq, "-days", "30",
  104. "-req", "-out", $CAcert, "-signkey", $CAkey,
  105. "-extfile", $CAconf, "-extensions", "v3_ca"],
  106. stdout => "err.ss")),
  107. 'convert request into self-signed cert');
  108. skip 'failure', 14 unless
  109. ok(run(app([@x509cmd, "-in", $CAcert,
  110. "-x509toreq", "-signkey", $CAkey, "-out", $CAreq2],
  111. stdout => "err.ss")),
  112. 'convert cert into a cert request');
  113. skip 'failure', 13 unless
  114. ok(run(app([@reqcmd, "-config", $dummycnf,
  115. "-verify", "-in", $CAreq, "-noout"])),
  116. 'verify request 1');
  117. skip 'failure', 12 unless
  118. ok(run(app([@reqcmd, "-config", $dummycnf,
  119. "-verify", "-in", $CAreq2, "-noout"])),
  120. 'verify request 2');
  121. skip 'failure', 11 unless
  122. ok(run(app([@verifycmd, "-CAfile", $CAcert, $CAcert])),
  123. 'verify signature');
  124. skip 'failure', 10 unless
  125. ok(run(app([@reqcmd, "-config", $Uconf,
  126. "-out", $Ureq, "-keyout", $Ukey, @req_new],
  127. stdout => "err.ss")),
  128. 'make a user cert request');
  129. skip 'failure', 9 unless
  130. ok(run(app([@x509cmd, "-CAcreateserial", "-in", $Ureq, "-days", "30",
  131. "-req", "-out", $Ucert,
  132. "-CA", $CAcert, "-CAkey", $CAkey, "-CAserial", $CAserial,
  133. "-extfile", $Uconf, "-extensions", "v3_ee"],
  134. stdout => "err.ss"))
  135. && run(app([@verifycmd, "-CAfile", $CAcert, $Ucert])),
  136. 'sign user cert request');
  137. skip 'failure', 8 unless
  138. ok(run(app([@x509cmd,
  139. "-subject", "-issuer", "-startdate", "-enddate",
  140. "-noout", "-in", $Ucert])),
  141. 'Certificate details');
  142. skip 'failure', 7 unless
  143. subtest 'DSA certificate creation' => sub {
  144. plan skip_all => "skipping DSA certificate creation"
  145. if $no_dsa;
  146. plan tests => 5;
  147. SKIP: {
  148. $ENV{CN2} = "DSA Certificate";
  149. skip 'failure', 4 unless
  150. ok(run(app([@gendsacmd, "-out", $Dkey,
  151. $dsaparams],
  152. stdout => "err.ss")),
  153. "make a DSA key");
  154. skip 'failure', 3 unless
  155. ok(run(app([@reqcmd, "-new", "-config", $Uconf,
  156. "-out", $Dreq, "-key", $Dkey],
  157. stdout => "err.ss")),
  158. "make a DSA user cert request");
  159. skip 'failure', 2 unless
  160. ok(run(app([@x509cmd, "-CAcreateserial",
  161. "-in", $Dreq,
  162. "-days", "30",
  163. "-req",
  164. "-out", $Dcert,
  165. "-CA", $CAcert, "-CAkey", $CAkey,
  166. "-CAserial", $CAserial,
  167. "-extfile", $Uconf,
  168. "-extensions", "v3_ee_dsa"],
  169. stdout => "err.ss")),
  170. "sign DSA user cert request");
  171. skip 'failure', 1 unless
  172. ok(run(app([@verifycmd, "-CAfile", $CAcert, $Dcert])),
  173. "verify DSA user cert");
  174. skip 'failure', 0 unless
  175. ok(run(app([@x509cmd,
  176. "-subject", "-issuer",
  177. "-startdate", "-enddate", "-noout",
  178. "-in", $Dcert])),
  179. "DSA Certificate details");
  180. }
  181. };
  182. skip 'failure', 6 unless
  183. subtest 'ECDSA/ECDH certificate creation' => sub {
  184. plan skip_all => "skipping ECDSA/ECDH certificate creation"
  185. if $no_ec;
  186. plan tests => 5;
  187. SKIP: {
  188. $ENV{CN2} = "ECDSA Certificate";
  189. skip 'failure', 4 unless
  190. ok(run(app(["openssl", "ecparam", "-name", "P-256",
  191. "-out", "ecp.ss"])),
  192. "make EC parameters");
  193. skip 'failure', 3 unless
  194. ok(run(app([@reqcmd, "-config", $Uconf,
  195. "-out", $Ereq, "-keyout", $Ekey,
  196. "-newkey", "ec:ecp.ss"],
  197. stdout => "err.ss")),
  198. "make a ECDSA/ECDH user cert request");
  199. skip 'failure', 2 unless
  200. ok(run(app([@x509cmd, "-CAcreateserial",
  201. "-in", $Ereq,
  202. "-days", "30",
  203. "-req",
  204. "-out", $Ecert,
  205. "-CA", $CAcert, "-CAkey", $CAkey,
  206. "-CAserial", $CAserial,
  207. "-extfile", $Uconf,
  208. "-extensions", "v3_ee_ec"],
  209. stdout => "err.ss")),
  210. "sign ECDSA/ECDH user cert request");
  211. skip 'failure', 1 unless
  212. ok(run(app([@verifycmd, "-CAfile", $CAcert, $Ecert])),
  213. "verify ECDSA/ECDH user cert");
  214. skip 'failure', 0 unless
  215. ok(run(app([@x509cmd,
  216. "-subject", "-issuer",
  217. "-startdate", "-enddate", "-noout",
  218. "-in", $Ecert])),
  219. "ECDSA Certificate details");
  220. }
  221. };
  222. skip 'failure', 5 unless
  223. ok(run(app([@reqcmd, "-config", $P1conf,
  224. "-out", $P1req, "-keyout", $P1key, @req_new],
  225. stdout => "err.ss")),
  226. 'make a proxy cert request');
  227. skip 'failure', 4 unless
  228. ok(run(app([@x509cmd, "-CAcreateserial", "-in", $P1req, "-days", "30",
  229. "-req", "-out", $P1cert,
  230. "-CA", $Ucert, "-CAkey", $Ukey,
  231. "-extfile", $P1conf, "-extensions", "v3_proxy"],
  232. stdout => "err.ss")),
  233. 'sign proxy with user cert');
  234. copy($Ucert, $P1intermediate);
  235. run(app([@verifycmd, "-CAfile", $CAcert,
  236. "-untrusted", $P1intermediate, $P1cert]));
  237. ok(run(app([@x509cmd,
  238. "-subject", "-issuer", "-startdate", "-enddate",
  239. "-noout", "-in", $P1cert])),
  240. 'Certificate details');
  241. skip 'failure', 2 unless
  242. ok(run(app([@reqcmd, "-config", $P2conf,
  243. "-out", $P2req, "-keyout", $P2key,
  244. @req_new],
  245. stdout => "err.ss")),
  246. 'make another proxy cert request');
  247. skip 'failure', 1 unless
  248. ok(run(app([@x509cmd, "-CAcreateserial", "-in", $P2req, "-days", "30",
  249. "-req", "-out", $P2cert,
  250. "-CA", $P1cert, "-CAkey", $P1key,
  251. "-extfile", $P2conf, "-extensions", "v3_proxy"],
  252. stdout => "err.ss")),
  253. 'sign second proxy cert request with the first proxy cert');
  254. open OUT, ">", $P2intermediate;
  255. copy($Ucert, \*OUT); copy($P1cert, \*OUT);
  256. close OUT;
  257. run(app([@verifycmd, "-CAfile", $CAcert,
  258. "-untrusted", $P2intermediate, $P2cert]));
  259. ok(run(app([@x509cmd,
  260. "-subject", "-issuer", "-startdate", "-enddate",
  261. "-noout", "-in", $P2cert])),
  262. 'Certificate details');
  263. }
  264. }
  265. sub testssl {
  266. my ($key, $cert, $CAtmp) = @_;
  267. my @CA = $CAtmp ? ("-CAfile", $CAtmp) : ("-CApath", bldtop_dir("certs"));
  268. my @ssltest = ("ssltest_old",
  269. "-s_key", $key, "-s_cert", $cert,
  270. "-c_key", $key, "-c_cert", $cert);
  271. my $serverinfo = srctop_file("test","serverinfo.pem");
  272. my $dsa_cert = 0;
  273. if (grep /DSA Public Key/, run(app(["openssl", "x509", "-in", $cert,
  274. "-text", "-noout"]), capture => 1)) {
  275. $dsa_cert = 1;
  276. }
  277. # plan tests => 11;
  278. subtest 'standard SSL tests' => sub {
  279. ######################################################################
  280. plan tests => 13;
  281. SKIP: {
  282. skip "SSLv3 is not supported by this OpenSSL build", 4
  283. if disabled("ssl3");
  284. ok(run(test([@ssltest, "-bio_pair", "-ssl3"])),
  285. 'test sslv3 via BIO pair');
  286. ok(run(test([@ssltest, "-bio_pair", "-ssl3", "-server_auth", @CA])),
  287. 'test sslv3 with server authentication via BIO pair');
  288. ok(run(test([@ssltest, "-bio_pair", "-ssl3", "-client_auth", @CA])),
  289. 'test sslv3 with client authentication via BIO pair');
  290. ok(run(test([@ssltest, "-bio_pair", "-ssl3", "-server_auth", "-client_auth", @CA])),
  291. 'test sslv3 with both server and client authentication via BIO pair');
  292. }
  293. SKIP: {
  294. skip "Neither SSLv3 nor any TLS version are supported by this OpenSSL build", 1
  295. if $no_anytls;
  296. ok(run(test([@ssltest, "-bio_pair"])),
  297. 'test sslv2/sslv3 via BIO pair');
  298. }
  299. SKIP: {
  300. skip "Neither SSLv3 nor any TLS version are supported by this OpenSSL build", 8
  301. if $no_anytls;
  302. SKIP: {
  303. skip "skipping test of sslv2/sslv3 w/o (EC)DHE test", 1 if $dsa_cert;
  304. ok(run(test([@ssltest, "-bio_pair", "-no_dhe", "-no_ecdhe"])),
  305. 'test sslv2/sslv3 w/o (EC)DHE via BIO pair');
  306. }
  307. ok(run(test([@ssltest, "-bio_pair", "-dhe1024dsa", "-v"])),
  308. 'test sslv2/sslv3 with 1024bit DHE via BIO pair');
  309. ok(run(test([@ssltest, "-bio_pair", "-server_auth", @CA])),
  310. 'test sslv2/sslv3 with server authentication');
  311. ok(run(test([@ssltest, "-bio_pair", "-client_auth", @CA])),
  312. 'test sslv2/sslv3 with client authentication via BIO pair');
  313. ok(run(test([@ssltest, "-bio_pair", "-server_auth", "-client_auth", @CA])),
  314. 'test sslv2/sslv3 with both client and server authentication via BIO pair');
  315. ok(run(test([@ssltest, "-bio_pair", "-server_auth", "-client_auth", "-app_verify", @CA])),
  316. 'test sslv2/sslv3 with both client and server authentication via BIO pair and app verify');
  317. SKIP: {
  318. skip "No IPv4 available on this machine", 1
  319. unless !disabled("sock") && have_IPv4();
  320. ok(run(test([@ssltest, "-ipv4"])),
  321. 'test TLS via IPv4');
  322. }
  323. SKIP: {
  324. skip "No IPv6 available on this machine", 1
  325. unless !disabled("sock") && have_IPv6();
  326. ok(run(test([@ssltest, "-ipv6"])),
  327. 'test TLS via IPv6');
  328. }
  329. }
  330. };
  331. subtest "Testing ciphersuites" => sub {
  332. my @exkeys = ();
  333. my $ciphers = "-PSK:-SRP";
  334. if (!$no_dsa) {
  335. push @exkeys, "-s_cert", "certD.ss", "-s_key", "keyD.ss";
  336. }
  337. if (!$no_ec) {
  338. push @exkeys, "-s_cert", "certE.ss", "-s_key", "keyE.ss";
  339. }
  340. my @protocols = ();
  341. # We only use the flags that ssltest_old understands
  342. push @protocols, "-tls1_3" unless $no_tls1_3;
  343. push @protocols, "-tls1_2" unless $no_tls1_2;
  344. push @protocols, "-tls1" unless $no_tls1;
  345. push @protocols, "-ssl3" unless $no_ssl3;
  346. my $protocolciphersuitecount = 0;
  347. my %ciphersuites = ();
  348. my %ciphersstatus = ();
  349. foreach my $protocol (@protocols) {
  350. my $ciphersstatus = undef;
  351. my @ciphers = run(app(["openssl", "ciphers", "-s", $protocol,
  352. "ALL:$ciphers"]),
  353. capture => 1, statusvar => \$ciphersstatus);
  354. $ciphersstatus{$protocol} = $ciphersstatus;
  355. if ($ciphersstatus) {
  356. $ciphersuites{$protocol} = [ map { s|\R||; split(/:/, $_) }
  357. @ciphers ];
  358. $protocolciphersuitecount += scalar @{$ciphersuites{$protocol}};
  359. }
  360. }
  361. plan skip_all => "None of the ciphersuites to test are available in this OpenSSL build"
  362. if $protocolciphersuitecount + scalar(keys %ciphersuites) == 0;
  363. # The count of protocols is because in addition to the ciphersuites
  364. # we got above, we're running a weak DH test for each protocol (except
  365. # TLSv1.3)
  366. my $testcount = scalar(@protocols) + $protocolciphersuitecount
  367. + scalar(keys %ciphersuites);
  368. $testcount-- unless $no_tls1_3;
  369. plan tests => $testcount;
  370. foreach my $protocol (@protocols) {
  371. ok($ciphersstatus{$protocol}, "Getting ciphers for $protocol");
  372. }
  373. foreach my $protocol (sort keys %ciphersuites) {
  374. note "Testing ciphersuites for $protocol";
  375. # ssltest_old doesn't know -tls1_3, but that's fine, since that's
  376. # the default choice if TLSv1.3 enabled
  377. my $flag = $protocol eq "-tls1_3" ? "" : $protocol;
  378. my $ciphersuites = "";
  379. foreach my $cipher (@{$ciphersuites{$protocol}}) {
  380. if ($protocol eq "-ssl3" && $cipher =~ /ECDH/ ) {
  381. note "*****SKIPPING $protocol $cipher";
  382. ok(1);
  383. } else {
  384. if ($protocol eq "-tls1_3") {
  385. $ciphersuites = $cipher;
  386. $cipher = "";
  387. }
  388. ok(run(test([@ssltest, @exkeys, "-cipher", $cipher,
  389. "-ciphersuites", $ciphersuites, $flag || ()])),
  390. "Testing $cipher");
  391. }
  392. }
  393. next if $protocol eq "-tls1_3";
  394. is(run(test([@ssltest,
  395. "-s_cipher", "EDH",
  396. "-c_cipher", 'EDH:@SECLEVEL=1',
  397. "-dhe512",
  398. $protocol])), 0,
  399. "testing connection with weak DH, expecting failure");
  400. }
  401. };
  402. subtest 'RSA/(EC)DHE/PSK tests' => sub {
  403. ######################################################################
  404. plan tests => 10;
  405. SKIP: {
  406. skip "TLSv1.0 is not supported by this OpenSSL build", 6
  407. if $no_tls1;
  408. SKIP: {
  409. skip "skipping anonymous DH tests", 1
  410. if ($no_dh);
  411. ok(run(test([@ssltest, "-v", "-bio_pair", "-tls1", "-cipher", "ADH", "-dhe1024dsa", "-num", "10", "-f", "-time"])),
  412. 'test tlsv1 with 1024bit anonymous DH, multiple handshakes');
  413. }
  414. SKIP: {
  415. skip "skipping RSA tests", 2
  416. if $no_rsa;
  417. ok(run(test(["ssltest_old", "-v", "-bio_pair", "-tls1", "-s_cert", srctop_file("apps","server2.pem"), "-no_dhe", "-no_ecdhe", "-num", "10", "-f", "-time"])),
  418. 'test tlsv1 with 1024bit RSA, no (EC)DHE, multiple handshakes');
  419. skip "skipping RSA+DHE tests", 1
  420. if $no_dh;
  421. ok(run(test(["ssltest_old", "-v", "-bio_pair", "-tls1", "-s_cert", srctop_file("apps","server2.pem"), "-dhe1024dsa", "-num", "10", "-f", "-time"])),
  422. 'test tlsv1 with 1024bit RSA, 1024bit DHE, multiple handshakes');
  423. }
  424. SKIP: {
  425. skip "skipping PSK tests", 2
  426. if ($no_psk);
  427. ok(run(test([@ssltest, "-tls1", "-cipher", "PSK", "-psk", "abc123"])),
  428. 'test tls1 with PSK');
  429. ok(run(test([@ssltest, "-bio_pair", "-tls1", "-cipher", "PSK", "-psk", "abc123"])),
  430. 'test tls1 with PSK via BIO pair');
  431. }
  432. SKIP: {
  433. skip "skipping auto PSK tests", 1
  434. if ($no_dh || $no_psk || $no_ec);
  435. ok(run(test(['ssltest_old', '-dhe2048', '-psk', '0102030405', '-cipher', '@SECLEVEL=2:DHE-PSK-AES128-CCM'])),
  436. 'test auto DH meets security strength');
  437. }
  438. }
  439. SKIP: {
  440. skip "TLSv1.1 is not supported by this OpenSSL build", 4
  441. if $no_tls1_1;
  442. SKIP: {
  443. skip "skipping auto DHE PSK test at SECLEVEL 3", 1
  444. if ($no_dh || $no_psk);
  445. ok(run(test(['ssltest_old', '-tls1_1', '-dhe4096', '-psk', '0102030405', '-cipher', '@SECLEVEL=3:DHE-PSK-AES256-CBC-SHA384'])),
  446. 'test auto DHE PSK meets security strength');
  447. }
  448. SKIP: {
  449. skip "skipping auto ECDHE PSK test at SECLEVEL 3", 1
  450. if ($no_ec || $no_psk);
  451. ok(run(test(['ssltest_old', '-tls1_1', '-no_dhe', '-psk', '0102030405', '-cipher', '@SECLEVEL=3:ECDHE-PSK-AES256-CBC-SHA384'])),
  452. 'test auto ECDHE PSK meets security strength');
  453. }
  454. SKIP: {
  455. skip "skipping no RSA PSK at SECLEVEL 3 test", 1
  456. if ($no_rsa || $no_psk);
  457. ok(!run(test(['ssltest_old', '-tls1_1', '-no_dhe', '-psk', '0102030405', '-cipher', '@SECLEVEL=3:RSA-PSK-AES256-CBC-SHA384'])),
  458. 'test auto RSA PSK does not meet security level 3 requirements (PFS)');
  459. }
  460. SKIP: {
  461. skip "skipping no PSK at SECLEVEL 3 test", 1
  462. if ($no_psk);
  463. ok(!run(test(['ssltest_old', '-tls1_1', '-no_dhe', '-psk', '0102030405', '-cipher', '@SECLEVEL=3:PSK-AES256-CBC-SHA384'])),
  464. 'test auto PSK does not meet security level 3 requirements (PFS)');
  465. }
  466. }
  467. };
  468. subtest 'Custom Extension tests' => sub {
  469. ######################################################################
  470. plan tests => 1;
  471. SKIP: {
  472. skip "TLSv1.0 is not supported by this OpenSSL build", 1
  473. if $no_tls1;
  474. ok(run(test([@ssltest, "-bio_pair", "-tls1", "-custom_ext"])),
  475. 'test tls1 with custom extensions');
  476. }
  477. };
  478. subtest 'Serverinfo tests' => sub {
  479. ######################################################################
  480. plan tests => 5;
  481. SKIP: {
  482. skip "TLSv1.0 is not supported by this OpenSSL build", 5
  483. if $no_tls1;
  484. note('echo test tls1 with serverinfo');
  485. ok(run(test([@ssltest, "-bio_pair", "-tls1", "-serverinfo_file", $serverinfo])));
  486. ok(run(test([@ssltest, "-bio_pair", "-tls1", "-serverinfo_file", $serverinfo, "-serverinfo_sct"])));
  487. ok(run(test([@ssltest, "-bio_pair", "-tls1", "-serverinfo_file", $serverinfo, "-serverinfo_tack"])));
  488. ok(run(test([@ssltest, "-bio_pair", "-tls1", "-serverinfo_file", $serverinfo, "-serverinfo_sct", "-serverinfo_tack"])));
  489. ok(run(test([@ssltest, "-bio_pair", "-tls1", "-custom_ext", "-serverinfo_file", $serverinfo, "-serverinfo_sct", "-serverinfo_tack"])));
  490. }
  491. };
  492. }
  493. unlink $CAkey;
  494. unlink $CAcert;
  495. unlink $CAserial;
  496. unlink $CAreq;
  497. unlink $CAreq2;
  498. unlink $Ukey;
  499. unlink $Ureq;
  500. unlink $Ucert;
  501. unlink basename($Ucert, '.ss').'.srl';
  502. unlink $Dkey;
  503. unlink $Dreq;
  504. unlink $Dcert;
  505. unlink $Ekey;
  506. unlink $Ereq;
  507. unlink $Ecert;
  508. unlink $P1key;
  509. unlink $P1req;
  510. unlink $P1cert;
  511. unlink basename($P1cert, '.ss').'.srl';
  512. unlink $P1intermediate;
  513. unlink "intP1.ss";
  514. unlink $P2key;
  515. unlink $P2req;
  516. unlink $P2cert;
  517. unlink $P2intermediate;
  518. unlink "intP2.ss";
  519. unlink "ecp.ss";
  520. unlink "err.ss";
  521. unlink $server_sess;
  522. unlink $client_sess;