1 1.1 christos # -*- mode: perl; -*- 2 1.1 christos # Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved. 3 1.1 christos # 4 1.1 christos # Licensed under the Apache License 2.0 (the "License"). You may not use 5 1.1 christos # this file except in compliance with the License. You can obtain a copy 6 1.1 christos # in the file LICENSE in the source distribution or at 7 1.1 christos # https://www.openssl.org/source/license.html 8 1.1 christos 9 1.1 christos 10 1.1 christos ## Test Renegotiation 11 1.1 christos 12 1.1 christos use strict; 13 1.1 christos use warnings; 14 1.1 christos 15 1.1 christos package ssltests; 16 1.1 christos use OpenSSL::Test::Utils; 17 1.1 christos 18 1.1 christos our @tests = ( 19 1.1 christos { 20 1.1 christos name => "renegotiate-client-no-resume", 21 1.1 christos server => { 22 1.1 christos "Options" => "NoResumptionOnRenegotiation", 23 1.1 christos "MaxProtocol" => "TLSv1.2" 24 1.1 christos }, 25 1.1 christos client => {}, 26 1.1 christos test => { 27 1.1 christos "Method" => "TLS", 28 1.1 christos "HandshakeMode" => "RenegotiateClient", 29 1.1 christos "ResumptionExpected" => "No", 30 1.1 christos "ExpectedResult" => "Success" 31 1.1 christos } 32 1.1 christos }, 33 1.1 christos { 34 1.1 christos name => "renegotiate-client-resume", 35 1.1 christos server => { 36 1.1 christos "MaxProtocol" => "TLSv1.2" 37 1.1 christos }, 38 1.1 christos client => {}, 39 1.1 christos test => { 40 1.1 christos "Method" => "TLS", 41 1.1 christos "HandshakeMode" => "RenegotiateClient", 42 1.1 christos "ResumptionExpected" => "Yes", 43 1.1 christos "ExpectedResult" => "Success" 44 1.1 christos } 45 1.1 christos }, 46 1.1 christos { 47 1.1 christos name => "renegotiate-server-no-resume", 48 1.1 christos server => { 49 1.1 christos "Options" => "NoResumptionOnRenegotiation", 50 1.1 christos "MaxProtocol" => "TLSv1.2" 51 1.1 christos }, 52 1.1 christos client => {}, 53 1.1 christos test => { 54 1.1 christos "Method" => "TLS", 55 1.1 christos "HandshakeMode" => "RenegotiateServer", 56 1.1 christos "ResumptionExpected" => "No", 57 1.1 christos "ExpectedResult" => "Success" 58 1.1 christos } 59 1.1 christos }, 60 1.1 christos { 61 1.1 christos name => "renegotiate-server-resume", 62 1.1 christos server => { 63 1.1 christos "MaxProtocol" => "TLSv1.2" 64 1.1 christos }, 65 1.1 christos client => {}, 66 1.1 christos test => { 67 1.1 christos "Method" => "TLS", 68 1.1 christos "HandshakeMode" => "RenegotiateServer", 69 1.1 christos "ResumptionExpected" => "Yes", 70 1.1 christos "ExpectedResult" => "Success" 71 1.1 christos } 72 1.1 christos }, 73 1.1 christos { 74 1.1 christos name => "renegotiate-client-auth-require", 75 1.1 christos server => { 76 1.1 christos "Options" => "NoResumptionOnRenegotiation", 77 1.1 christos "MaxProtocol" => "TLSv1.2", 78 1.1 christos "VerifyCAFile" => test_pem("root-cert.pem"), 79 1.1 christos "VerifyMode" => "Require", 80 1.1 christos }, 81 1.1 christos client => { 82 1.1 christos "Certificate" => test_pem("ee-client-chain.pem"), 83 1.1 christos "PrivateKey" => test_pem("ee-key.pem"), 84 1.1 christos }, 85 1.1 christos test => { 86 1.1 christos "Method" => "TLS", 87 1.1 christos "HandshakeMode" => "RenegotiateServer", 88 1.1 christos "ResumptionExpected" => "No", 89 1.1 christos "ExpectedResult" => "Success" 90 1.1 christos } 91 1.1 christos }, 92 1.1 christos { 93 1.1 christos name => "renegotiate-client-auth-once", 94 1.1 christos server => { 95 1.1 christos "Options" => "NoResumptionOnRenegotiation", 96 1.1 christos "MaxProtocol" => "TLSv1.2", 97 1.1 christos "VerifyCAFile" => test_pem("root-cert.pem"), 98 1.1 christos "VerifyMode" => "Once", 99 1.1 christos }, 100 1.1 christos client => { 101 1.1 christos "Certificate" => test_pem("ee-client-chain.pem"), 102 1.1 christos "PrivateKey" => test_pem("ee-key.pem"), 103 1.1 christos }, 104 1.1 christos test => { 105 1.1 christos "Method" => "TLS", 106 1.1 christos "HandshakeMode" => "RenegotiateServer", 107 1.1 christos "ResumptionExpected" => "No", 108 1.1 christos "ExpectedResult" => "Success" 109 1.1 christos } 110 1.1 christos }, 111 1.1 christos { 112 1.1 christos # Just test that UnsafeLegacyServerConnect option 113 1.1 christos # exists, it won't have any real effect here 114 1.1 christos name => "renegotiate-client-legacy-connect", 115 1.1 christos server => { 116 1.1 christos "MaxProtocol" => "TLSv1.2" 117 1.1 christos }, 118 1.1 christos client => { 119 1.1 christos "Options" => "UnsafeLegacyServerConnect", 120 1.1 christos }, 121 1.1 christos test => { 122 1.1 christos "Method" => "TLS", 123 1.1 christos "HandshakeMode" => "RenegotiateClient", 124 1.1 christos "ResumptionExpected" => "Yes", 125 1.1 christos "ExpectedResult" => "Success" 126 1.1 christos } 127 1.1 christos }, 128 1.1 christos ); 129 1.1 christos our @tests_tls1_2 = ( 130 1.1 christos { 131 1.1 christos name => "renegotiate-aead-to-non-aead", 132 1.1 christos server => { 133 1.1 christos "Options" => "NoResumptionOnRenegotiation", 134 1.1 christos }, 135 1.1 christos client => { 136 1.1 christos "CipherString" => "AES128-GCM-SHA256", 137 1.1 christos "MaxProtocol" => "TLSv1.2", 138 1.1 christos extra => { 139 1.1 christos "RenegotiateCiphers" => "AES128-SHA" 140 1.1 christos } 141 1.1 christos }, 142 1.1 christos test => { 143 1.1 christos "Method" => "TLS", 144 1.1 christos "HandshakeMode" => "RenegotiateClient", 145 1.1 christos "ResumptionExpected" => "No", 146 1.1 christos "ExpectedResult" => "Success" 147 1.1 christos } 148 1.1 christos }, 149 1.1 christos { 150 1.1 christos name => "renegotiate-non-aead-to-aead", 151 1.1 christos server => { 152 1.1 christos "Options" => "NoResumptionOnRenegotiation", 153 1.1 christos }, 154 1.1 christos client => { 155 1.1 christos "CipherString" => "AES128-SHA", 156 1.1 christos "MaxProtocol" => "TLSv1.2", 157 1.1 christos extra => { 158 1.1 christos "RenegotiateCiphers" => "AES128-GCM-SHA256" 159 1.1 christos } 160 1.1 christos }, 161 1.1 christos test => { 162 1.1 christos "Method" => "TLS", 163 1.1 christos "HandshakeMode" => "RenegotiateClient", 164 1.1 christos "ResumptionExpected" => "No", 165 1.1 christos "ExpectedResult" => "Success" 166 1.1 christos } 167 1.1 christos }, 168 1.1 christos { 169 1.1 christos name => "renegotiate-non-aead-to-non-aead", 170 1.1 christos server => { 171 1.1 christos "Options" => "NoResumptionOnRenegotiation", 172 1.1 christos }, 173 1.1 christos client => { 174 1.1 christos "CipherString" => "AES128-SHA", 175 1.1 christos "MaxProtocol" => "TLSv1.2", 176 1.1 christos extra => { 177 1.1 christos "RenegotiateCiphers" => "AES256-SHA" 178 1.1 christos } 179 1.1 christos }, 180 1.1 christos test => { 181 1.1 christos "Method" => "TLS", 182 1.1 christos "HandshakeMode" => "RenegotiateClient", 183 1.1 christos "ResumptionExpected" => "No", 184 1.1 christos "ExpectedResult" => "Success" 185 1.1 christos } 186 1.1 christos }, 187 1.1 christos { 188 1.1 christos name => "renegotiate-aead-to-aead", 189 1.1 christos server => { 190 1.1 christos "Options" => "NoResumptionOnRenegotiation", 191 1.1 christos }, 192 1.1 christos client => { 193 1.1 christos "CipherString" => "AES128-GCM-SHA256", 194 1.1 christos "MaxProtocol" => "TLSv1.2", 195 1.1 christos extra => { 196 1.1 christos "RenegotiateCiphers" => "AES256-GCM-SHA384" 197 1.1 christos } 198 1.1 christos }, 199 1.1 christos test => { 200 1.1 christos "Method" => "TLS", 201 1.1 christos "HandshakeMode" => "RenegotiateClient", 202 1.1 christos "ResumptionExpected" => "No", 203 1.1 christos "ExpectedResult" => "Success" 204 1.1 christos } 205 1.1 christos }, 206 1.1 christos { 207 1.1 christos name => "no-renegotiation-server-by-client", 208 1.1 christos server => { 209 1.1 christos "Options" => "NoRenegotiation", 210 1.1 christos "MaxProtocol" => "TLSv1.2" 211 1.1 christos }, 212 1.1 christos client => { }, 213 1.1 christos test => { 214 1.1 christos "Method" => "TLS", 215 1.1 christos "HandshakeMode" => "RenegotiateClient", 216 1.1 christos "ResumptionExpected" => "No", 217 1.1 christos "ExpectedResult" => "ClientFail" 218 1.1 christos } 219 1.1 christos }, 220 1.1 christos { 221 1.1 christos name => "no-renegotiation-server-by-server", 222 1.1 christos server => { 223 1.1 christos "Options" => "NoRenegotiation", 224 1.1 christos "MaxProtocol" => "TLSv1.2" 225 1.1 christos }, 226 1.1 christos client => { }, 227 1.1 christos test => { 228 1.1 christos "Method" => "TLS", 229 1.1 christos "HandshakeMode" => "RenegotiateServer", 230 1.1 christos "ResumptionExpected" => "No", 231 1.1 christos "ExpectedResult" => "ServerFail" 232 1.1 christos } 233 1.1 christos }, 234 1.1 christos { 235 1.1 christos name => "no-renegotiation-client-by-server", 236 1.1 christos server => { 237 1.1 christos "MaxProtocol" => "TLSv1.2" 238 1.1 christos }, 239 1.1 christos client => { 240 1.1 christos "Options" => "NoRenegotiation", 241 1.1 christos }, 242 1.1 christos test => { 243 1.1 christos "Method" => "TLS", 244 1.1 christos "HandshakeMode" => "RenegotiateServer", 245 1.1 christos "ResumptionExpected" => "No", 246 1.1 christos "ExpectedResult" => "ServerFail" 247 1.1 christos } 248 1.1 christos }, 249 1.1 christos { 250 1.1 christos name => "no-renegotiation-client-by-client", 251 1.1 christos server => { 252 1.1 christos "MaxProtocol" => "TLSv1.2" 253 1.1 christos }, 254 1.1 christos client => { 255 1.1 christos "Options" => "NoRenegotiation", 256 1.1 christos }, 257 1.1 christos test => { 258 1.1 christos "Method" => "TLS", 259 1.1 christos "HandshakeMode" => "RenegotiateClient", 260 1.1 christos "ResumptionExpected" => "No", 261 1.1 christos "ExpectedResult" => "ClientFail" 262 1.1 christos } 263 1.1 christos }, 264 1.1 christos { 265 1.1 christos name => "no-extms-on-renegotiation", 266 1.1 christos server => { 267 1.1 christos "MaxProtocol" => "TLSv1.2" 268 1.1 christos }, 269 1.1 christos client => { 270 1.1 christos "MaxProtocol" => "TLSv1.2", 271 1.1 christos extra => { 272 1.1 christos "RenegotiateNoExtms" => "Yes" 273 1.1 christos } 274 1.1 christos }, 275 1.1 christos test => { 276 1.1 christos "Method" => "TLS", 277 1.1 christos "HandshakeMode" => "RenegotiateClient", 278 1.1 christos "ResumptionExpected" => "No", 279 1.1 christos "ExpectedResult" => "ServerFail" 280 1.1 christos } 281 1.1 christos }, 282 1.1 christos { 283 1.1 christos name => "allow-client-renegotiation", 284 1.1 christos server => { 285 1.1 christos "MaxProtocol" => "TLSv1.2", 286 1.1 christos }, 287 1.1 christos client => { 288 1.1 christos "MaxProtocol" => "TLSv1.2" 289 1.1 christos }, 290 1.1 christos test => { 291 1.1 christos "Method" => "TLS", 292 1.1 christos "HandshakeMode" => "RenegotiateClient", 293 1.1 christos "ResumptionExpected" => "Yes", 294 1.1 christos "ExpectedResult" => "Success" 295 1.1 christos } 296 1.1 christos }, 297 1.1 christos { 298 1.1 christos name => "no-client-renegotiation", 299 1.1 christos server => { 300 1.1 christos "MaxProtocol" => "TLSv1.2", 301 1.1 christos "Options" => "-ClientRenegotiation" 302 1.1 christos }, 303 1.1 christos client => { 304 1.1 christos "MaxProtocol" => "TLSv1.2", 305 1.1 christos }, 306 1.1 christos test => { 307 1.1 christos "Method" => "TLS", 308 1.1 christos "HandshakeMode" => "RenegotiateClient", 309 1.1 christos "ResumptionExpected" => "No", 310 1.1 christos "ExpectedResult" => "ClientFail", 311 1.1 christos "ExpectedServerAlert" => "NoRenegotiation" 312 1.1 christos } 313 1.1 christos } 314 1.1 christos ); 315 1.1 christos 316 1.1 christos push @tests, @tests_tls1_2 unless disabled("tls1_2"); 317