[PATCH] [release-branch.go1.15] crypto/tls: test key type when casting
authorRoland Shoemaker <roland@golang.org>
Wed, 9 Jun 2021 18:31:27 +0000 (11:31 -0700)
committerShengjing Zhu <zhsj@debian.org>
Tue, 13 Jul 2021 05:55:42 +0000 (06:55 +0100)
commitb8439c09a718af1a0a05972b27136beccb682b9c
tree6066ef42a6fe847ee9c54cc4dea1870c4e7031c3
parent18d94d85a9cb8ad7416727f4ae4543bd636b306e
[PATCH] [release-branch.go1.15] crypto/tls: test key type when casting

When casting the certificate public key in generateClientKeyExchange,
check the type is appropriate. This prevents a panic when a server
agrees to a RSA based key exchange, but then sends an ECDSA (or
other) certificate.

Updates #47143
Fixes #47144
Fixes CVE-2021-34558

Thanks to Imre Rad for reporting this issue.

Change-Id: Iabccacca6052769a605cccefa1216a9f7b7f6aea
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1116723
Reviewed-by: Filippo Valsorda <valsorda@google.com>
Reviewed-by: Katie Hockman <katiehockman@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/334030
Trust: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Gbp-Pq: Name 0013-CVE-2021-34558.patch
src/crypto/tls/key_agreement.go