[rustls] Fix race around HRR and properly implement D.4

A ClientHello that results in a HelloRetryRequest may race against new
session negotiation that updates the session cache. This may result in
changes to the ticket used in the session negotiation, which is
prohibited per section RFC8446 section 4.1.2.

Additionally, section D.4 requires the client to provide "a non-empty
session ID in the ClientHello" both for establishing a new session and
for resuming a session. TLS 1.3 session resumptions previously used an
empty session ID as that's what's stored in the `ClientSessionValue` and
thus what's resolved when looking up a new session.

This behavior is additionally problematic for a `StoresClientSessions`
implementation that implements RFC8446 appendix C.4, as subsequent cache
lookups are guaranteed to return different tickets and session IDs.

This changes solves all three issues by only looking up session
resumption when not servicing a HelloRetryRequest (which prevents the
race condition and enables the use of a C.4-compliant session cache),
by only using tickets and session IDs generated from the initial
ClientHello, and by always generating a session ID for TLS 1.3
connections over TCP.

Bug: 68871
Test: Ran bogo tests in upstream; this is a backport.
Change-Id: I3c538123a577471e3bb2a2ebe12ae72e7db56690
2 files changed
tree: a2358627214d436bb0011ad320b50452c79b97ba
  1. boards/
  2. build/
  3. buildtools/
  4. bundles/
  5. docs/
  6. examples/
  7. garnet/
  8. products/
  9. scripts/
  10. sdk/
  11. src/
  12. third_party/
  13. tools/
  14. zircon/
  15. .clang-format
  16. .clang-tidy
  17. .git-blame-ignore-revs
  18. .gitattributes
  19. .gitignore
  20. .gn
  21. .style.yapf
  22. AUTHORS
  23. BUILD.gn
  24. CODE_OF_CONDUCT.md
  25. CONTRIBUTING.md
  26. LICENSE
  27. OWNERS
  28. PATENTS
  29. README.md
  30. rustfmt.toml
README.md

Fuchsia

Pink + Purple == Fuchsia (a new operating system)

What is Fuchsia?

Fuchsia is a modular, capability-based operating system. Fuchsia runs on modern 64-bit Intel and ARM processors.

Fuchsia is an open source project with a code of conduct that we expect everyone who interacts with the project to respect.

Read more about Fuchsia's principles.

How can I build and run Fuchsia?

See Getting Started.

Where can I learn more about Fuchsia?

See fuchsia.dev.