crypto/tls: add verifiedChains expiration checking during resumption

When resuming a session, check that the verifiedChains contain at least
one chain that is still valid at the time of resumption. If not, trigger
a new handshake.

Updates #77113
Updates #77217
Updates CVE-2025-68121

Change-Id: I14f585c43da17802513cbdd5b10c552d7a38b34e
Reviewed-on: https://go-review.googlesource.com/c/go/+/739321
Reviewed-by: Coia Prant <coiaprant@gmail.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Auto-Submit: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
This commit is contained in:
yuhan6665
2026-09-08 21:33:46 -04:00
parent 7103a0cf07
commit f07a54079c
4 changed files with 22 additions and 5 deletions
+13
View File
@@ -1880,3 +1880,16 @@ func fipsAllowChain(chain []*x509.Certificate) bool {
return true
}
// anyUnexpiredChain reports if at least one of verifiedChains is still
// unexpired. If verifiedChains is empty, it returns false.
func anyUnexpiredChain(verifiedChains [][]*x509.Certificate, now time.Time) bool {
for _, chain := range verifiedChains {
if len(chain) != 0 && !slices.ContainsFunc(chain, func(cert *x509.Certificate) bool {
return now.Before(cert.NotBefore) || now.After(cert.NotAfter) // cert is expired
}) {
return true
}
}
return false
}