06-sni-ticket.conf.in 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. # -*- mode: perl; -*-
  2. # Copyright 2016-2016 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. ## Test SNI/Session tickets
  9. use strict;
  10. use warnings;
  11. package ssltests;
  12. our @tests = ();
  13. #Note: MaxProtocol is set to TLSv1.2 as session tickets work differently in
  14. #TLSv1.3.
  15. sub generate_tests() {
  16. foreach my $c ("SessionTicket", "-SessionTicket") {
  17. foreach my $s1 ("SessionTicket", "-SessionTicket") {
  18. foreach my $s2 ("SessionTicket", "-SessionTicket") {
  19. foreach my $n ("server1", "server2") {
  20. my $result = expected_result($c, $s1, $s2, $n);
  21. push @tests, {
  22. "name" => "sni-session-ticket",
  23. "client" => {
  24. "Options" => $c,
  25. "extra" => {
  26. "ServerName" => $n,
  27. },
  28. "MaxProtocol" => "TLSv1.2"
  29. },
  30. "server" => {
  31. "Options" => $s1,
  32. "extra" => {
  33. # We don't test mismatch here.
  34. "ServerNameCallback" => "IgnoreMismatch",
  35. },
  36. },
  37. "server2" => {
  38. "Options" => $s2,
  39. },
  40. "test" => {
  41. "ExpectedServerName" => $n,
  42. "ExpectedResult" => "Success",
  43. "SessionTicketExpected" => $result,
  44. }
  45. };
  46. }
  47. }
  48. }
  49. }
  50. }
  51. # If the client has session tickets disabled, then No support
  52. # If the server initial_ctx has session tickets disabled, then No support
  53. # If SNI is in use, then if the "switched-to" context has session tickets disabled,
  54. # then No support
  55. sub expected_result {
  56. my ($c, $s1, $s2, $n) = @_;
  57. return "No" if $c eq "-SessionTicket";
  58. return "No" if $s1 eq "-SessionTicket";
  59. return "No" if ($s2 eq "-SessionTicket" && $n eq "server2");
  60. return "Yes";
  61. }
  62. # Add a "Broken" case.
  63. push @tests, {
  64. "name" => "sni-session-ticket",
  65. "client" => {
  66. "MaxProtocol" => "TLSv1.2",
  67. "Options" => "SessionTicket",
  68. "extra" => {
  69. "ServerName" => "server1",
  70. }
  71. },
  72. "server" => {
  73. "Options" => "SessionTicket",
  74. "extra" => {
  75. "BrokenSessionTicket" => "Yes",
  76. },
  77. },
  78. "server2" => {
  79. "Options" => "SessionTicket",
  80. },
  81. "test" => {
  82. "ExpectedResult" => "Success",
  83. "SessionTicketExpected" => "No",
  84. }
  85. };
  86. generate_tests();