This is further code movement from the handshake code
that constructs session storage keys/values, into
the StoresClientSessions trait itself.
At this point the usage of StoresClientSessions by handshake code
is completely transparent as to what is being stored, and
the default trait functions map this down to the old opaque
interface.
Prior to this, these parameters were being seperately appended
to the session value. That meant Tls13ClientSessionValue was
misleading as a venue which owned the whole session value encoding.
This also:
- corrects use of hs::incompatible for client certificate verification
failure.
- moves sni varying across hello retries to be a PeerMisbehaved, since
that is explicitly disallowed by the standard.
Stores the parsed data for a handshake message payload alongside
the encoded version to avoid having to re-encode the message when
updating the transcript hash. Also avoids encoding outgoing handshake
message payloads twice.
A common pattern in the code is:
```
check_message(...);
match m.payload {
}
```
The check_message call does its own pattern matching very much like what
is immediately done after. Avoid doing that redundant pattern matching.
- move unconditional extensions into vec construction
- make supported_versions unconditional: it was conditional because
one with zero elements is illegal, but in fact it is a library
invariant that at last one version is configured.
This will prevent link-time elimination of unused cipher suites.
The new approach also prevents double-parsing of the CipherSuite,
at the expense of moving Codec methods to inherent implementations.
It isn't obvious whether `tls12::CompleteServerHelloHandling::session_id` is the
ID from the ClientHello or the ServerHello message (it is the latter). Eliminate
the possibility for confusion by eliminating the field, since it is redundant
with `handle_server_hello()`'s `server_hello` parameter.
This represents the state that state machine `State` implementers
can manipulate. As such, we want the lifetime of references to
`CommonState` to be outlived by the `ConnectionCommon`'s handshake
joiner and deframer.
Avoid introducing any memory barrier through the cloning of the configuration
by avoiding the cloning.
Especially if the user doesn't need to use the config more more than one
connection, the internal clone is wasteful.