2
0

09-alpn.cnf.in 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  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. ## Test version negotiation
  9. use strict;
  10. use warnings;
  11. package ssltests;
  12. our @tests = (
  13. {
  14. name => "alpn-simple",
  15. server => {
  16. extra => {
  17. "ALPNProtocols" => "foo",
  18. },
  19. },
  20. client => {
  21. extra => {
  22. "ALPNProtocols" => "foo",
  23. },
  24. },
  25. test => {
  26. "ExpectedALPNProtocol" => "foo",
  27. },
  28. },
  29. {
  30. name => "alpn-server-finds-match",
  31. server => {
  32. extra => {
  33. "ALPNProtocols" => "baz,bar",
  34. },
  35. },
  36. client => {
  37. extra => {
  38. "ALPNProtocols" => "foo,bar",
  39. },
  40. },
  41. test => {
  42. "ExpectedALPNProtocol" => "bar",
  43. },
  44. },
  45. {
  46. name => "alpn-server-honours-server-pref",
  47. server => {
  48. extra => {
  49. "ALPNProtocols" => "bar,foo",
  50. },
  51. },
  52. client => {
  53. extra => {
  54. "ALPNProtocols" => "foo,bar",
  55. },
  56. },
  57. test => {
  58. "ExpectedALPNProtocol" => "bar",
  59. },
  60. },
  61. {
  62. name => "alpn-alert-on-mismatch",
  63. server => {
  64. extra => {
  65. "ALPNProtocols" => "baz",
  66. },
  67. },
  68. client => {
  69. extra => {
  70. "ALPNProtocols" => "foo,bar",
  71. },
  72. },
  73. test => {
  74. "ExpectedResult" => "ServerFail",
  75. "ExpectedServerAlert" => "NoApplicationProtocol",
  76. },
  77. },
  78. {
  79. name => "alpn-no-server-support",
  80. server => { },
  81. client => {
  82. extra => {
  83. "ALPNProtocols" => "foo",
  84. },
  85. },
  86. test => {
  87. "ExpectedALPNProtocol" => undef,
  88. },
  89. },
  90. {
  91. name => "alpn-no-client-support",
  92. server => {
  93. extra => {
  94. "ALPNProtocols" => "foo",
  95. },
  96. },
  97. client => { },
  98. test => {
  99. "ExpectedALPNProtocol" => undef,
  100. },
  101. },
  102. {
  103. name => "alpn-with-sni-no-context-switch",
  104. server => {
  105. extra => {
  106. "ALPNProtocols" => "foo",
  107. "ServerNameCallback" => "IgnoreMismatch",
  108. },
  109. },
  110. server2 => {
  111. extra => {
  112. "ALPNProtocols" => "bar",
  113. },
  114. },
  115. client => {
  116. extra => {
  117. "ALPNProtocols" => "foo,bar",
  118. "ServerName" => "server1",
  119. },
  120. },
  121. test => {
  122. "ExpectedServerName" => "server1",
  123. "ExpectedALPNProtocol" => "foo",
  124. },
  125. },
  126. {
  127. name => "alpn-with-sni-context-switch",
  128. server => {
  129. extra => {
  130. "ALPNProtocols" => "foo",
  131. "ServerNameCallback" => "IgnoreMismatch",
  132. },
  133. },
  134. server2 => {
  135. extra => {
  136. "ALPNProtocols" => "bar",
  137. },
  138. },
  139. client => {
  140. extra => {
  141. "ALPNProtocols" => "foo,bar",
  142. "ServerName" => "server2",
  143. },
  144. },
  145. test => {
  146. "ExpectedServerName" => "server2",
  147. "ExpectedALPNProtocol" => "bar",
  148. },
  149. },
  150. {
  151. name => "alpn-selected-sni-server-supports-alpn",
  152. server => {
  153. extra => {
  154. "ServerNameCallback" => "IgnoreMismatch",
  155. },
  156. },
  157. server2 => {
  158. extra => {
  159. "ALPNProtocols" => "bar",
  160. },
  161. },
  162. client => {
  163. extra => {
  164. "ALPNProtocols" => "foo,bar",
  165. "ServerName" => "server2",
  166. },
  167. },
  168. test => {
  169. "ExpectedServerName" => "server2",
  170. "ExpectedALPNProtocol" => "bar",
  171. },
  172. },
  173. {
  174. name => "alpn-selected-sni-server-does-not-support-alpn",
  175. server => {
  176. extra => {
  177. "ALPNProtocols" => "bar",
  178. "ServerNameCallback" => "IgnoreMismatch",
  179. },
  180. },
  181. server2 => { },
  182. client => {
  183. extra => {
  184. "ALPNProtocols" => "foo,bar",
  185. "ServerName" => "server2",
  186. },
  187. },
  188. test => {
  189. "ExpectedServerName" => "server2",
  190. "ExpectedALPNProtocol" => undef,
  191. },
  192. },
  193. {
  194. name => "alpn-simple-resumption",
  195. server => {
  196. extra => {
  197. "ALPNProtocols" => "foo",
  198. },
  199. },
  200. client => {
  201. extra => {
  202. "ALPNProtocols" => "foo",
  203. },
  204. },
  205. test => {
  206. "HandshakeMode" => "Resume",
  207. "ResumptionExpected" => "Yes",
  208. "ExpectedALPNProtocol" => "foo",
  209. },
  210. },
  211. {
  212. name => "alpn-server-switch-resumption",
  213. server => {
  214. extra => {
  215. "ALPNProtocols" => "bar,foo",
  216. },
  217. },
  218. resume_server => {
  219. extra => {
  220. "ALPNProtocols" => "baz,foo",
  221. },
  222. },
  223. client => {
  224. extra => {
  225. "ALPNProtocols" => "foo,bar,baz",
  226. },
  227. },
  228. test => {
  229. "HandshakeMode" => "Resume",
  230. "ResumptionExpected" => "Yes",
  231. "ExpectedALPNProtocol" => "baz",
  232. },
  233. },
  234. {
  235. name => "alpn-client-switch-resumption",
  236. server => {
  237. extra => {
  238. "ALPNProtocols" => "foo,bar,baz",
  239. },
  240. },
  241. client => {
  242. extra => {
  243. "ALPNProtocols" => "foo,baz",
  244. },
  245. },
  246. resume_client => {
  247. extra => {
  248. "ALPNProtocols" => "bar,baz",
  249. },
  250. },
  251. test => {
  252. "HandshakeMode" => "Resume",
  253. "ResumptionExpected" => "Yes",
  254. "ExpectedALPNProtocol" => "bar",
  255. },
  256. },
  257. {
  258. name => "alpn-alert-on-mismatch-resumption",
  259. server => {
  260. extra => {
  261. "ALPNProtocols" => "bar",
  262. },
  263. },
  264. resume_server => {
  265. extra => {
  266. "ALPNProtocols" => "baz",
  267. },
  268. },
  269. client => {
  270. extra => {
  271. "ALPNProtocols" => "foo,bar",
  272. },
  273. },
  274. test => {
  275. "HandshakeMode" => "Resume",
  276. "ExpectedResult" => "ServerFail",
  277. "ExpectedServerAlert" => "NoApplicationProtocol",
  278. },
  279. },
  280. {
  281. name => "alpn-no-server-support-resumption",
  282. server => {
  283. extra => {
  284. "ALPNProtocols" => "foo",
  285. },
  286. },
  287. resume_server => { },
  288. client => {
  289. extra => {
  290. "ALPNProtocols" => "foo",
  291. },
  292. },
  293. test => {
  294. "HandshakeMode" => "Resume",
  295. "ResumptionExpected" => "Yes",
  296. "ExpectedALPNProtocol" => undef,
  297. },
  298. },
  299. {
  300. name => "alpn-no-client-support-resumption",
  301. server => {
  302. extra => {
  303. "ALPNProtocols" => "foo",
  304. },
  305. },
  306. client => {
  307. extra => {
  308. "ALPNProtocols" => "foo",
  309. },
  310. },
  311. resume_client => {
  312. },
  313. test => {
  314. "HandshakeMode" => "Resume",
  315. "ResumptionExpected" => "Yes",
  316. "ExpectedALPNProtocol" => undef,
  317. },
  318. },
  319. );