]> git.ipfire.org Git - thirdparty/openssl.git/blame - test/ssl-tests/20-cert-select.cnf.in
Reduce the security bits for MD5 and SHA1 based signatures in TLS
[thirdparty/openssl.git] / test / ssl-tests / 20-cert-select.cnf.in
CommitLineData
edb8a5eb
DSH
1# -*- mode: perl; -*-
2
3## SSL test configurations
4
edb8a5eb
DSH
5
6use strict;
7use warnings;
8
53f08737
DSH
9package ssltests;
10use OpenSSL::Test::Utils;
edb8a5eb 11
682bc861
MC
12our $fips_mode;
13our $no_deflt_libctx;
14
15my $server;
16
17if ($fips_mode) {
18 #TODO(3.0): No EdDSA support in FIPS mode at the moment
19 $server = {
20 "ECDSA.Certificate" => test_pem("server-ecdsa-cert.pem"),
21 "ECDSA.PrivateKey" => test_pem("server-ecdsa-key.pem"),
22 "MaxProtocol" => "TLSv1.2"
23 };
24} else {
25 $server = {
26 "ECDSA.Certificate" => test_pem("server-ecdsa-cert.pem"),
27 "ECDSA.PrivateKey" => test_pem("server-ecdsa-key.pem"),
28 "Ed25519.Certificate" => test_pem("server-ed25519-cert.pem"),
29 "Ed25519.PrivateKey" => test_pem("server-ed25519-key.pem"),
30 "Ed448.Certificate" => test_pem("server-ed448-cert.pem"),
31 "Ed448.PrivateKey" => test_pem("server-ed448-key.pem"),
32 "MaxProtocol" => "TLSv1.2"
33 };
34}
edb8a5eb 35
800c4883
DSH
36my $server_pss = {
37 "PSS.Certificate" => test_pem("server-pss-cert.pem"),
38 "PSS.PrivateKey" => test_pem("server-pss-key.pem"),
39 "ECDSA.Certificate" => test_pem("server-ecdsa-cert.pem"),
40 "ECDSA.PrivateKey" => test_pem("server-ecdsa-key.pem"),
fe93b010
MC
41 "Ed25519.Certificate" => test_pem("server-ed25519-cert.pem"),
42 "Ed25519.PrivateKey" => test_pem("server-ed25519-key.pem"),
43 "Ed448.Certificate" => test_pem("server-ed448-cert.pem"),
44 "Ed448.PrivateKey" => test_pem("server-ed448-key.pem"),
800c4883
DSH
45 "MaxProtocol" => "TLSv1.2"
46};
47
48my $server_pss_only = {
49 "Certificate" => test_pem("server-pss-cert.pem"),
50 "PrivateKey" => test_pem("server-pss-key.pem"),
51};
52
20946b94
MC
53my $server_pss_restrict_only = {
54 "Certificate" => test_pem("server-pss-restrict-cert.pem"),
55 "PrivateKey" => test_pem("server-pss-restrict-key.pem"),
56};
57
ab5a02f7 58my $server_rsa_all;
20946b94 59
682bc861 60if ($no_deflt_libctx) {
ab5a02f7
MC
61 $server_rsa_all = {
62 "Certificate" => test_pem("servercert.pem"),
63 "PrivateKey" => test_pem("serverkey.pem"),
64 };
65} else {
66 $server_rsa_all = {
67 "PSS.Certificate" => test_pem("server-pss-cert.pem"),
68 "PSS.PrivateKey" => test_pem("server-pss-key.pem"),
69 "Certificate" => test_pem("servercert.pem"),
70 "PrivateKey" => test_pem("serverkey.pem"),
71 };
72}
b2c4909c 73
edb8a5eb
DSH
74our @tests = (
75 {
76 name => "ECDSA CipherString Selection",
77 server => $server,
78 client => {
79 "CipherString" => "aECDSA",
aafec89c 80 "MaxProtocol" => "TLSv1.2",
25a9fabb 81 "RequestCAFile" => test_pem("root-cert.pem"),
edb8a5eb
DSH
82 },
83 test => {
84 "ExpectedServerCertType" =>, "P-256",
a92e710b 85 "ExpectedServerSignType" =>, "EC",
25a9fabb
DSH
86 # Note: certificate_authorities not sent for TLS < 1.3
87 "ExpectedServerCANames" =>, "empty",
edb8a5eb
DSH
88 "ExpectedResult" => "Success"
89 },
90 },
dcf8b01f
MC
91 {
92 name => "ECDSA CipherString Selection",
93 server => {
94 "ECDSA.Certificate" => test_pem("server-ecdsa-cert.pem"),
95 "ECDSA.PrivateKey" => test_pem("server-ecdsa-key.pem"),
96 "MaxProtocol" => "TLSv1.2",
97 #Deliberately set supported_groups to one not in the cert. This
98 #should be tolerated
99 "Groups" => "P-384"
100 },
101 client => {
102 "CipherString" => "aECDSA",
103 "MaxProtocol" => "TLSv1.2",
104 "Groups" => "P-256:P-384",
105 "RequestCAFile" => test_pem("root-cert.pem"),
106 },
107 test => {
108 "ExpectedServerCertType" =>, "P-256",
109 "ExpectedServerSignType" =>, "EC",
110 # Note: certificate_authorities not sent for TLS < 1.3
111 "ExpectedServerCANames" =>, "empty",
112 "ExpectedResult" => "Success"
113 },
114 },
115 {
116 name => "ECDSA CipherString Selection",
117 server => {
118 "ECDSA.Certificate" => test_pem("server-ecdsa-cert.pem"),
119 "ECDSA.PrivateKey" => test_pem("server-ecdsa-key.pem"),
120 "MaxProtocol" => "TLSv1.2",
121 "Groups" => "P-256:P-384"
122 },
123 client => {
124 "CipherString" => "aECDSA",
125 "MaxProtocol" => "TLSv1.2",
126 #Deliberately set groups to not include the certificate group. This
127 #should fail
128 "Groups" => "P-384",
129 "RequestCAFile" => test_pem("root-cert.pem"),
130 },
131 test => {
132 "ExpectedResult" => "ServerFail"
133 },
134 },
edb8a5eb
DSH
135 {
136 name => "RSA CipherString Selection",
137 server => $server,
138 client => {
139 "CipherString" => "aRSA",
aafec89c 140 "MaxProtocol" => "TLSv1.2",
edb8a5eb
DSH
141 },
142 test => {
143 "ExpectedServerCertType" =>, "RSA",
a92e710b 144 "ExpectedServerSignType" =>, "RSA-PSS",
edb8a5eb
DSH
145 "ExpectedResult" => "Success"
146 },
147 },
50a3a1f0
DSH
148 {
149 name => "P-256 CipherString and Signature Algorithm Selection",
150 server => $server,
151 client => {
152 "CipherString" => "aECDSA",
153 "MaxProtocol" => "TLSv1.2",
154 "SignatureAlgorithms" => "ECDSA+SHA256:ed25519",
155 },
156 test => {
157 "ExpectedServerCertType" => "P-256",
158 "ExpectedServerSignHash" => "SHA256",
159 "ExpectedServerSignType" => "EC",
160 "ExpectedResult" => "Success"
161 },
162 },
edb8a5eb
DSH
163 {
164 name => "ECDSA CipherString Selection, no ECDSA certificate",
0e2c7b3e
DSH
165 server => {
166 "MaxProtocol" => "TLSv1.2"
167 },
edb8a5eb 168 client => {
aafec89c
MC
169 "CipherString" => "aECDSA",
170 "MaxProtocol" => "TLSv1.2"
edb8a5eb
DSH
171 },
172 test => {
173 "ExpectedResult" => "ServerFail"
174 },
175 },
176 {
177 name => "ECDSA Signature Algorithm Selection",
178 server => $server,
179 client => {
180 "SignatureAlgorithms" => "ECDSA+SHA256",
181 },
182 test => {
062540cb
DSH
183 "ExpectedServerCertType" => "P-256",
184 "ExpectedServerSignHash" => "SHA256",
a92e710b 185 "ExpectedServerSignType" => "EC",
edb8a5eb
DSH
186 "ExpectedResult" => "Success"
187 },
188 },
53f08737
DSH
189 {
190 name => "ECDSA Signature Algorithm Selection SHA384",
191 server => $server,
192 client => {
193 "SignatureAlgorithms" => "ECDSA+SHA384",
194 },
195 test => {
196 "ExpectedServerCertType" => "P-256",
197 "ExpectedServerSignHash" => "SHA384",
198 "ExpectedServerSignType" => "EC",
199 "ExpectedResult" => "Success"
200 },
201 },
c749308f
DSH
202 {
203 name => "ECDSA Signature Algorithm Selection SHA1",
aba03ae5
KR
204 server => {
205 "CipherString" => "DEFAULT:\@SECLEVEL=0",
206 "ECDSA.Certificate" => test_pem("server-ecdsa-cert.pem"),
207 "ECDSA.PrivateKey" => test_pem("server-ecdsa-key.pem"),
208 "Ed25519.Certificate" => test_pem("server-ed25519-cert.pem"),
209 "Ed25519.PrivateKey" => test_pem("server-ed25519-key.pem"),
210 "Ed448.Certificate" => test_pem("server-ed448-cert.pem"),
211 "Ed448.PrivateKey" => test_pem("server-ed448-key.pem"),
212 "MaxProtocol" => "TLSv1.2"
213 },
c749308f 214 client => {
aba03ae5 215 "CipherString" => "DEFAULT:\@SECLEVEL=0",
c749308f
DSH
216 "SignatureAlgorithms" => "ECDSA+SHA1",
217 },
218 test => {
219 "ExpectedServerCertType" => "P-256",
220 "ExpectedServerSignHash" => "SHA1",
221 "ExpectedServerSignType" => "EC",
222 "ExpectedResult" => "Success"
223 },
224 },
225 {
226 name => "ECDSA Signature Algorithm Selection compressed point",
227 server => {
228 "ECDSA.Certificate" => test_pem("server-cecdsa-cert.pem"),
229 "ECDSA.PrivateKey" => test_pem("server-cecdsa-key.pem"),
230 "MaxProtocol" => "TLSv1.2"
231 },
232 client => {
233 "SignatureAlgorithms" => "ECDSA+SHA256",
234 },
235 test => {
236 "ExpectedServerCertType" => "P-256",
237 "ExpectedServerSignHash" => "SHA256",
238 "ExpectedServerSignType" => "EC",
239 "ExpectedResult" => "Success"
240 },
241 },
edb8a5eb
DSH
242 {
243 name => "ECDSA Signature Algorithm Selection, no ECDSA certificate",
0e2c7b3e
DSH
244 server => {
245 "MaxProtocol" => "TLSv1.2"
246 },
edb8a5eb
DSH
247 client => {
248 "SignatureAlgorithms" => "ECDSA+SHA256",
249 },
250 test => {
251 "ExpectedResult" => "ServerFail"
252 },
253 },
254 {
255 name => "RSA Signature Algorithm Selection",
256 server => $server,
257 client => {
258 "SignatureAlgorithms" => "RSA+SHA256",
259 },
260 test => {
062540cb
DSH
261 "ExpectedServerCertType" => "RSA",
262 "ExpectedServerSignHash" => "SHA256",
a92e710b
DSH
263 "ExpectedServerSignType" => "RSA",
264 "ExpectedResult" => "Success"
265 },
266 },
267 {
268 name => "RSA-PSS Signature Algorithm Selection",
269 server => $server,
270 client => {
271 "SignatureAlgorithms" => "RSA-PSS+SHA256",
272 },
273 test => {
274 "ExpectedServerCertType" => "RSA",
275 "ExpectedServerSignHash" => "SHA256",
276 "ExpectedServerSignType" => "RSA-PSS",
edb8a5eb
DSH
277 "ExpectedResult" => "Success"
278 },
9f577cdd 279 },
ab5a02f7
MC
280 {
281 name => "RSA key exchange with all RSA certificate types",
282 server => $server_rsa_all,
283 client => {
284 "CipherString" => "kRSA",
285 "MaxProtocol" => "TLSv1.2",
286 },
287 test => {
288 "ExpectedServerCertType" =>, "RSA",
289 "ExpectedResult" => "Success"
290 },
291 },
292 {
293 name => "Suite B P-256 Hash Algorithm Selection",
294 server => {
295 "ECDSA.Certificate" => test_pem("p256-server-cert.pem"),
296 "ECDSA.PrivateKey" => test_pem("p256-server-key.pem"),
297 "MaxProtocol" => "TLSv1.2",
298 "CipherString" => "SUITEB128"
299 },
300 client => {
301 "VerifyCAFile" => test_pem("p384-root.pem"),
302 "SignatureAlgorithms" => "ECDSA+SHA384:ECDSA+SHA256"
303 },
304 test => {
305 "ExpectedServerCertType" => "P-256",
306 "ExpectedServerSignHash" => "SHA256",
307 "ExpectedServerSignType" => "EC",
308 "ExpectedResult" => "Success"
309 },
310 },
311 {
312 name => "Suite B P-384 Hash Algorithm Selection",
313 server => {
314 "ECDSA.Certificate" => test_pem("p384-server-cert.pem"),
315 "ECDSA.PrivateKey" => test_pem("p384-server-key.pem"),
316 "MaxProtocol" => "TLSv1.2",
317 "CipherString" => "SUITEB128"
318 },
319 client => {
320 "VerifyCAFile" => test_pem("p384-root.pem"),
321 "SignatureAlgorithms" => "ECDSA+SHA256:ECDSA+SHA384"
322 },
323 test => {
324 "ExpectedServerCertType" => "P-384",
325 "ExpectedServerSignHash" => "SHA384",
326 "ExpectedServerSignType" => "EC",
327 "ExpectedResult" => "Success"
328 },
329 },
682bc861
MC
330);
331
332my @tests_non_fips = (
333 # TODO(3.0) No Ed25519/Ed448 in FIPS mode at the moment
334 {
335 name => "Ed25519 CipherString and Signature Algorithm Selection",
336 server => $server,
337 client => {
338 "CipherString" => "aECDSA",
339 "MaxProtocol" => "TLSv1.2",
340 "SignatureAlgorithms" => "ed25519:ECDSA+SHA256",
341 "RequestCAFile" => test_pem("root-cert.pem"),
342 },
343 test => {
344 "ExpectedServerCertType" =>, "Ed25519",
345 "ExpectedServerSignType" =>, "Ed25519",
346 # Note: certificate_authorities not sent for TLS < 1.3
347 "ExpectedServerCANames" =>, "empty",
348 "ExpectedResult" => "Success"
349 },
350 },
351 {
352 name => "Ed448 CipherString and Signature Algorithm Selection",
353 server => $server,
354 client => {
355 "CipherString" => "aECDSA",
356 "MaxProtocol" => "TLSv1.2",
357 "SignatureAlgorithms" => "ed448:ECDSA+SHA256",
358 "RequestCAFile" => test_pem("root-ed448-cert.pem"),
359 "VerifyCAFile" => test_pem("root-ed448-cert.pem"),
360 },
361 test => {
362 "ExpectedServerCertType" =>, "Ed448",
363 "ExpectedServerSignType" =>, "Ed448",
364 # Note: certificate_authorities not sent for TLS < 1.3
365 "ExpectedServerCANames" =>, "empty",
366 "ExpectedResult" => "Success"
367 },
368 },
369 {
370 name => "ECDSA with brainpool",
371 server => {
372 "Certificate" => test_pem("server-ecdsa-brainpoolP256r1-cert.pem"),
373 "PrivateKey" => test_pem("server-ecdsa-brainpoolP256r1-key.pem"),
374 "Groups" => "brainpoolP256r1",
375 },
376 client => {
377 #We don't restrict this to TLSv1.2, although use of brainpool
378 #should force this anyway so that this should succeed
379 "CipherString" => "aECDSA",
380 "RequestCAFile" => test_pem("root-cert.pem"),
381 "Groups" => "brainpoolP256r1",
382 },
383 test => {
384 "ExpectedServerCertType" =>, "brainpoolP256r1",
385 "ExpectedServerSignType" =>, "EC",
386 # Note: certificate_authorities not sent for TLS < 1.3
387 "ExpectedServerCANames" =>, "empty",
388 "ExpectedResult" => "Success"
389 },
390 },
391 {
392 name => "Ed25519 CipherString and Curves Selection",
393 server => $server,
394 client => {
395 "CipherString" => "aECDSA",
396 "MaxProtocol" => "TLSv1.2",
397 "SignatureAlgorithms" => "ECDSA+SHA256:ed25519",
398 # Excluding P-256 from the supported curves list means server
399 # certificate should be Ed25519 and not P-256
400 "Curves" => "X25519"
401 },
402 test => {
403 "ExpectedServerCertType" =>, "Ed25519",
404 "ExpectedServerSignType" =>, "Ed25519",
405 "ExpectedResult" => "Success"
406 },
407 },
408 {
409 name => "Ed448 CipherString and Curves Selection",
410 server => $server,
411 client => {
412 "CipherString" => "aECDSA",
413 "MaxProtocol" => "TLSv1.2",
414 "SignatureAlgorithms" => "ECDSA+SHA256:ed448",
415 "VerifyCAFile" => test_pem("root-ed448-cert.pem"),
416 # Excluding P-256 from the supported curves list means server
417 # certificate should be Ed25519 and not P-256
418 "Curves" => "X448"
419 },
420 test => {
421 "ExpectedServerCertType" =>, "Ed448",
422 "ExpectedServerSignType" =>, "Ed448",
423 "ExpectedResult" => "Success"
424 },
425 },
ab5a02f7
MC
426 {
427 name => "TLS 1.2 Ed25519 Client Auth",
428 server => {
429 "VerifyCAFile" => test_pem("root-cert.pem"),
430 "VerifyMode" => "Require"
431 },
432 client => {
433 "Ed25519.Certificate" => test_pem("client-ed25519-cert.pem"),
434 "Ed25519.PrivateKey" => test_pem("client-ed25519-key.pem"),
435 "MinProtocol" => "TLSv1.2",
436 "MaxProtocol" => "TLSv1.2"
437 },
438 test => {
439 "ExpectedClientCertType" => "Ed25519",
440 "ExpectedClientSignType" => "Ed25519",
441 "ExpectedResult" => "Success"
442 },
443 },
444 {
445 name => "TLS 1.2 Ed448 Client Auth",
446 server => {
447 "VerifyCAFile" => test_pem("root-cert.pem"),
448 "VerifyMode" => "Require"
449 },
450 client => {
451 "Ed448.Certificate" => test_pem("client-ed448-cert.pem"),
452 "Ed448.PrivateKey" => test_pem("client-ed448-key.pem"),
453 "MinProtocol" => "TLSv1.2",
454 "MaxProtocol" => "TLSv1.2"
455 },
456 test => {
457 "ExpectedClientCertType" => "Ed448",
458 "ExpectedClientSignType" => "Ed448",
459 "ExpectedResult" => "Success"
460 },
461 },
462);
463
464my @tests_pss = (
465 {
466 name => "RSA-PSS Certificate CipherString Selection",
467 server => $server_pss,
468 client => {
469 "CipherString" => "aRSA",
470 "MaxProtocol" => "TLSv1.2",
471 },
472 test => {
473 "ExpectedServerCertType" =>, "RSA-PSS",
474 "ExpectedServerSignType" =>, "RSA-PSS",
475 "ExpectedResult" => "Success"
476 },
477 },
800c4883 478 {
f55e99f7 479 name => "RSA-PSS Certificate Legacy Signature Algorithm Selection",
800c4883
DSH
480 server => $server_pss,
481 client => {
482 "SignatureAlgorithms" => "RSA-PSS+SHA256",
483 },
f55e99f7
BK
484 test => {
485 "ExpectedServerCertType" => "RSA",
486 "ExpectedServerSignHash" => "SHA256",
487 "ExpectedServerSignType" => "RSA-PSS",
488 "ExpectedResult" => "Success"
489 },
490 },
491 {
492 name => "RSA-PSS Certificate Unified Signature Algorithm Selection",
493 server => $server_pss,
494 client => {
495 "SignatureAlgorithms" => "rsa_pss_pss_sha256",
496 },
800c4883
DSH
497 test => {
498 "ExpectedServerCertType" => "RSA-PSS",
499 "ExpectedServerSignHash" => "SHA256",
500 "ExpectedServerSignType" => "RSA-PSS",
501 "ExpectedResult" => "Success"
502 },
503 },
504 {
505 name => "Only RSA-PSS Certificate",
506 server => $server_pss_only,
507 client => {},
508 test => {
509 "ExpectedServerCertType" => "RSA-PSS",
510 "ExpectedServerSignHash" => "SHA256",
511 "ExpectedServerSignType" => "RSA-PSS",
512 "ExpectedResult" => "Success"
513 },
514 },
20946b94
MC
515 {
516 name => "Only RSA-PSS Certificate Valid Signature Algorithms",
517 server => $server_pss_only,
518 client => {
519 "SignatureAlgorithms" => "rsa_pss_pss_sha512",
520 },
521 test => {
522 "ExpectedServerCertType" => "RSA-PSS",
523 "ExpectedServerSignHash" => "SHA512",
524 "ExpectedServerSignType" => "RSA-PSS",
525 "ExpectedResult" => "Success"
526 },
527 },
800c4883
DSH
528 {
529 name => "RSA-PSS Certificate, no PSS signature algorithms",
530 server => $server_pss_only,
531 client => {
532 "SignatureAlgorithms" => "RSA+SHA256",
533 },
534 test => {
535 "ExpectedResult" => "ServerFail"
536 },
537 },
20946b94
MC
538 {
539 name => "Only RSA-PSS Restricted Certificate",
540 server => $server_pss_restrict_only,
541 client => {},
542 test => {
543 "ExpectedServerCertType" => "RSA-PSS",
544 "ExpectedServerSignHash" => "SHA256",
545 "ExpectedServerSignType" => "RSA-PSS",
546 "ExpectedResult" => "Success"
547 },
548 },
549 {
550 name => "RSA-PSS Restricted Certificate Valid Signature Algorithms",
551 server => $server_pss_restrict_only,
552 client => {
553 "SignatureAlgorithms" => "rsa_pss_pss_sha256:rsa_pss_pss_sha512",
554 },
555 test => {
556 "ExpectedServerCertType" => "RSA-PSS",
557 "ExpectedServerSignHash" => "SHA256",
558 "ExpectedServerSignType" => "RSA-PSS",
559 "ExpectedResult" => "Success"
560 },
561 },
562 {
563 name => "RSA-PSS Restricted Cert client prefers invalid Signature Algorithm",
564 server => $server_pss_restrict_only,
565 client => {
566 "SignatureAlgorithms" => "rsa_pss_pss_sha512:rsa_pss_pss_sha256",
567 },
568 test => {
569 "ExpectedServerCertType" => "RSA-PSS",
570 "ExpectedServerSignHash" => "SHA256",
571 "ExpectedServerSignType" => "RSA-PSS",
572 "ExpectedResult" => "Success"
573 },
574 },
575 {
576 name => "RSA-PSS Restricted Certificate Invalid Signature Algorithms",
577 server => $server_pss_restrict_only,
578 client => {
579 "SignatureAlgorithms" => "rsa_pss_pss_sha512",
580 },
581 test => {
582 "ExpectedResult" => "ServerFail"
583 },
584 },
b2c4909c
MC
585 {
586 name => "RSA key exchange with only RSA-PSS certificate",
587 server => $server_pss_only,
588 client => {
589 "CipherString" => "kRSA",
590 "MaxProtocol" => "TLSv1.2",
591 },
592 test => {
593 "ExpectedResult" => "ServerFail"
594 },
595 },
edb8a5eb 596);
53f08737 597
b7ab4eee
MC
598my @tests_tls_1_1 = (
599 {
600 name => "Only RSA-PSS Certificate, TLS v1.1",
601 server => $server_pss_only,
602 client => {
603 "MaxProtocol" => "TLSv1.1",
604 },
605 test => {
606 "ExpectedResult" => "ServerFail"
607 },
608 },
609);
610
682bc861 611push @tests, @tests_non_fips unless $fips_mode;
f63f3b72 612push @tests, @tests_pss;
682bc861 613push @tests, @tests_tls_1_1 unless disabled("tls1_1") || $no_deflt_libctx;
b7ab4eee 614
682bc861
MC
615my $server_tls_1_3;
616
617if ($fips_mode) {
618 $server_tls_1_3 = {
619 "ECDSA.Certificate" => test_pem("server-ecdsa-cert.pem"),
620 "ECDSA.PrivateKey" => test_pem("server-ecdsa-key.pem"),
621 "MinProtocol" => "TLSv1.3",
622 "MaxProtocol" => "TLSv1.3"
623 };
624} else {
625 $server_tls_1_3 = {
626 "ECDSA.Certificate" => test_pem("server-ecdsa-cert.pem"),
627 "ECDSA.PrivateKey" => test_pem("server-ecdsa-key.pem"),
628 "Ed25519.Certificate" => test_pem("server-ed25519-cert.pem"),
629 "Ed25519.PrivateKey" => test_pem("server-ed25519-key.pem"),
630 "Ed448.Certificate" => test_pem("server-ed448-cert.pem"),
631 "Ed448.PrivateKey" => test_pem("server-ed448-key.pem"),
632 "MinProtocol" => "TLSv1.3",
633 "MaxProtocol" => "TLSv1.3"
634 };
635}
800c4883 636
86de658a 637my $client_tls_1_3 = {
31b238ad
DSH
638 "RSA.Certificate" => test_pem("ee-client-chain.pem"),
639 "RSA.PrivateKey" => test_pem("ee-key.pem"),
640 "ECDSA.Certificate" => test_pem("ee-ecdsa-client-chain.pem"),
641 "ECDSA.PrivateKey" => test_pem("ee-ecdsa-key.pem"),
53f08737
DSH
642 "MinProtocol" => "TLSv1.3",
643 "MaxProtocol" => "TLSv1.3"
644};
645
646my @tests_tls_1_3 = (
647 {
648 name => "TLS 1.3 ECDSA Signature Algorithm Selection",
649 server => $server_tls_1_3,
650 client => {
651 "SignatureAlgorithms" => "ECDSA+SHA256",
652 },
653 test => {
654 "ExpectedServerCertType" => "P-256",
655 "ExpectedServerSignHash" => "SHA256",
656 "ExpectedServerSignType" => "EC",
25a9fabb 657 "ExpectedServerCANames" => "empty",
53f08737
DSH
658 "ExpectedResult" => "Success"
659 },
660 },
c749308f
DSH
661 {
662 name => "TLS 1.3 ECDSA Signature Algorithm Selection compressed point",
663 server => {
664 "ECDSA.Certificate" => test_pem("server-cecdsa-cert.pem"),
665 "ECDSA.PrivateKey" => test_pem("server-cecdsa-key.pem"),
666 "MinProtocol" => "TLSv1.3",
667 "MaxProtocol" => "TLSv1.3"
668 },
669 client => {
670 "SignatureAlgorithms" => "ECDSA+SHA256",
671 },
672 test => {
7500bc33
MC
673 "ExpectedServerCertType" => "P-256",
674 "ExpectedServerSignHash" => "SHA256",
675 "ExpectedServerSignType" => "EC",
676 "ExpectedServerCANames" => "empty",
677 "ExpectedResult" => "Success"
c749308f
DSH
678 },
679 },
680 {
681 name => "TLS 1.3 ECDSA Signature Algorithm Selection SHA1",
aba03ae5
KR
682 server => {
683 "CipherString" => "DEFAULT:\@SECLEVEL=0",
684 "ECDSA.Certificate" => test_pem("server-ecdsa-cert.pem"),
685 "ECDSA.PrivateKey" => test_pem("server-ecdsa-key.pem"),
686 "Ed25519.Certificate" => test_pem("server-ed25519-cert.pem"),
687 "Ed25519.PrivateKey" => test_pem("server-ed25519-key.pem"),
688 "Ed448.Certificate" => test_pem("server-ed448-cert.pem"),
689 "Ed448.PrivateKey" => test_pem("server-ed448-key.pem"),
690 "MinProtocol" => "TLSv1.3",
691 "MaxProtocol" => "TLSv1.3"
692 },
c749308f 693 client => {
aba03ae5 694 "CipherString" => "DEFAULT:\@SECLEVEL=0",
c749308f
DSH
695 "SignatureAlgorithms" => "ECDSA+SHA1",
696 },
697 test => {
698 "ExpectedResult" => "ServerFail"
699 },
700 },
53f08737
DSH
701 {
702 name => "TLS 1.3 ECDSA Signature Algorithm Selection with PSS",
703 server => $server_tls_1_3,
704 client => {
705 "SignatureAlgorithms" => "ECDSA+SHA256:RSA-PSS+SHA256",
25a9fabb 706 "RequestCAFile" => test_pem("root-cert.pem"),
53f08737
DSH
707 },
708 test => {
709 "ExpectedServerCertType" => "P-256",
710 "ExpectedServerSignHash" => "SHA256",
711 "ExpectedServerSignType" => "EC",
25a9fabb 712 "ExpectedServerCANames" => test_pem("root-cert.pem"),
53f08737
DSH
713 "ExpectedResult" => "Success"
714 },
715 },
716 {
717 name => "TLS 1.3 RSA Signature Algorithm Selection SHA384 with PSS",
718 server => $server_tls_1_3,
719 client => {
720 "SignatureAlgorithms" => "ECDSA+SHA384:RSA-PSS+SHA384",
721 },
722 test => {
723 "ExpectedServerCertType" => "RSA",
724 "ExpectedServerSignHash" => "SHA384",
725 "ExpectedServerSignType" => "RSA-PSS",
726 "ExpectedResult" => "Success"
727 },
728 },
729 {
730 name => "TLS 1.3 ECDSA Signature Algorithm Selection, no ECDSA certificate",
0e2c7b3e
DSH
731 server => {
732 "MinProtocol" => "TLSv1.3",
733 "MaxProtocol" => "TLSv1.3"
734 },
53f08737
DSH
735 client => {
736 "SignatureAlgorithms" => "ECDSA+SHA256",
737 },
738 test => {
739 "ExpectedResult" => "ServerFail"
740 },
741 },
742 {
743 name => "TLS 1.3 RSA Signature Algorithm Selection, no PSS",
744 server => $server_tls_1_3,
745 client => {
746 "SignatureAlgorithms" => "RSA+SHA256",
747 },
748 test => {
749 "ExpectedResult" => "ServerFail"
750 },
751 },
752 {
753 name => "TLS 1.3 RSA-PSS Signature Algorithm Selection",
754 server => $server_tls_1_3,
755 client => {
756 "SignatureAlgorithms" => "RSA-PSS+SHA256",
757 },
758 test => {
759 "ExpectedServerCertType" => "RSA",
760 "ExpectedServerSignHash" => "SHA256",
761 "ExpectedServerSignType" => "RSA-PSS",
762 "ExpectedResult" => "Success"
763 },
86de658a 764 },
682bc861
MC
765 {
766 name => "TLS 1.3 RSA Client Auth Signature Algorithm Selection",
767 server => {
768 "ClientSignatureAlgorithms" => "PSS+SHA256",
769 "VerifyCAFile" => test_pem("root-cert.pem"),
770 "VerifyMode" => "Require"
771 },
772 client => $client_tls_1_3,
773 test => {
774 "ExpectedClientCertType" => "RSA",
775 "ExpectedClientSignHash" => "SHA256",
776 "ExpectedClientSignType" => "RSA-PSS",
777 "ExpectedClientCANames" => "empty",
778 "ExpectedResult" => "Success"
779 },
780 },
781 {
782 name => "TLS 1.3 RSA Client Auth Signature Algorithm Selection non-empty CA Names",
783 server => {
784 "ClientSignatureAlgorithms" => "PSS+SHA256",
785 "VerifyCAFile" => test_pem("root-cert.pem"),
786 "RequestCAFile" => test_pem("root-cert.pem"),
787 "VerifyMode" => "Require"
788 },
789 client => $client_tls_1_3,
790 test => {
791 "ExpectedClientCertType" => "RSA",
792 "ExpectedClientSignHash" => "SHA256",
793 "ExpectedClientSignType" => "RSA-PSS",
794 "ExpectedClientCANames" => test_pem("root-cert.pem"),
795 "ExpectedResult" => "Success"
796 },
797 },
798 {
799 name => "TLS 1.3 ECDSA Client Auth Signature Algorithm Selection",
800 server => {
801 "ClientSignatureAlgorithms" => "ECDSA+SHA256",
802 "VerifyCAFile" => test_pem("root-cert.pem"),
803 "VerifyMode" => "Require"
804 },
805 client => $client_tls_1_3,
806 test => {
807 "ExpectedClientCertType" => "P-256",
808 "ExpectedClientSignHash" => "SHA256",
809 "ExpectedClientSignType" => "EC",
810 "ExpectedResult" => "Success"
811 },
812 },
813);
814
815my @tests_tls_1_3_non_fips = (
fbe1af9d
DSH
816 {
817 name => "TLS 1.3 Ed25519 Signature Algorithm Selection",
818 server => $server_tls_1_3,
819 client => {
820 "SignatureAlgorithms" => "ed25519",
821 },
822 test => {
823 "ExpectedServerCertType" => "Ed25519",
824 "ExpectedServerSignType" => "Ed25519",
825 "ExpectedResult" => "Success"
826 },
827 },
fe93b010
MC
828 {
829 name => "TLS 1.3 Ed448 Signature Algorithm Selection",
830 server => $server_tls_1_3,
831 client => {
832 "SignatureAlgorithms" => "ed448",
77c4d397 833 "VerifyCAFile" => test_pem("root-ed448-cert.pem"),
fe93b010
MC
834 },
835 test => {
836 "ExpectedServerCertType" => "Ed448",
837 "ExpectedServerSignType" => "Ed448",
838 "ExpectedResult" => "Success"
839 },
840 },
50a3a1f0
DSH
841 {
842 name => "TLS 1.3 Ed25519 CipherString and Groups Selection",
843 server => $server_tls_1_3,
844 client => {
845 "SignatureAlgorithms" => "ECDSA+SHA256:ed25519",
846 # Excluding P-256 from the supported groups list should
847 # mean server still uses a P-256 certificate because supported
848 # groups is not used in signature selection for TLS 1.3
849 "Groups" => "X25519"
850 },
851 test => {
852 "ExpectedServerCertType" =>, "P-256",
853 "ExpectedServerSignType" =>, "EC",
854 "ExpectedResult" => "Success"
855 },
856 },
fe93b010
MC
857 {
858 name => "TLS 1.3 Ed448 CipherString and Groups Selection",
859 server => $server_tls_1_3,
860 client => {
861 "SignatureAlgorithms" => "ECDSA+SHA256:ed448",
862 # Excluding P-256 from the supported groups list should
863 # mean server still uses a P-256 certificate because supported
864 # groups is not used in signature selection for TLS 1.3
865 "Groups" => "X448"
866 },
867 test => {
868 "ExpectedServerCertType" =>, "P-256",
869 "ExpectedServerSignType" =>, "EC",
870 "ExpectedResult" => "Success"
871 },
872 },
fbe1af9d
DSH
873 {
874 name => "TLS 1.3 Ed25519 Client Auth",
875 server => {
876 "VerifyCAFile" => test_pem("root-cert.pem"),
877 "VerifyMode" => "Require"
878 },
879 client => {
880 "EdDSA.Certificate" => test_pem("client-ed25519-cert.pem"),
881 "EdDSA.PrivateKey" => test_pem("client-ed25519-key.pem"),
882 "MinProtocol" => "TLSv1.3",
883 "MaxProtocol" => "TLSv1.3"
884 },
885 test => {
886 "ExpectedClientCertType" => "Ed25519",
887 "ExpectedClientSignType" => "Ed25519",
888 "ExpectedResult" => "Success"
889 },
890 },
fe93b010
MC
891 {
892 name => "TLS 1.3 Ed448 Client Auth",
893 server => {
894 "VerifyCAFile" => test_pem("root-cert.pem"),
895 "VerifyMode" => "Require"
896 },
897 client => {
898 "EdDSA.Certificate" => test_pem("client-ed448-cert.pem"),
899 "EdDSA.PrivateKey" => test_pem("client-ed448-key.pem"),
900 "MinProtocol" => "TLSv1.3",
901 "MaxProtocol" => "TLSv1.3"
902 },
903 test => {
904 "ExpectedClientCertType" => "Ed448",
905 "ExpectedClientSignType" => "Ed448",
906 "ExpectedResult" => "Success"
907 },
908 },
24ae0038
MC
909 {
910 name => "TLS 1.3 ECDSA with brainpool",
911 server => {
912 "Certificate" => test_pem("server-ecdsa-brainpoolP256r1-cert.pem"),
913 "PrivateKey" => test_pem("server-ecdsa-brainpoolP256r1-key.pem"),
24ae0038
MC
914 },
915 client => {
916 "RequestCAFile" => test_pem("root-cert.pem"),
24ae0038
MC
917 "MinProtocol" => "TLSv1.3",
918 "MaxProtocol" => "TLSv1.3"
919 },
920 test => {
921 "ExpectedResult" => "ServerFail"
922 },
923 },
53f08737
DSH
924);
925
926push @tests, @tests_tls_1_3 unless disabled("tls1_3");
682bc861 927push @tests, @tests_tls_1_3_non_fips unless disabled("tls1_3") || $fips_mode;
7a08b764
DSH
928
929my @tests_dsa_tls_1_2 = (
930 {
931 name => "TLS 1.2 DSA Certificate Test",
932 server => {
933 "DSA.Certificate" => test_pem("server-dsa-cert.pem"),
934 "DSA.PrivateKey" => test_pem("server-dsa-key.pem"),
935 "DHParameters" => test_pem("dhp2048.pem"),
936 "MinProtocol" => "TLSv1.2",
937 "MaxProtocol" => "TLSv1.2",
938 "CipherString" => "ALL",
939 },
940 client => {
941 "SignatureAlgorithms" => "DSA+SHA256:DSA+SHA1",
942 "CipherString" => "ALL",
943 },
944 test => {
945 "ExpectedResult" => "Success"
946 },
947 },
948);
949
950my @tests_dsa_tls_1_3 = (
81813776
BK
951 {
952 name => "TLS 1.3 Client Auth No TLS 1.3 Signature Algorithms",
953 server => {
954 "ClientSignatureAlgorithms" => "ECDSA+SHA1:DSA+SHA256:RSA+SHA256",
955 "VerifyCAFile" => test_pem("root-cert.pem"),
956 "VerifyMode" => "Request"
957 },
958 client => {},
959 test => {
960 "ExpectedResult" => "ServerFail"
961 },
962 },
7a08b764
DSH
963 {
964 name => "TLS 1.3 DSA Certificate Test",
965 server => {
966 "DSA.Certificate" => test_pem("server-dsa-cert.pem"),
967 "DSA.PrivateKey" => test_pem("server-dsa-key.pem"),
968 "MinProtocol" => "TLSv1.3",
969 "MaxProtocol" => "TLSv1.3",
970 "CipherString" => "ALL",
971 },
972 client => {
8336ca13 973 "SignatureAlgorithms" => "DSA+SHA1:DSA+SHA256:ECDSA+SHA256",
7a08b764
DSH
974 "CipherString" => "ALL",
975 },
976 test => {
977 "ExpectedResult" => "ServerFail"
978 },
979 },
980);
981
982if (!disabled("dsa")) {
682bc861
MC
983 #TODO(3.0): Temporary workaround for DH issues in FIPS. Needs investigation
984 push @tests, @tests_dsa_tls_1_2 unless disabled("dh") || $fips_mode;
7a08b764
DSH
985 push @tests, @tests_dsa_tls_1_3 unless disabled("tls1_3");
986}