Add some more brainpool tests for TLSv1.3

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/19315)
This commit is contained in:
Matt Caswell 2022-09-30 13:35:28 +01:00
parent c9ee6e3646
commit 3f76339a3f
3 changed files with 798 additions and 583 deletions

View File

@ -533,6 +533,17 @@ __owur static int parse_expected_key_type(int *ptype, const char *value)
if (nid == NID_undef)
nid = EC_curve_nist2nid(value);
#endif
switch (nid) {
case NID_brainpoolP256r1tls13:
nid = NID_brainpoolP256r1;
break;
case NID_brainpoolP384r1tls13:
nid = NID_brainpoolP384r1;
break;
case NID_brainpoolP512r1tls13:
nid = NID_brainpoolP512r1;
break;
}
if (nid == NID_undef)
return 0;
*ptype = nid;

File diff suppressed because it is too large Load Diff

View File

@ -14,6 +14,12 @@ our $fips_mode;
my @curves = ("prime256v1", "secp384r1", "secp521r1", "X25519",
"X448");
#Curves *only* suitable for use in TLSv1.3
my @curves_tls_1_3 = ("brainpoolP256r1tls13", "brainpoolP384r1tls13",
"brainpoolP512r1tls13");
#It so happens that all the curves in @curves_tls_1_3 are non-fips curves
push @curves, @curves_tls_1_3 if !$fips_mode;
my @curves_tls_1_2 = ("sect233k1", "sect233r1",
"sect283k1", "sect283r1", "sect409k1", "sect409r1",
@ -91,6 +97,30 @@ sub generate_tests() {
},
};
}
if (!$fips_mode) {
foreach (0..$#curves_tls_1_3) {
my $curve = $curves_tls_1_3[$_];
push @tests, {
name => "curve-${curve}-tls13-in-tls12",
server => {
"Curves" => $curve,
"CipherString" => 'DEFAULT@SECLEVEL=1',
"MaxProtocol" => "TLSv1.3"
},
client => {
"CipherString" => 'ECDHE@SECLEVEL=1',
"MaxProtocol" => "TLSv1.2",
"Curves" => $curve
},
test => {
#These curves are only suitable for TLSv1.3 so we expect the
#server to fail because it has no shared groups for TLSv1.2
#ECDHE key exchange
"ExpectedResult" => "ServerFail"
},
};
}
}
}
generate_tests();