Skip to content

Commit 9e972fa

Browse files
author
microsoft-golang-review-bot
authored
Merge pull request #1516 from microsoft/dev/auto-sync/microsoft/main
Update submodule to latest `master` in `microsoft/main`
2 parents 423691a + 45cf16f commit 9e972fa

File tree

3 files changed

+70
-61
lines changed

3 files changed

+70
-61
lines changed

go

Submodule go updated 465 files

patches/0001-Add-crypto-backend-GOEXPERIMENTs.patch

Lines changed: 28 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ information about the behavior.
1111
Includes new tests in "build_test.go" and "buildbackend_test.go" to help
1212
maintain this feature. For more information, see the test files.
1313
---
14-
src/cmd/go/internal/modindex/build.go | 57 +++++++++++++
14+
src/cmd/go/internal/modindex/build.go | 58 ++++++++++++-
1515
src/cmd/go/internal/modindex/build_test.go | 73 ++++++++++++++++
16-
src/go/build/build.go | 57 +++++++++++++
16+
src/go/build/build.go | 58 ++++++++++++-
1717
src/go/build/buildbackend_test.go | 84 +++++++++++++++++++
1818
.../testdata/backendtags_openssl/main.go | 3 +
1919
.../testdata/backendtags_openssl/openssl.go | 3 +
@@ -28,7 +28,7 @@ maintain this feature. For more information, see the test files.
2828
.../goexperiment/exp_systemcrypto_off.go | 8 ++
2929
.../goexperiment/exp_systemcrypto_on.go | 8 ++
3030
src/internal/goexperiment/flags.go | 18 ++++
31-
17 files changed, 365 insertions(+)
31+
17 files changed, 363 insertions(+), 4 deletions(-)
3232
create mode 100644 src/cmd/go/internal/modindex/build_test.go
3333
create mode 100644 src/go/build/buildbackend_test.go
3434
create mode 100644 src/go/build/testdata/backendtags_openssl/main.go
@@ -45,10 +45,10 @@ maintain this feature. For more information, see the test files.
4545
create mode 100644 src/internal/goexperiment/exp_systemcrypto_on.go
4646

