+35
−13
+13
−0
Loading
Independent review (HIGH): resetTLS() never cleared peer_rsa/peer_ec_pub/
peer_ec_curve/peer_ec_pub_raw, and the RSA branch of the TLS1.3 Certificate
handler never cleared peer_ec_curve either. On an ssl object reused across
two connect() calls (e.g. A with a P-384 cert, then close+connect to B
with an RSA cert), the CertificateVerify dispatch checked sigAlg only
against peer_ec_curve/peer_rsa -- fields that could still hold connection
A's values if some clearing step were missed, letting a mismatched
sigAlg slip through.
Extracts the dispatch's matching logic into tls::sigAlgMatchesLeafKey(),
gated on server_cert_is_ecdsa (always set fresh from *this* handshake's
own Certificate message) rather than trusting the cached key fields
alone -- so the check holds even if some field isn't cleared. resetTLS()
and the RSA/EC Certificate branches now clear the peer state anyway, as
defense in depth.
Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com>