05-sni.cnf.in 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. # -*- mode: perl; -*-
  2. # Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.
  3. #
  4. # Licensed under the Apache License 2.0 (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. ## SSL test configurations
  9. use strict;
  10. use warnings;
  11. package ssltests;
  12. use OpenSSL::Test::Utils;
  13. our $fips_mode;
  14. our @tests = (
  15. {
  16. name => "SNI-switch-context",
  17. server => {
  18. extra => {
  19. "ServerNameCallback" => "IgnoreMismatch",
  20. },
  21. },
  22. client => {
  23. extra => {
  24. "ServerName" => "server2",
  25. },
  26. },
  27. test => {
  28. "ExpectedServerName" => "server2",
  29. "ExpectedResult" => "Success"
  30. },
  31. },
  32. {
  33. name => "SNI-keep-context",
  34. server => {
  35. extra => {
  36. "ServerNameCallback" => "IgnoreMismatch",
  37. },
  38. },
  39. client => {
  40. extra => {
  41. "ServerName" => "server1",
  42. },
  43. },
  44. test => {
  45. "ExpectedServerName" => "server1",
  46. "ExpectedResult" => "Success"
  47. },
  48. },
  49. {
  50. name => "SNI-no-server-support",
  51. server => { },
  52. client => {
  53. extra => {
  54. "ServerName" => "server1",
  55. },
  56. },
  57. test => { "ExpectedResult" => "Success" },
  58. },
  59. {
  60. name => "SNI-no-client-support",
  61. server => {
  62. extra => {
  63. "ServerNameCallback" => "IgnoreMismatch",
  64. },
  65. },
  66. client => { },
  67. test => {
  68. # We expect that the callback is still called
  69. # to let the application decide whether they tolerate
  70. # missing SNI (as our test callback does).
  71. "ExpectedServerName" => "server1",
  72. "ExpectedResult" => "Success"
  73. },
  74. },
  75. {
  76. name => "SNI-bad-sni-ignore-mismatch",
  77. server => {
  78. extra => {
  79. "ServerNameCallback" => "IgnoreMismatch",
  80. },
  81. },
  82. client => {
  83. extra => {
  84. "ServerName" => "invalid",
  85. },
  86. },
  87. test => {
  88. "ExpectedServerName" => "server1",
  89. "ExpectedResult" => "Success"
  90. },
  91. },
  92. {
  93. name => "SNI-bad-sni-reject-mismatch",
  94. server => {
  95. extra => {
  96. "ServerNameCallback" => "RejectMismatch",
  97. },
  98. },
  99. client => {
  100. extra => {
  101. "ServerName" => "invalid",
  102. },
  103. },
  104. test => {
  105. "ExpectedResult" => "ServerFail",
  106. "ExpectedServerAlert" => "UnrecognizedName"
  107. },
  108. },
  109. {
  110. name => "SNI-bad-clienthello-sni-ignore-mismatch",
  111. server => {
  112. extra => {
  113. "ServerNameCallback" => "ClientHelloIgnoreMismatch",
  114. },
  115. },
  116. client => {
  117. extra => {
  118. "ServerName" => "invalid",
  119. },
  120. },
  121. test => {
  122. "ExpectedServerName" => "server1",
  123. "ExpectedResult" => "Success"
  124. },
  125. },
  126. {
  127. name => "SNI-bad-clienthello-sni-reject-mismatch",
  128. server => {
  129. extra => {
  130. "ServerNameCallback" => "ClientHelloRejectMismatch",
  131. },
  132. },
  133. client => {
  134. extra => {
  135. "ServerName" => "invalid",
  136. },
  137. },
  138. test => {
  139. "ExpectedResult" => "ServerFail",
  140. "ExpectedServerAlert" => "UnrecognizedName"
  141. },
  142. },
  143. );
  144. our @tests_tls_1_1 = (
  145. {
  146. name => "SNI-clienthello-disable-v12",
  147. server => {
  148. "CipherString" => "DEFAULT:\@SECLEVEL=0",
  149. extra => {
  150. "ServerNameCallback" => "ClientHelloNoV12",
  151. },
  152. },
  153. client => {
  154. "CipherString" => "DEFAULT:\@SECLEVEL=0",
  155. extra => {
  156. "ServerName" => "server2",
  157. },
  158. },
  159. test => {
  160. "ExpectedProtocol" => "TLSv1.1",
  161. "ExpectedServerName" => "server2",
  162. },
  163. },
  164. );
  165. push @tests, @tests_tls_1_1 unless disabled("tls1_1") || $fips_mode;