Commit 7842bf3
committed
Fix for DTLS1.3 HRR group handling
When a server uses a HRR to negotiate the key exchange group to use, the
selected group is advertised in the HRR key share extension.
Furthermore, this group is also stored in the Cookie that is sent to the
client. When the server receives the second CH, the group used in the
key share extension MUST be the one of the HRR.
For stateless DTLS servers, the handling of this check had a bug. The
key share group of the HRR is stored in the ssl->hrr_keyshare_group
variable and is checked against the received key share of the second CH.
However, in the stateless server case, another CH message may be
received inbetween the two CH message of the desired client, potentially
overwriting the ssl->hrr_keyshare_group variable. This then causes
handshake failures when the ssl->hrr_keyshare_group variable contains
another group than the second CH message of the desired client.
To fix this, the following changes are conducted:
1. Disable the ssl->hrr_keyshare_group check for stateless DTLS 1.3
servers. As long as the server is stateless, CHs from multiple
clients may be received that individually cause HRRs with different
groups. For each of these clients, the HRR group is properly stored
in the cookie.
2. When a valid cookie is received from the client, the server becomes
stateful. In this case, we now parse the cookie for a stored HRR
group in the RestartHandshakeHashWithCookie() method. If present,
we restore the ssl->hrr_keyshare_group variable to this group to
ensure the error checks succeed.
3. Move the check of ssl->hrr_keyshare_group of the the KeyShare
extension parsing logic into the general TLS1.3 ClientHello parsing
after extension handling. This ensures that the order of the cookie
and key share extensions does not matter.
A new test is added to check for this behavior.1 parent 350706d commit 7842bf3
3 files changed
Lines changed: 155 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10216 | 10216 | | |
10217 | 10217 | | |
10218 | 10218 | | |
10219 | | - | |
10220 | | - | |
10221 | | - | |
10222 | | - | |
10223 | | - | |
10224 | | - | |
10225 | | - | |
10226 | | - | |
10227 | | - | |
10228 | | - | |
10229 | | - | |
10230 | | - | |
10231 | | - | |
10232 | | - | |
10233 | 10219 | | |
10234 | 10220 | | |
10235 | 10221 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6502 | 6502 | | |
6503 | 6503 | | |
6504 | 6504 | | |
| 6505 | + | |
| 6506 | + | |
6505 | 6507 | | |
6506 | 6508 | | |
6507 | 6509 | | |
| |||
7015 | 7017 | | |
7016 | 7018 | | |
7017 | 7019 | | |
| 7020 | + | |
| 7021 | + | |
| 7022 | + | |
| 7023 | + | |
| 7024 | + | |
| 7025 | + | |
| 7026 | + | |
| 7027 | + | |
| 7028 | + | |
| 7029 | + | |
| 7030 | + | |
| 7031 | + | |
| 7032 | + | |
| 7033 | + | |
| 7034 | + | |
| 7035 | + | |
| 7036 | + | |
| 7037 | + | |
| 7038 | + | |
| 7039 | + | |
| 7040 | + | |
| 7041 | + | |
| 7042 | + | |
7018 | 7043 | | |
7019 | 7044 | | |
7020 | 7045 | | |
| |||
7509 | 7534 | | |
7510 | 7535 | | |
7511 | 7536 | | |
7512 | | - | |
| 7537 | + | |
| 7538 | + | |
| 7539 | + | |
| 7540 | + | |
| 7541 | + | |
| 7542 | + | |
| 7543 | + | |
| 7544 | + | |
| 7545 | + | |
| 7546 | + | |
| 7547 | + | |
| 7548 | + | |
7513 | 7549 | | |
7514 | 7550 | | |
7515 | 7551 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24180 | 24180 | | |
24181 | 24181 | | |
24182 | 24182 | | |
| 24183 | + | |
| 24184 | + | |
| 24185 | + | |
| 24186 | + | |
| 24187 | + | |
| 24188 | + | |
24183 | 24189 | | |
24184 | 24190 | | |
24185 | 24191 | | |
| |||
24317 | 24323 | | |
24318 | 24324 | | |
24319 | 24325 | | |
| 24326 | + | |
| 24327 | + | |
| 24328 | + | |
| 24329 | + | |
| 24330 | + | |
| 24331 | + | |
| 24332 | + | |
| 24333 | + | |
| 24334 | + | |
| 24335 | + | |
| 24336 | + | |
| 24337 | + | |
| 24338 | + | |
| 24339 | + | |
| 24340 | + | |
| 24341 | + | |
| 24342 | + | |
| 24343 | + | |
| 24344 | + | |
| 24345 | + | |
| 24346 | + | |
| 24347 | + | |
| 24348 | + | |
| 24349 | + | |
| 24350 | + | |
| 24351 | + | |
| 24352 | + | |
| 24353 | + | |
| 24354 | + | |
| 24355 | + | |
| 24356 | + | |
| 24357 | + | |
| 24358 | + | |
| 24359 | + | |
| 24360 | + | |
| 24361 | + | |
| 24362 | + | |
| 24363 | + | |
| 24364 | + | |
| 24365 | + | |
| 24366 | + | |
| 24367 | + | |
| 24368 | + | |
| 24369 | + | |
| 24370 | + | |
| 24371 | + | |
| 24372 | + | |
| 24373 | + | |
| 24374 | + | |
| 24375 | + | |
| 24376 | + | |
| 24377 | + | |
| 24378 | + | |
| 24379 | + | |
| 24380 | + | |
| 24381 | + | |
| 24382 | + | |
| 24383 | + | |
| 24384 | + | |
| 24385 | + | |
| 24386 | + | |
| 24387 | + | |
| 24388 | + | |
| 24389 | + | |
| 24390 | + | |
| 24391 | + | |
| 24392 | + | |
| 24393 | + | |
| 24394 | + | |
| 24395 | + | |
| 24396 | + | |
| 24397 | + | |
| 24398 | + | |
| 24399 | + | |
| 24400 | + | |
| 24401 | + | |
| 24402 | + | |
| 24403 | + | |
| 24404 | + | |
| 24405 | + | |
| 24406 | + | |
| 24407 | + | |
| 24408 | + | |
| 24409 | + | |
| 24410 | + | |
| 24411 | + | |
| 24412 | + | |
| 24413 | + | |
| 24414 | + | |
| 24415 | + | |
| 24416 | + | |
| 24417 | + | |
| 24418 | + | |
| 24419 | + | |
| 24420 | + | |
| 24421 | + | |
| 24422 | + | |
| 24423 | + | |
| 24424 | + | |
| 24425 | + | |
| 24426 | + | |
| 24427 | + | |
| 24428 | + | |
| 24429 | + | |
| 24430 | + | |
| 24431 | + | |
24320 | 24432 | | |
24321 | 24433 | | |
24322 | 24434 | | |
24323 | 24435 | | |
24324 | 24436 | | |
| 24437 | + | |
| 24438 | + | |
| 24439 | + | |
| 24440 | + | |
| 24441 | + | |
24325 | 24442 | | |
24326 | 24443 | | |
24327 | 24444 | | |
| |||
33186 | 33303 | | |
33187 | 33304 | | |
33188 | 33305 | | |
| 33306 | + | |
33189 | 33307 | | |
33190 | 33308 | | |
33191 | 33309 | | |
| |||
0 commit comments