Repository navigation
Commit c4a5a4e
committed
Filter suites and sigalgs for the version from an unfiltered copy
ResetSuitesForVersion() removed the suites and sigalgs that the new
version lacks from a user-set list in place. Once a DTLS maximum or
option could be lifted again, that loss became permanent: capping a DTLS
1.3 SSL at DTLS 1.2 dropped the TLS 1.3 suites and the TLS 1.3-only
brainpool sigalgs, and lifting the cap left a DTLS 1.3 SSL without them.
Without a user list, the suites were rebuilt for the version but
InitSuites() keeps existing sigalgs, so a capped SSL still offered the
TLS 1.3-only brainpool and SLH-DSA sigalgs in its DTLS 1.2 ClientHello
or CertificateRequest.
The new FilterSuitesForVersion() filters ssl->suites for its version.
The first time it has to remove something, it keeps the unfiltered list
in suitesUser, and every later call filters that copy, so a lift
restores what a cap removed. It filters the suites of a user-set list
and the sigalgs of any list, user-set or default.
ResetSuitesForVersion() rebuilds the default suites and then calls it,
also on an SSL with no side yet once a copy exists, and so do
wolfSSL_SetVersion() and InitSSL_Suites(), which an either-side SSL runs
when it takes a side. If the copy cannot be allocated, the list is still
filtered in place. At the newest version nothing can be removed, so the
filter only copies back from the saved list there.
A suite or sigalg is removed only when the newest version's defaults
have it and this version's defaults lack it: TLS 1.3 suites below 1.3,
TLS 1.2 suites below 1.2, the TLS 1.3-only brainpool and SLH-DSA
sigalgs, and RSA-PSS before TLS 1.2. Anything else the user set, such as
the multicast WDM suite or ECDSA with SHA-224, DSA or SHA-1 sigalgs, is
kept, as before. If the filter would leave no sigalg, the list is kept
as it is, since an empty list means the defaults.
wolfSSL_set_cipher_list(), wolfSSL_set_cipher_list_bytes() and
wolfSSL_set1_sigalgs_list() write into the copy while it exists and
always filter afterwards, also when they fail, so the result depends
only on the version and not on whether the list was set before or after
a cap or whether a copy was made. A TLS 1.2 SSL given a list with TLS
1.3 suites now drops them, as a DTLS 1.2 SSL already did. A sigalgs
change made while capped keeps the user's suites. SetSuitesHashSigAlgo()
now parses into a local buffer, so a sigalgs list that fails to parse
leaves the previous one in place, on the CTX as well as on the SSL. On
an SSL whose list is still the default, the setters first rebuild the
defaults for the newest version the SSL can reach and its current key,
so with OPENSSL_EXTRA a TLS 1.2-only cipher list keeps the default TLS
1.3 suites, as OpenSSL does. SetCipherList_ex() builds the list for that
newest version too, the newer of the SSL's and the CTX method's, for TLS
and DTLS alike, so a keyword list such as HIGH set while capped still
has its TLS 1.3 suites for a lift, and one set after the CTX maximum was
lowered keeps them on an SSL still at DTLS 1.3.
The filter also built its table with the server's key flags. With an ECC
key, haveStaticECC cleared haveRSA and the RSA suites were removed;
without one, the static ECDH suites were. It now builds the table for
the client side with every key type, so only the version decides what is
removed. VerifyServerSuite() still skips a suite the server's key cannot
use when it matches suites.
test_dtls13_mask_lift_cipher_list caps and lifts a user-set list on the
client and on a server with an ECC key: the cap removes only the TLS 1.3
suite, and the lift restores the list with a sigalgs change (including
ECDSA with SHA-224), a TLS 1.2 cipher list, a list set by bytes or an
unrelated option made while capped. test_dtls13_mask_list_after_cap sets
the default list, a named list, a TLS 1.2-only list or HIGH after the
cap, and a cipher list and a byte list that fail to parse, and checks
that no TLS 1.3 suite or brainpool sigalg is left until the lift.
Further tests cover a DTLS and a TLS either-side SSL capped before it
becomes the client, a list set on a side-less SSL after
wolfSSL_SetVersion(), HIGH set after the CTX maximum was lowered, SHA-1
sigalgs kept where they are built, wolfSSL_SetVersion() restoring the
TLS 1.3 suites a TLS mask removed, also from a TLS 1.2 list set under
the mask, a capped list kept across wolfSSL_clear() and restored by a
lift, a CTX sigalgs list kept when a new one fails to parse, sigalgs set
on a default list across a cap, a failed set and a lift, a
brainpool-only sigalgs list kept under a cap, a capped TLS server
merging with defaults for a key loaded later, a TLS 1.2 SSL given a TLS
1.3 suite, and the multicast suite kept under a cap.1 parent c761727 commit c4a5a4e
6 files changed
Lines changed: 816 additions & 94 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8049 | 8049 | | |
8050 | 8050 | | |
8051 | 8051 | | |
8052 | | - | |
| 8052 | + | |
8053 | 8053 | | |
8054 | 8054 | | |
8055 | 8055 | | |
| |||
8093 | 8093 | | |
8094 | 8094 | | |
8095 | 8095 | | |
| 8096 | + | |
| 8097 | + | |
| 8098 | + | |
| 8099 | + | |
| 8100 | + | |
| 8101 | + | |
| 8102 | + | |
| 8103 | + | |
| 8104 | + | |
| 8105 | + | |
| 8106 | + | |
| 8107 | + | |
| 8108 | + | |
| 8109 | + | |
8096 | 8110 | | |
8097 | 8111 | | |
8098 | 8112 | | |
| |||
8151 | 8165 | | |
8152 | 8166 | | |
8153 | 8167 | | |
| 8168 | + | |
| 8169 | + | |
8154 | 8170 | | |
8155 | 8171 | | |
8156 | 8172 | | |
| |||
10508 | 10524 | | |
10509 | 10525 | | |
10510 | 10526 | | |
| 10527 | + | |
| 10528 | + | |
10511 | 10529 | | |
10512 | 10530 | | |
10513 | 10531 | | |
| |||
34842 | 34860 | | |
34843 | 34861 | | |
34844 | 34862 | | |
34845 | | - | |
| 34863 | + | |
| 34864 | + | |
34846 | 34865 | | |
34847 | 34866 | | |
34848 | 34867 | | |
| |||
35124 | 35143 | | |
35125 | 35144 | | |
35126 | 35145 | | |
35127 | | - | |
35128 | | - | |
35129 | | - | |
| 35146 | + | |
35130 | 35147 | | |
35131 | 35148 | | |
35132 | 35149 | | |
| |||
35166 | 35183 | | |
35167 | 35184 | | |
35168 | 35185 | | |
35169 | | - | |
| 35186 | + | |
35170 | 35187 | | |
35171 | 35188 | | |
35172 | 35189 | | |
| |||
35179 | 35196 | | |
35180 | 35197 | | |
35181 | 35198 | | |
35182 | | - | |
| 35199 | + | |
| 35200 | + | |
35183 | 35201 | | |
35184 | 35202 | | |
35185 | 35203 | | |
| |||
0 commit comments