Home | History | Annotate | Line # | Download | only in ssl-tests
08-npn.cnf.in revision 1.1
      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 
      9 
     10 ## Test NPN. Note that NPN is only supported up to TLSv1.2
     11 
     12 use strict;
     13 use warnings;
     14 
     15 package ssltests;
     16 
     17 our @tests = (
     18     {
     19         name => "npn-simple",
     20         server => {
     21             extra => {
     22                 "NPNProtocols" => "foo",
     23             },
     24         },
     25         client => {
     26             extra => {
     27                 "NPNProtocols" => "foo",
     28             },
     29             "MaxProtocol" => "TLSv1.2"
     30         },
     31         test => {
     32             "ExpectedNPNProtocol" => "foo",
     33         },
     34     },
     35     {
     36         name => "npn-client-finds-match",
     37         server => {
     38             extra => {
     39                 "NPNProtocols" => "baz,bar",
     40             },
     41         },
     42         client => {
     43             extra => {
     44                 "NPNProtocols" => "foo,bar",
     45             },
     46             "MaxProtocol" => "TLSv1.2"
     47         },
     48         test => {
     49             "ExpectedNPNProtocol" => "bar",
     50         },
     51     },
     52     {
     53         name => "npn-client-honours-server-pref",
     54         server => {
     55             extra => {
     56                 "NPNProtocols" => "bar,foo",
     57             },
     58         },
     59         client => {
     60             extra => {
     61                 "NPNProtocols" => "foo,bar",
     62             },
     63             "MaxProtocol" => "TLSv1.2"
     64         },
     65         test => {
     66             "ExpectedNPNProtocol" => "bar",
     67         },
     68     },
     69     {
     70         name => "npn-client-first-pref-on-mismatch",
     71         server => {
     72             extra => {
     73                 "NPNProtocols" => "baz",
     74             },
     75         },
     76         client => {
     77             extra => {
     78                 "NPNProtocols" => "foo,bar",
     79             },
     80             "MaxProtocol" => "TLSv1.2"
     81         },
     82         test => {
     83             "ExpectedNPNProtocol" => "foo",
     84         },
     85     },
     86     {
     87         name => "npn-no-server-support",
     88         server => {},
     89         client => {
     90             extra => {
     91                 "NPNProtocols" => "foo",
     92             },
     93             "MaxProtocol" => "TLSv1.2"
     94         },
     95         test => {
     96             "ExpectedNPNProtocol" => undef,
     97         },
     98     },
     99     {
    100         name => "npn-no-client-support",
    101         server => {
    102             extra => {
    103                 "NPNProtocols" => "foo",
    104             },
    105         },
    106         client => {
    107             "MaxProtocol" => "TLSv1.2"
    108         },
    109         test => {
    110             "ExpectedNPNProtocol" => undef,
    111         },
    112     },
    113     {
    114         name => "npn-with-sni-no-context-switch",
    115         server => {
    116             extra => {
    117                 "NPNProtocols" => "foo",
    118                 "ServerNameCallback" => "IgnoreMismatch",
    119             },
    120         },
    121         server2 => {
    122             extra => {
    123                 "NPNProtocols" => "bar",
    124             },
    125         },
    126         client => {
    127             extra => {
    128                 "NPNProtocols" => "foo,bar",
    129                 "ServerName" => "server1",
    130             },
    131             "MaxProtocol" => "TLSv1.2"
    132         },
    133         test => {
    134             "ExpectedServerName" => "server1",
    135             "ExpectedNPNProtocol" => "foo",
    136         },
    137     },
    138     {
    139         name => "npn-with-sni-context-switch",
    140         server => {
    141             extra => {
    142                 "NPNProtocols" => "foo",
    143                 "ServerNameCallback" => "IgnoreMismatch",
    144             },
    145         },
    146         server2 => {
    147             extra => {
    148                 "NPNProtocols" => "bar",
    149             },
    150         },
    151         client => {
    152             extra => {
    153                 "NPNProtocols" => "foo,bar",
    154                 "ServerName" => "server2",
    155             },
    156             "MaxProtocol" => "TLSv1.2"
    157         },
    158         test => {
    159             "ExpectedServerName" => "server2",
    160             "ExpectedNPNProtocol" => "bar",
    161         },
    162     },
    163     {
    164         name => "npn-selected-sni-server-supports-npn",
    165         server => {
    166             extra => {
    167                 "ServerNameCallback" => "IgnoreMismatch",
    168             },
    169         },
    170         server2 => {
    171             extra => {
    172                 "NPNProtocols" => "bar",
    173             },
    174         },
    175         client => {
    176             extra => {
    177                 "NPNProtocols" => "foo,bar",
    178                 "ServerName" => "server2",
    179             },
    180             "MaxProtocol" => "TLSv1.2"
    181         },
    182         test => {
    183             "ExpectedServerName" => "server2",
    184             "ExpectedNPNProtocol" => "bar",
    185         },
    186     },
    187     {
    188         name => "npn-selected-sni-server-does-not-support-npn",
    189         server => {
    190             extra => {
    191                 "NPNProtocols" => "bar",
    192                 "ServerNameCallback" => "IgnoreMismatch",
    193             },
    194         },
    195         server2 => { },
    196         client => {
    197             extra => {
    198                 "NPNProtocols" => "foo,bar",
    199                 "ServerName" => "server2",
    200             },
    201             "MaxProtocol" => "TLSv1.2"
    202         },
    203         test => {
    204              "ExpectedServerName" => "server2",
    205              "ExpectedNPNProtocol" => undef,
    206         },
    207     },
    208     {
    209         name => "alpn-preferred-over-npn",
    210         server => {
    211             extra => {
    212                 "ALPNProtocols" => "foo",
    213                 "NPNProtocols" => "bar",
    214             },
    215         },
    216         client => {
    217             extra => {
    218                 "ALPNProtocols" => "foo",
    219                 "NPNProtocols" => "bar",
    220             },
    221             "MaxProtocol" => "TLSv1.2"
    222         },
    223         test => {
    224             "ExpectedALPNProtocol" => "foo",
    225             "ExpectedNPNProtocol" => undef,
    226         },
    227     },
    228     {
    229         name => "sni-npn-preferred-over-alpn",
    230         server => {
    231             extra => {
    232                 "ServerNameCallback" => "IgnoreMismatch",
    233                 "ALPNProtocols" => "foo",
    234             },
    235         },
    236         server2 => {
    237             extra => {
    238                 "NPNProtocols" => "bar",
    239             },
    240         },
    241         client => {
    242             extra => {
    243                 "ServerName" => "server2",
    244                 "ALPNProtocols" => "foo",
    245                 "NPNProtocols" => "bar",
    246             },
    247             "MaxProtocol" => "TLSv1.2"
    248         },
    249         test => {
    250             "ExpectedALPNProtocol" => undef,
    251             "ExpectedNPNProtocol" => "bar",
    252             "ExpectedServerName" => "server2",  
    253         },
    254     },
    255     {
    256         name => "npn-simple-resumption",
    257         server => {
    258             extra => {
    259                 "NPNProtocols" => "foo",
    260             },
    261         },
    262         client => {
    263             extra => {
    264                 "NPNProtocols" => "foo",
    265             },
    266             "MaxProtocol" => "TLSv1.2"
    267         },
    268         test => {
    269             "HandshakeMode" => "Resume",
    270             "ResumptionExpected" => "Yes",
    271             "ExpectedNPNProtocol" => "foo",
    272         },
    273     },
    274     {
    275         name => "npn-server-switch-resumption",
    276         server => {
    277             extra => {
    278                 "NPNProtocols" => "bar,foo",
    279             },
    280         },
    281         resume_server => {
    282             extra => {
    283                 "NPNProtocols" => "baz,foo",
    284             },
    285         },
    286         client => {
    287             extra => {
    288                 "NPNProtocols" => "foo,bar,baz",
    289             },
    290             "MaxProtocol" => "TLSv1.2"
    291         },
    292         test => {
    293             "HandshakeMode" => "Resume",
    294             "ResumptionExpected" => "Yes",
    295             "ExpectedNPNProtocol" => "baz",
    296         },
    297     },
    298     {
    299         name => "npn-client-switch-resumption",
    300         server => {
    301             extra => {
    302                 "NPNProtocols" => "foo,bar,baz",
    303             },
    304         },
    305         client => {
    306             extra => {
    307                 "NPNProtocols" => "foo,baz",
    308             },
    309             "MaxProtocol" => "TLSv1.2"
    310         },
    311         resume_client => {
    312             extra => {
    313                 "NPNProtocols" => "bar,baz",
    314             },
    315             "MaxProtocol" => "TLSv1.2"
    316         },
    317         test => {
    318             "HandshakeMode" => "Resume",
    319             "ResumptionExpected" => "Yes",
    320             "ExpectedNPNProtocol" => "bar",
    321         },
    322     },
    323     {
    324         name => "npn-client-first-pref-on-mismatch-resumption",
    325         server => {
    326             extra => {
    327                 "NPNProtocols" => "bar",
    328             },
    329         },
    330         resume_server => {
    331             extra => {
    332                 "NPNProtocols" => "baz",
    333             },
    334         },
    335         client => {
    336             extra => {
    337                 "NPNProtocols" => "foo,bar",
    338             },
    339             "MaxProtocol" => "TLSv1.2"
    340         },
    341         test => {
    342             "HandshakeMode" => "Resume",
    343             "ResumptionExpected" => "Yes",
    344             "ExpectedNPNProtocol" => "foo",
    345         },
    346     },
    347     {
    348         name => "npn-no-server-support-resumption",
    349         server => {
    350             extra => {
    351                 "NPNProtocols" => "foo",
    352             },
    353         },
    354         resume_server => { },
    355         client => {
    356             extra => {
    357                 "NPNProtocols" => "foo",
    358             },
    359             "MaxProtocol" => "TLSv1.2"
    360         },
    361         test => {
    362             "HandshakeMode" => "Resume",
    363             "ResumptionExpected" => "Yes",
    364             "ExpectedNPNProtocol" => undef,
    365         },
    366     },
    367     {
    368         name => "npn-no-client-support-resumption",
    369         server => {
    370             extra => {
    371                 "NPNProtocols" => "foo",
    372             },
    373         },
    374         client => {
    375             extra => {
    376                 "NPNProtocols" => "foo",
    377             },
    378             "MaxProtocol" => "TLSv1.2"
    379         },
    380         resume_client => {
    381             "MaxProtocol" => "TLSv1.2"
    382         },
    383         test => {
    384             "HandshakeMode" => "Resume",
    385             "ResumptionExpected" => "Yes",
    386             "ExpectedNPNProtocol" => undef,
    387         },
    388     },
    389     {
    390         name => "alpn-preferred-over-npn-resumption",
    391         server => {
    392             extra => {
    393                 "NPNProtocols" => "bar",
    394             },
    395         },
    396         resume_server => {
    397             extra => {
    398                 "ALPNProtocols" => "foo",
    399                 "NPNProtocols" => "baz",
    400             },
    401         },
    402         client => {
    403             extra => {
    404                 "ALPNProtocols" => "foo",
    405                 "NPNProtocols" => "bar,baz",
    406             },
    407             "MaxProtocol" => "TLSv1.2"
    408         },
    409         test => {
    410             "HandshakeMode" => "Resume",
    411             "ResumptionExpected" => "Yes",
    412             "ExpectedALPNProtocol" => "foo",
    413             "ExpectedNPNProtocol" => undef,
    414         },
    415     },
    416     {
    417         name => "npn-used-if-alpn-not-supported-resumption",
    418         server => {
    419             extra => {
    420                 "ALPNProtocols" => "foo",
    421                 "NPNProtocols" => "bar",
    422             },
    423         },
    424         resume_server => {
    425             extra => {
    426                 "NPNProtocols" => "baz",
    427             },
    428         },
    429         client => {
    430             extra => {
    431                 "ALPNProtocols" => "foo",
    432                 "NPNProtocols" => "bar,baz",
    433             },
    434             "MaxProtocol" => "TLSv1.2"
    435         },
    436         test => {
    437             "HandshakeMode" => "Resume",
    438             "ResumptionExpected" => "Yes",
    439             "ExpectedALPNProtocol" => undef,
    440             "ExpectedNPNProtocol" => "baz",
    441         },
    442     },
    443 );
    444