]> Cypherpunks repositories - gostls13.git/commit
crypto/tls: fix TLS <1.3 client cert required alert
authorDaniel McCarney <daniel@binaryparadox.net>
Thu, 8 May 2025 19:22:41 +0000 (15:22 -0400)
committerDaniel McCarney <daniel@binaryparadox.net>
Fri, 9 May 2025 20:39:08 +0000 (13:39 -0700)
commitfd605450a7be429efe68aed2271fbd3d40818f8e
tree71ab7bf5cf98725a0a6e8e2bf0a2933d8eb4960f
parent97eab214d14054d9f174ab8b02ec3f7adb9cb2f9
crypto/tls: fix TLS <1.3 client cert required alert

Previously for protocol versions older than TLS 1.3 our server handshake
implementation sent an alertBadCertificate alert in the case where the
server TLS config indicates a client cert is required and none was
received.

This commit updates the relevant logic to instead send
alertHandshakeFailure in these circumstances.

For TLS 1.2, RFC 5246 §7.4.6 unambiguously describes this as the correct
alert:
  If the client does not send any certificates, the
  server MAY at its discretion either continue the handshake without
  client authentication, or respond with a fatal handshake_failure
  alert.

The TLS 1.1 and 1.0 specs also describe using this alert (RFC 4346 §7.4.6
and RFC 2246 §7.4.6) both say:
  If client authentication is required by the server for the handshake
  to continue, it may respond with a fatal handshake failure alert.

Making this correction also allows enabling the
RequireAnyClientCertificate-TLS1* bogo tests.

Updates #72006
Change-Id: I27a2cd231e4b8762b0d9e2dbd3d8ddd5b87fd5c8
Reviewed-on: https://go-review.googlesource.com/c/go/+/671195
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
src/crypto/tls/bogo_config.json
src/crypto/tls/handshake_server.go