summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/go/go-1.14/CVE-2021-34558.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/go/go-1.14/CVE-2021-34558.patch')
-rw-r--r--meta/recipes-devtools/go/go-1.14/CVE-2021-34558.patch51
1 files changed, 51 insertions, 0 deletions
diff --git a/meta/recipes-devtools/go/go-1.14/CVE-2021-34558.patch b/meta/recipes-devtools/go/go-1.14/CVE-2021-34558.patch
new file mode 100644
index 0000000000..8fb346d622
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.14/CVE-2021-34558.patch
@@ -0,0 +1,51 @@
1From a98589711da5e9d935e8d690cfca92892e86d557 Mon Sep 17 00:00:00 2001
2From: Roland Shoemaker <roland@golang.org>
3Date: Wed, 9 Jun 2021 11:31:27 -0700
4Subject: [PATCH] crypto/tls: test key type when casting
5
6When casting the certificate public key in generateClientKeyExchange,
7check the type is appropriate. This prevents a panic when a server
8agrees to a RSA based key exchange, but then sends an ECDSA (or
9other) certificate.
10
11Fixes #47143
12Fixes CVE-2021-34558
13
14Thanks to Imre Rad for reporting this issue.
15
16Change-Id: Iabccacca6052769a605cccefa1216a9f7b7f6aea
17Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1116723
18Reviewed-by: Filippo Valsorda <valsorda@google.com>
19Reviewed-by: Katie Hockman <katiehockman@google.com>
20Reviewed-on: https://go-review.googlesource.com/c/go/+/334031
21Trust: Filippo Valsorda <filippo@golang.org>
22Run-TryBot: Filippo Valsorda <filippo@golang.org>
23TryBot-Result: Go Bot <gobot@golang.org>
24Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
25
26Upstream-Status: Backport
27https://github.com/golang/go/commit/a98589711da5e9d935e8d690cfca92892e86d557
28CVE: CVE-2021-34558
29Signed-off-by: Armin Kuster <akuster@mvista.com>
30
31---
32 src/crypto/tls/key_agreement.go | 6 +++++-
33 1 file changed, 5 insertions(+), 1 deletion(-)
34
35Index: go/src/crypto/tls/key_agreement.go
36===================================================================
37--- go.orig/src/crypto/tls/key_agreement.go
38+++ go/src/crypto/tls/key_agreement.go
39@@ -67,7 +67,11 @@ func (ka rsaKeyAgreement) generateClient
40 return nil, nil, err
41 }
42
43- encrypted, err := rsa.EncryptPKCS1v15(config.rand(), cert.PublicKey.(*rsa.PublicKey), preMasterSecret)
44+ rsaKey, ok := cert.PublicKey.(*rsa.PublicKey)
45+ if !ok {
46+ return nil, nil, errors.New("tls: server certificate contains incorrect key type for selected ciphersuite")
47+ }
48+ encrypted, err := rsa.EncryptPKCS1v15(config.rand(), rsaKey, preMasterSecret)
49 if err != nil {
50 return nil, nil, err
51 }