4747
diff --git a/src/cmd/go/internal/modindex/build.go b/src/cmd/go/internal/modindex/build.go
48-
index b4dacb0f523a8d..4315c288d10cb3 100644
48+
index d7e09fed25f43a..10614d17e62453 100644
4949
--- a/src/cmd/go/internal/modindex/build.go
5050
+++ b/src/cmd/go/internal/modindex/build.go
51-
@@ -886,13 +886,70 @@ func (ctxt *Context) matchTag(name string, allTags map[string]bool) bool {
51+
@@ -887,9 +887,63 @@ func (ctxt *Context) matchTag(name string, allTags map[string]bool) bool {
5252
name = "goexperiment.boringcrypto" // boringcrypto is an old name for goexperiment.boringcrypto
5353
}
5454

@@ -79,6 +79,9 @@ index b4dacb0f523a8d..4315c288d10cb3 100644
7979
+ (ctxt.GOOS == "windows" && name == cng) ||
8080
+ (ctxt.GOOS == "darwin" && name == darwin)
8181
+ satisfiedBy := func(tag string) bool {
82+
+ if name == tag {
83+
+ return true
84+
+ }
8285
+ if satisfiedByAnyBackend {
8386
+ switch tag {
8487
+ case openssl, cng, darwin, boring:
@@ -104,21 +107,13 @@ index b4dacb0f523a8d..4315c288d10cb3 100644
104107
+ }
105108
+
106109
// other tags
107-
for _, tag := range ctxt.BuildTags {
108-
+ if satisfiedBy(tag) {
109-
+ return true
110-
+ }
111-
if tag == name {
112-
return true
113-
}
114-
}
115-
for _, tag := range ctxt.ToolTags {
116-
+ if satisfiedBy(tag) {
117-
+ return true
118-
+ }
119-
if tag == name {
120-
return true
121-
}
110+
- return slices.Contains(ctxt.BuildTags, name) || slices.Contains(ctxt.ToolTags, name) ||
111+
- slices.Contains(ctxt.ReleaseTags, name)
112+
+ return slices.ContainsFunc(ctxt.BuildTags, satisfiedBy) || slices.ContainsFunc(ctxt.ToolTags, satisfiedBy) ||
113+
+ slices.ContainsFunc(ctxt.ReleaseTags, satisfiedBy)
114+
}
115+
116+
// goodOSArchFile returns false if the name contains a $GOOS or $GOARCH
122117
diff --git a/src/cmd/go/internal/modindex/build_test.go b/src/cmd/go/internal/modindex/build_test.go
123118
new file mode 100644
124119
index 00000000000000..1756c5d027fee0
@@ -199,10 +194,10 @@ index 00000000000000..1756c5d027fee0
199194
+ }
200195
+}
201196
diff --git a/src/go/build/build.go b/src/go/build/build.go
202-
index 9ffffda08a99b1..78fd536fa6a6d1 100644
197+
index 0e5c7e512d794c..21da6ac79e606e 100644
203198
--- a/src/go/build/build.go
204199
+++ b/src/go/build/build.go
205-
@@ -1984,13 +1984,70 @@ func (ctxt *Context) matchTag(name string, allTags map[string]bool) bool {
200+
@@ -1984,9 +1984,63 @@ func (ctxt *Context) matchTag(name string, allTags map[string]bool) bool {
206201
name = "goexperiment.boringcrypto" // boringcrypto is an old name for goexperiment.boringcrypto
207202
}
208203

@@ -233,6 +228,9 @@ index 9ffffda08a99b1..78fd536fa6a6d1 100644
233228
+ (ctxt.GOOS == "windows" && name == cng) ||
234229
+ (ctxt.GOOS == "darwin" && name == darwin)
235230
+ satisfiedBy := func(tag string) bool {
231+
+ if name == tag {
232+
+ return true
233+
+ }
236234
+ if satisfiedByAnyBackend {
237235
+ switch tag {
238236
+ case openssl, cng, darwin, boring:
@@ -258,21 +256,13 @@ index 9ffffda08a99b1..78fd536fa6a6d1 100644
258256
+ }
259257
+
260258
// other tags
261-
for _, tag := range ctxt.BuildTags {
262-
+ if satisfiedBy(tag) {
263-
+ return true
264-
+ }
265-
if tag == name {
266-
return true
267-
}
268-
}
269-
for _, tag := range ctxt.ToolTags {
270-
+ if satisfiedBy(tag) {
271-
+ return true
272-
+ }
273-
if tag == name {
274-
return true
275-
}
259+
- return slices.Contains(ctxt.BuildTags, name) || slices.Contains(ctxt.ToolTags, name) ||
260+
- slices.Contains(ctxt.ReleaseTags, name)
261+
+ return slices.ContainsFunc(ctxt.BuildTags, satisfiedBy) || slices.ContainsFunc(ctxt.ToolTags, satisfiedBy) ||
262+
+ slices.ContainsFunc(ctxt.ReleaseTags, satisfiedBy)
263+
}
264+
265+
// goodOSArchFile returns false if the name contains a $GOOS or $GOARCH
276266
diff --git a/src/go/build/buildbackend_test.go b/src/go/build/buildbackend_test.go
277267
new file mode 100644
278268
index 00000000000000..aa3c5f1007ed79
@@ -512,7 +502,7 @@ index 00000000000000..fcd4cb9da0d162
512502
+const SystemCrypto = true
513503
+const SystemCryptoInt = 1
514504
diff --git a/src/internal/goexperiment/flags.go b/src/internal/goexperiment/flags.go
515-
index 31b3d0315b64f8..e6c9b7d5e62dc0 100644
505+
index dff5255e000992..4d0fbdffd44957 100644
516506
--- a/src/internal/goexperiment/flags.go
517507
+++ b/src/internal/goexperiment/flags.go
518508
@@ -59,6 +59,24 @@ type Flags struct {

patches/0004-Use-crypto-backends.patch

Lines changed: 41 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ Subject: [PATCH] Use crypto backends
4343
src/crypto/internal/fips140test/check_test.go | 8 +-
4444
src/crypto/md5/md5.go | 10 +
4545
src/crypto/md5/md5_test.go | 16 ++
46-
src/crypto/pbkdf2/pbkdf2.go | 4 +
47-
src/crypto/pbkdf2/pbkdf2_test.go | 2 +-
46+
src/crypto/pbkdf2/pbkdf2.go | 7 +
47+
src/crypto/pbkdf2/pbkdf2_test.go | 6 +-
4848
src/crypto/purego_test.go | 2 +-
4949
src/crypto/rand/rand.go | 2 +-
5050
src/crypto/rc4/rc4.go | 18 ++
@@ -85,7 +85,7 @@ Subject: [PATCH] Use crypto backends
8585
src/net/smtp/smtp_test.go | 72 ++++---
8686
src/os/exec/exec_test.go | 9 +
8787
src/runtime/pprof/vminfo_darwin_test.go | 6 +
88-
81 files changed, 1131 insertions(+), 112 deletions(-)
88+
81 files changed, 1138 insertions(+), 112 deletions(-)
8989
create mode 100644 src/crypto/dsa/boring.go
9090
create mode 100644 src/crypto/dsa/notboring.go
9191
create mode 100644 src/crypto/ecdsa/badlinkname.go
@@ -135,10 +135,10 @@ index 1f467647f56143..4d770d7fc239e2 100644
135135
// No need to enable PGO for toolchain2.
136136
goInstall(toolenv(), goBootstrap, append([]string{"-pgo=off"}, toolchain...)...)
137137
diff --git a/src/cmd/dist/test.go b/src/cmd/dist/test.go
138-
index 0c992118f4287b..d224514552fd63 100644
138+
index 005e1da86a1dc2..7536a83a124740 100644
139139
--- a/src/cmd/dist/test.go
140140
+++ b/src/cmd/dist/test.go
141-
@@ -714,7 +714,7 @@ func (t *tester) registerTests() {
141+
@@ -710,7 +710,7 @@ func (t *tester) registerTests() {
142142
})
143143

144144
// Check that all crypto packages compile (and test correctly, in longmode) with fips.
@@ -147,7 +147,7 @@ index 0c992118f4287b..d224514552fd63 100644
147147
// Test standard crypto packages with fips140=on.
148148
t.registerTest("GODEBUG=fips140=on go test crypto/...", &goTest{
149149
variant: "gofips140",
150-
@@ -1161,6 +1161,11 @@ func (t *tester) internalLink() bool {
150+
@@ -1165,6 +1165,11 @@ func (t *tester) internalLink() bool {
151151
if goos == "windows" && goarch == "arm64" {
152152
return false
153153
}
@@ -159,7 +159,7 @@ index 0c992118f4287b..d224514552fd63 100644
159159
// Internally linking cgo is incomplete on some architectures.
160160
// https://golang.org/issue/10373
161161
// https://golang.org/issue/14449
162-
@@ -1324,12 +1329,11 @@ func (t *tester) registerCgoTests(heading string) {
162+
@@ -1328,12 +1333,11 @@ func (t *tester) registerCgoTests(heading string) {
163163
// a C linker warning on Linux.
164164
// in function `bio_ip_and_port_to_socket_and_addr':
165165
// warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
@@ -284,7 +284,7 @@ index 2d8f964f3594c6..a587e1abde57c9 100644
284284
"crypto/internal/boring/syso",
285285
"crypto/x509",
286286
diff --git a/src/cmd/link/internal/ld/main.go b/src/cmd/link/internal/ld/main.go
287-
index 7614b6d194facf..f0f53ab2bab047 100644
287+
index 377dcd6c856fa6..1744ff2ca38973 100644
288288
--- a/src/cmd/link/internal/ld/main.go
289289
+++ b/src/cmd/link/internal/ld/main.go
290290
@@ -44,6 +44,7 @@ import (
@@ -295,7 +295,7 @@ index 7614b6d194facf..f0f53ab2bab047 100644
295295
"strconv"
296296
"strings"
297297
)
298-
@@ -185,7 +186,16 @@ func Main(arch *sys.Arch, theArch Arch) {
298+
@@ -186,7 +187,16 @@ func Main(arch *sys.Arch, theArch Arch) {
299299

300300
buildVersion := buildcfg.Version
301301
if goexperiment := buildcfg.Experiment.String(); goexperiment != "" {
@@ -314,7 +314,7 @@ index 7614b6d194facf..f0f53ab2bab047 100644
314314
addstrdata1(ctxt, "runtime.buildVersion="+buildVersion)
315315

316316
diff --git a/src/crypto/aes/aes.go b/src/crypto/aes/aes.go
317-
index 5bc2d13d673e0a..b803c77be62a66 100644
317+
index 22ea8819ed239a..1e2cba08c1c760 100644
318318
--- a/src/crypto/aes/aes.go
319319
+++ b/src/crypto/aes/aes.go
320320
@@ -15,7 +15,7 @@ package aes
@@ -730,7 +730,7 @@ index acef8298943c2b..ca6171cf775117 100644
730730
"errors"
731731
diff --git a/src/crypto/ecdsa/badlinkname.go b/src/crypto/ecdsa/badlinkname.go
732732
new file mode 100644
733-
index 00000000000000..1dc05d09b2062d
733+
index 00000000000000..168efdb820c85b
734734
--- /dev/null
735735
+++ b/src/crypto/ecdsa/badlinkname.go
736736
@@ -0,0 +1,19 @@
@@ -1146,7 +1146,7 @@ index 6b02522866d57f..37e67ec184af5d 100644
11461146
}
11471147

11481148
diff --git a/src/crypto/hkdf/hkdf_test.go b/src/crypto/hkdf/hkdf_test.go
1149-
index 201b440289bb2d..4ed4960ff35b66 100644
1149+
index 57d90f88e93e75..4069ab057a2525 100644
11501150
--- a/src/crypto/hkdf/hkdf_test.go
11511151
+++ b/src/crypto/hkdf/hkdf_test.go
11521152
@@ -6,7 +6,7 @@ package hkdf
@@ -1337,7 +1337,7 @@ index 437d9b9d4c0e0d..50728df60ea7ec 100644
13371337
continue
13381338
}
13391339
diff --git a/src/crypto/pbkdf2/pbkdf2.go b/src/crypto/pbkdf2/pbkdf2.go
1340-
index 271d2b03312ef0..ff76299fbe4782 100644
1340+
index dd5fc33f2120c3..7ce0da53887a40 100644
13411341
--- a/src/crypto/pbkdf2/pbkdf2.go
13421342
+++ b/src/crypto/pbkdf2/pbkdf2.go
13431343
@@ -11,6 +11,7 @@
@@ -1348,20 +1348,23 @@ index 271d2b03312ef0..ff76299fbe4782 100644
13481348
"crypto/internal/fips140/pbkdf2"
13491349
"crypto/internal/fips140hash"
13501350
"crypto/internal/fips140only"
1351-
@@ -47,5 +48,8 @@ func Key[Hash hash.Hash](h func() Hash, password string, salt []byte, iter, keyL
1351+
@@ -50,5 +51,11 @@ func Key[Hash hash.Hash](h func() Hash, password string, salt []byte, iter, keyL
13521352
return nil, errors.New("crypto/pbkdf2: use of hash functions other than SHA-2 or SHA-3 is not allowed in FIPS 140-only mode")
13531353
}
13541354
}
13551355
+ if boring.Enabled && boring.SupportsPBKDF2() {
1356+
+ if keyLength <= 0 {
1357+
+ return nil, errors.New("pkbdf2: keyLength must be larger than 0")
1358+
+ }
13561359
+ return boring.PBKDF2([]byte(password), salt, iter, keyLength, fh)
13571360
+ }
13581361
return pbkdf2.Key(fh, password, salt, iter, keyLength)
13591362
}
13601363
diff --git a/src/crypto/pbkdf2/pbkdf2_test.go b/src/crypto/pbkdf2/pbkdf2_test.go
1361-
index 03980c7e54d3be..4968a666fad4e5 100644
1364+
index eb0ed14e243c6b..cd7223c89eeae5 100644
13621365
--- a/src/crypto/pbkdf2/pbkdf2_test.go
13631366
+++ b/src/crypto/pbkdf2/pbkdf2_test.go
1364-
@@ -6,7 +6,7 @@ package pbkdf2_test
1367+
@@ -6,12 +6,13 @@ package pbkdf2_test
13651368

13661369
import (
13671370
"bytes"
@@ -1370,6 +1373,22 @@ index 03980c7e54d3be..4968a666fad4e5 100644
13701373
"crypto/internal/fips140"
13711374
"crypto/pbkdf2"
13721375
"crypto/sha1"
1376+
"crypto/sha256"
1377+
"hash"
1378+
+ "internal/goexperiment"
1379+
"testing"
1380+
)
1381+
1382+
@@ -223,6 +224,9 @@ func TestPBKDF2ServiceIndicator(t *testing.T) {
1383+
}
1384+
1385+
func TestMaxKeyLength(t *testing.T) {
1386+
+ if goexperiment.SystemCrypto {
1387+
+ t.Skip("Some backends don't support keys longer than 32 bytes")
1388+
+ }
1389+
// This error cannot be triggered on platforms where int is 31 bits (i.e.
1390+
// 32-bit platforms), since the max value for keyLength is 1<<31-1 and
1391+
// 1<<31-1 * hLen will always be less than 1<<32-1 * hLen.
13731392
diff --git a/src/crypto/purego_test.go b/src/crypto/purego_test.go
13741393
index 62be347e0c6822..d284b5cf7814a6 100644
13751394
--- a/src/crypto/purego_test.go
@@ -2200,7 +2219,7 @@ index 7c75977ad3ffb2..b9db95ca7b9d5a 100644
22002219

22012220
if err := hs.processClientHello(); err != nil {
22022221
diff --git a/src/crypto/tls/handshake_server_tls13.go b/src/crypto/tls/handshake_server_tls13.go
2203-
index 76fff6974e7403..3ef8b56e5c7898 100644
2222+
index b6d455cd397e31..c8f1c4ad43fdc3 100644
22042223
--- a/src/crypto/tls/handshake_server_tls13.go
22052224
+++ b/src/crypto/tls/handshake_server_tls13.go
22062225
@@ -8,13 +8,14 @@ import (
@@ -2295,7 +2314,7 @@ index 24d78d60cf5b64..0b87185683ab8b 100644
22952314
}
22962315
diff --git a/src/crypto/tls/internal/tls13/doc.go b/src/crypto/tls/internal/tls13/doc.go
22972316
new file mode 100644
2298-
index 00000000000000..1adf3098356307
2317+
index 00000000000000..acfa551001af9c
22992318
--- /dev/null
23002319
+++ b/src/crypto/tls/internal/tls13/doc.go
23012320
@@ -0,0 +1,18 @@
@@ -2588,10 +2607,10 @@ index e7369542a73270..ff52175e4ac636 100644
25882607
}
25892608
}
25902609
diff --git a/src/go/build/deps_test.go b/src/go/build/deps_test.go
2591-
index e4e07843c8ce55..87e92a5d6d1ee9 100644
2610+
index f9c403aba45f5c..c956d394776ea0 100644
25922611
--- a/src/go/build/deps_test.go
25932612
+++ b/src/go/build/deps_test.go
2594-
@@ -510,7 +510,7 @@ var depsRules = `
2613+
@@ -520,7 +520,7 @@ var depsRules = `
25952614
< crypto/internal/backend/internal/opensslsetup
25962615
< crypto/internal/backend/fips140;
25972616

@@ -2600,15 +2619,15 @@ index e4e07843c8ce55..87e92a5d6d1ee9 100644
26002619

26012620
crypto, hash !< FIPS;
26022621

2603-
@@ -551,6 +551,7 @@ var depsRules = `
2622+
@@ -565,6 +565,7 @@ var depsRules = `
26042623
crypto/pbkdf2,
26052624
crypto/ecdh,
26062625
crypto/mlkem
26072626
+ < crypto/tls/internal/tls13
26082627
< CRYPTO;
26092628

26102629
CGO, fmt, net !< CRYPTO;
2611-
@@ -576,7 +577,7 @@ var depsRules = `
2630+
@@ -594,7 +595,7 @@ var depsRules = `
26122631

26132632
# TLS, Prince of Dependencies.
26142633

0 commit comments

Comments
 (0)