2016-07-04 18:16:14 +00:00
|
|
|
# -*- mode: perl; -*-
|
|
|
|
# Copyright 2016-2016 The OpenSSL Project Authors. All Rights Reserved.
|
|
|
|
#
|
|
|
|
# Licensed under the OpenSSL license (the "License"). You may not use
|
|
|
|
# this file except in compliance with the License. You can obtain a copy
|
|
|
|
# in the file LICENSE in the source distribution or at
|
|
|
|
# https://www.openssl.org/source/license.html
|
|
|
|
|
|
|
|
|
|
|
|
## Test version negotiation
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
|
|
|
|
package ssltests;
|
|
|
|
|
|
|
|
|
|
|
|
our @tests = (
|
|
|
|
{
|
|
|
|
name => "alpn-simple",
|
2016-07-21 14:29:48 +00:00
|
|
|
server => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "foo",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
client => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "foo",
|
|
|
|
},
|
|
|
|
},
|
2016-07-04 18:16:14 +00:00
|
|
|
test => {
|
2016-08-08 12:42:08 +00:00
|
|
|
"ExpectedALPNProtocol" => "foo",
|
2016-07-04 18:16:14 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2016-07-21 14:29:48 +00:00
|
|
|
name => "alpn-server-finds-match",
|
|
|
|
server => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "baz,bar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
client => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "foo,bar",
|
|
|
|
},
|
|
|
|
},
|
2016-07-04 18:16:14 +00:00
|
|
|
test => {
|
2016-08-08 12:42:08 +00:00
|
|
|
"ExpectedALPNProtocol" => "bar",
|
2016-07-04 18:16:14 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2016-07-21 14:29:48 +00:00
|
|
|
name => "alpn-server-honours-server-pref",
|
|
|
|
server => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "bar,foo",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
client => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "foo,bar",
|
|
|
|
},
|
|
|
|
},
|
2016-07-04 18:16:14 +00:00
|
|
|
test => {
|
2016-08-08 12:42:08 +00:00
|
|
|
"ExpectedALPNProtocol" => "bar",
|
2016-07-04 18:16:14 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name => "alpn-alert-on-mismatch",
|
2016-07-21 14:29:48 +00:00
|
|
|
server => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "baz",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
client => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "foo,bar",
|
|
|
|
},
|
|
|
|
},
|
2016-07-04 18:16:14 +00:00
|
|
|
test => {
|
2016-08-08 12:42:08 +00:00
|
|
|
"ExpectedResult" => "ServerFail",
|
|
|
|
"ExpectedServerAlert" => "NoApplicationProtocol",
|
2016-07-04 18:16:14 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name => "alpn-no-server-support",
|
|
|
|
server => { },
|
2016-07-21 14:29:48 +00:00
|
|
|
client => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "foo",
|
|
|
|
},
|
|
|
|
},
|
2016-07-04 18:16:14 +00:00
|
|
|
test => {
|
2016-08-08 12:42:08 +00:00
|
|
|
"ExpectedALPNProtocol" => undef,
|
2016-07-04 18:16:14 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name => "alpn-no-client-support",
|
2016-07-21 14:29:48 +00:00
|
|
|
server => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "foo",
|
|
|
|
},
|
|
|
|
},
|
2016-07-04 18:16:14 +00:00
|
|
|
client => { },
|
|
|
|
test => {
|
2016-08-08 12:42:08 +00:00
|
|
|
"ExpectedALPNProtocol" => undef,
|
2016-07-04 18:16:14 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name => "alpn-with-sni-no-context-switch",
|
2016-07-21 14:29:48 +00:00
|
|
|
server => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "foo",
|
|
|
|
"ServerNameCallback" => "IgnoreMismatch",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
server2 => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "bar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
client => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "foo,bar",
|
|
|
|
"ServerName" => "server1",
|
|
|
|
},
|
|
|
|
},
|
2016-07-04 18:16:14 +00:00
|
|
|
test => {
|
2016-08-08 12:42:08 +00:00
|
|
|
"ExpectedServerName" => "server1",
|
|
|
|
"ExpectedALPNProtocol" => "foo",
|
2016-07-04 18:16:14 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name => "alpn-with-sni-context-switch",
|
2016-07-21 14:29:48 +00:00
|
|
|
server => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "foo",
|
|
|
|
"ServerNameCallback" => "IgnoreMismatch",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
server2 => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "bar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
client => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "foo,bar",
|
|
|
|
"ServerName" => "server2",
|
|
|
|
},
|
|
|
|
},
|
2016-07-04 18:16:14 +00:00
|
|
|
test => {
|
2016-08-08 12:42:08 +00:00
|
|
|
"ExpectedServerName" => "server2",
|
|
|
|
"ExpectedALPNProtocol" => "bar",
|
2016-07-04 18:16:14 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name => "alpn-selected-sni-server-supports-alpn",
|
2016-07-21 14:29:48 +00:00
|
|
|
server => {
|
|
|
|
extra => {
|
|
|
|
"ServerNameCallback" => "IgnoreMismatch",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
server2 => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "bar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
client => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "foo,bar",
|
|
|
|
"ServerName" => "server2",
|
|
|
|
},
|
|
|
|
},
|
2016-07-04 18:16:14 +00:00
|
|
|
test => {
|
2016-08-08 12:42:08 +00:00
|
|
|
"ExpectedServerName" => "server2",
|
|
|
|
"ExpectedALPNProtocol" => "bar",
|
2016-07-04 18:16:14 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name => "alpn-selected-sni-server-does-not-support-alpn",
|
2016-07-21 14:29:48 +00:00
|
|
|
server => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "bar",
|
|
|
|
"ServerNameCallback" => "IgnoreMismatch",
|
|
|
|
},
|
|
|
|
},
|
2016-07-04 18:16:14 +00:00
|
|
|
server2 => { },
|
2016-07-21 14:29:48 +00:00
|
|
|
client => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "foo,bar",
|
|
|
|
"ServerName" => "server2",
|
|
|
|
},
|
|
|
|
},
|
2016-07-04 18:16:14 +00:00
|
|
|
test => {
|
2016-08-08 12:42:08 +00:00
|
|
|
"ExpectedServerName" => "server2",
|
|
|
|
"ExpectedALPNProtocol" => undef,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name => "alpn-simple-resumption",
|
|
|
|
server => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "foo",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
client => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "foo",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
test => {
|
|
|
|
"HandshakeMode" => "Resume",
|
|
|
|
"ResumptionExpected" => "Yes",
|
|
|
|
"ExpectedALPNProtocol" => "foo",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name => "alpn-server-switch-resumption",
|
|
|
|
server => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "bar,foo",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
resume_server => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "baz,foo",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
client => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "foo,bar,baz",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
test => {
|
|
|
|
"HandshakeMode" => "Resume",
|
|
|
|
"ResumptionExpected" => "Yes",
|
|
|
|
"ExpectedALPNProtocol" => "baz",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name => "alpn-client-switch-resumption",
|
|
|
|
server => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "foo,bar,baz",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
client => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "foo,baz",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
resume_client => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "bar,baz",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
test => {
|
|
|
|
"HandshakeMode" => "Resume",
|
|
|
|
"ResumptionExpected" => "Yes",
|
|
|
|
"ExpectedALPNProtocol" => "bar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name => "alpn-alert-on-mismatch-resumption",
|
|
|
|
server => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "bar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
resume_server => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "baz",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
client => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "foo,bar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
test => {
|
|
|
|
"HandshakeMode" => "Resume",
|
|
|
|
"ExpectedResult" => "ServerFail",
|
|
|
|
"ExpectedServerAlert" => "NoApplicationProtocol",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name => "alpn-no-server-support-resumption",
|
|
|
|
server => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "foo",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
resume_server => { },
|
|
|
|
client => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "foo",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
test => {
|
|
|
|
"HandshakeMode" => "Resume",
|
|
|
|
"ResumptionExpected" => "Yes",
|
|
|
|
"ExpectedALPNProtocol" => undef,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name => "alpn-no-client-support-resumption",
|
|
|
|
server => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "foo",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
client => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "foo",
|
|
|
|
},
|
|
|
|
},
|
2016-11-07 13:50:43 +00:00
|
|
|
resume_client => {
|
|
|
|
},
|
2016-08-08 12:42:08 +00:00
|
|
|
test => {
|
|
|
|
"HandshakeMode" => "Resume",
|
|
|
|
"ResumptionExpected" => "Yes",
|
|
|
|
"ExpectedALPNProtocol" => undef,
|
2016-07-04 18:16:14 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|