2016-07-05 02:16:14 +08: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 22:29:48 +08:00
|
|
|
server => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "foo",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
client => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "foo",
|
|
|
|
},
|
|
|
|
},
|
2016-07-05 02:16:14 +08:00
|
|
|
test => {
|
|
|
|
"ExpectedALPNProtocol" => "foo",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2016-07-21 22:29:48 +08:00
|
|
|
name => "alpn-server-finds-match",
|
|
|
|
server => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "baz,bar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
client => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "foo,bar",
|
|
|
|
},
|
|
|
|
},
|
2016-07-05 02:16:14 +08:00
|
|
|
test => {
|
|
|
|
"ExpectedALPNProtocol" => "bar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2016-07-21 22:29:48 +08:00
|
|
|
name => "alpn-server-honours-server-pref",
|
|
|
|
server => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "bar,foo",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
client => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "foo,bar",
|
|
|
|
},
|
|
|
|
},
|
2016-07-05 02:16:14 +08:00
|
|
|
test => {
|
|
|
|
"ExpectedALPNProtocol" => "bar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name => "alpn-alert-on-mismatch",
|
2016-07-21 22:29:48 +08:00
|
|
|
server => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "baz",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
client => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "foo,bar",
|
|
|
|
},
|
|
|
|
},
|
2016-07-05 02:16:14 +08:00
|
|
|
test => {
|
|
|
|
"ExpectedResult" => "ServerFail",
|
2016-07-21 22:29:48 +08:00
|
|
|
"ExpectedServerAlert" => "NoApplicationProtocol",
|
2016-07-05 02:16:14 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name => "alpn-no-server-support",
|
|
|
|
server => { },
|
2016-07-21 22:29:48 +08:00
|
|
|
client => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "foo",
|
|
|
|
},
|
|
|
|
},
|
2016-07-05 02:16:14 +08:00
|
|
|
test => {
|
|
|
|
"ExpectedALPNProtocol" => undef,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name => "alpn-no-client-support",
|
2016-07-21 22:29:48 +08:00
|
|
|
server => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "foo",
|
|
|
|
},
|
|
|
|
},
|
2016-07-05 02:16:14 +08:00
|
|
|
client => { },
|
|
|
|
test => {
|
|
|
|
"ExpectedALPNProtocol" => undef,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name => "alpn-with-sni-no-context-switch",
|
2016-07-21 22:29:48 +08:00
|
|
|
server => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "foo",
|
|
|
|
"ServerNameCallback" => "IgnoreMismatch",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
server2 => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "bar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
client => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "foo,bar",
|
|
|
|
"ServerName" => "server1",
|
|
|
|
},
|
|
|
|
},
|
2016-07-05 02:16:14 +08:00
|
|
|
test => {
|
|
|
|
"ExpectedServerName" => "server1",
|
|
|
|
"ExpectedALPNProtocol" => "foo",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name => "alpn-with-sni-context-switch",
|
2016-07-21 22:29:48 +08:00
|
|
|
server => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "foo",
|
|
|
|
"ServerNameCallback" => "IgnoreMismatch",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
server2 => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "bar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
client => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "foo,bar",
|
|
|
|
"ServerName" => "server2",
|
|
|
|
},
|
|
|
|
},
|
2016-07-05 02:16:14 +08:00
|
|
|
test => {
|
|
|
|
"ExpectedServerName" => "server2",
|
|
|
|
"ExpectedALPNProtocol" => "bar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name => "alpn-selected-sni-server-supports-alpn",
|
2016-07-21 22:29:48 +08:00
|
|
|
server => {
|
|
|
|
extra => {
|
|
|
|
"ServerNameCallback" => "IgnoreMismatch",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
server2 => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "bar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
client => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "foo,bar",
|
|
|
|
"ServerName" => "server2",
|
|
|
|
},
|
|
|
|
},
|
2016-07-05 02:16:14 +08:00
|
|
|
test => {
|
|
|
|
"ExpectedServerName" => "server2",
|
|
|
|
"ExpectedALPNProtocol" => "bar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name => "alpn-selected-sni-server-does-not-support-alpn",
|
2016-07-21 22:29:48 +08:00
|
|
|
server => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "bar",
|
|
|
|
"ServerNameCallback" => "IgnoreMismatch",
|
|
|
|
},
|
|
|
|
},
|
2016-07-05 02:16:14 +08:00
|
|
|
server2 => { },
|
2016-07-21 22:29:48 +08:00
|
|
|
client => {
|
|
|
|
extra => {
|
|
|
|
"ALPNProtocols" => "foo,bar",
|
|
|
|
"ServerName" => "server2",
|
|
|
|
},
|
|
|
|
},
|
2016-07-05 02:16:14 +08:00
|
|
|
test => {
|
|
|
|
"ExpectedServerName" => "server2",
|
|
|
|
"ExpectedALPNProtocol" => undef,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|