Skip to content

Commit

Permalink
Merge pull request #1226 from microsoft/dev/auto-sync/microsoft/main
Browse files Browse the repository at this point in the history
Update submodule to latest `master` in `microsoft/main`
  • Loading branch information
microsoft-golang-review-bot committed May 18, 2024
2 parents 7262f0e + c9e4895 commit 5d030e4
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 42 deletions.
2 changes: 1 addition & 1 deletion go
Submodule go updated 288 files
48 changes: 25 additions & 23 deletions patches/0002-Add-crypto-backend-foundation.patch
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ Subject: [PATCH] Add crypto backend foundation
src/crypto/tls/prf.go | 77 +++++---
src/crypto/tls/prf_test.go | 12 +-
src/crypto/x509/boring_test.go | 5 +
src/go/build/deps_test.go | 3 +
src/go/build/deps_test.go | 4 +
src/net/http/client_test.go | 6 +-
src/net/smtp/smtp_test.go | 72 ++++---
src/runtime/runtime_boring.go | 5 +
52 files changed, 767 insertions(+), 95 deletions(-)
52 files changed, 768 insertions(+), 95 deletions(-)
create mode 100644 src/crypto/ed25519/boring.go
create mode 100644 src/crypto/ed25519/notboring.go
create mode 100644 src/crypto/internal/backend/backend_test.go
Expand Down Expand Up @@ -107,15 +107,15 @@ index 097c37e343fdb8..1cf43edba40359 100644
// Enabled reports whether BoringCrypto handles supported crypto operations.
func Enabled() bool {
diff --git a/src/crypto/des/cipher.go b/src/crypto/des/cipher.go
index b0f456e6921244..0c11654b03405b 100644
index 04b73e7d3bf758..0891652a4566fb 100644
--- a/src/crypto/des/cipher.go
+++ b/src/crypto/des/cipher.go
@@ -7,6 +7,7 @@ package des
import (
"crypto/cipher"
"crypto/internal/alias"
+ boring "crypto/internal/backend"
"encoding/binary"
"internal/byteorder"
"strconv"
)
@@ -30,6 +31,9 @@ func NewCipher(key []byte) (cipher.Block, error) {
Expand Down Expand Up @@ -152,7 +152,7 @@ index b7c26f91e57f02..7a12e2bbaaafd1 100644
"errors"
"io"
diff --git a/src/crypto/ecdh/nist.go b/src/crypto/ecdh/nist.go
index b3664915449b95..c4090a3268e7b7 100644
index b91e8f38a5a78e..2bb8f3486c8249 100644
--- a/src/crypto/ecdh/nist.go
+++ b/src/crypto/ecdh/nist.go
@@ -5,7 +5,7 @@
Expand All @@ -163,7 +163,7 @@ index b3664915449b95..c4090a3268e7b7 100644
+ boring "crypto/internal/backend"
"crypto/internal/nistec"
"crypto/internal/randutil"
"encoding/binary"
"errors"
diff --git a/src/crypto/ecdsa/boring.go b/src/crypto/ecdsa/boring.go
index 275c60b4de49eb..61e70f981db4eb 100644
--- a/src/crypto/ecdsa/boring.go
Expand Down Expand Up @@ -866,17 +866,17 @@ index 00000000000000..5e4b436554d44d
+// from complaining about the missing body
+// (because the implementation might be here).
diff --git a/src/crypto/md5/md5.go b/src/crypto/md5/md5.go
index 83e9e4c07a0a5e..1e6a419587db00 100644
index 843678702bf93f..28f4ae5621921d 100644
--- a/src/crypto/md5/md5.go
+++ b/src/crypto/md5/md5.go
@@ -12,6 +12,7 @@ package md5

import (
"crypto"
+ boring "crypto/internal/backend"
"encoding/binary"
"errors"
"hash"
"internal/byteorder"
@@ -99,6 +100,9 @@ func consumeUint32(b []byte) ([]byte, uint32) {
// implements [encoding.BinaryMarshaler] and [encoding.BinaryUnmarshaler] to
// marshal and unmarshal the internal state of the hash.
Expand Down Expand Up @@ -1109,7 +1109,7 @@ index 2afa045a3a0bd2..86466e67e87eeb 100644
. "crypto/rsa"
"crypto/sha1"
diff --git a/src/crypto/sha1/sha1.go b/src/crypto/sha1/sha1.go
index ac10fa15574f32..7d5fbdecee9af9 100644
index c0742b9d83c527..3c89bd61e5ee2c 100644
--- a/src/crypto/sha1/sha1.go
+++ b/src/crypto/sha1/sha1.go
@@ -10,7 +10,7 @@ package sha1
Expand All @@ -1118,9 +1118,9 @@ index ac10fa15574f32..7d5fbdecee9af9 100644
"crypto"
- "crypto/internal/boring"
+ boring "crypto/internal/backend"
"encoding/binary"
"errors"
"hash"
"internal/byteorder"
diff --git a/src/crypto/sha1/sha1_test.go b/src/crypto/sha1/sha1_test.go
index 85ed12609154ff..bc169888786321 100644
--- a/src/crypto/sha1/sha1_test.go
Expand All @@ -1135,7 +1135,7 @@ index 85ed12609154ff..bc169888786321 100644
"encoding"
"fmt"
diff --git a/src/crypto/sha256/sha256.go b/src/crypto/sha256/sha256.go
index 0cc7fca0a606be..c352fc6351fbf7 100644
index 68244fd63b0c1e..02c597d785ef68 100644
--- a/src/crypto/sha256/sha256.go
+++ b/src/crypto/sha256/sha256.go
@@ -8,7 +8,7 @@ package sha256
Expand All @@ -1144,9 +1144,9 @@ index 0cc7fca0a606be..c352fc6351fbf7 100644
"crypto"
- "crypto/internal/boring"
+ boring "crypto/internal/backend"
"encoding/binary"
"errors"
"hash"
"internal/byteorder"
diff --git a/src/crypto/sha256/sha256_test.go b/src/crypto/sha256/sha256_test.go
index 7304678346b32e..7437655badee23 100644
--- a/src/crypto/sha256/sha256_test.go
Expand All @@ -1161,7 +1161,7 @@ index 7304678346b32e..7437655badee23 100644
"encoding"
"fmt"
diff --git a/src/crypto/sha512/sha512.go b/src/crypto/sha512/sha512.go
index 9ae1b3aae2f013..37a2ae88191ed0 100644
index dde83625f7b852..d2fed3c2bb4533 100644
--- a/src/crypto/sha512/sha512.go
+++ b/src/crypto/sha512/sha512.go
@@ -12,7 +12,7 @@ package sha512
Expand All @@ -1170,9 +1170,9 @@ index 9ae1b3aae2f013..37a2ae88191ed0 100644
"crypto"
- "crypto/internal/boring"
+ boring "crypto/internal/backend"
"encoding/binary"
"errors"
"hash"
"internal/byteorder"
diff --git a/src/crypto/sha512/sha512_test.go b/src/crypto/sha512/sha512_test.go
index 921cdbb7bbd477..2fef7ddae07480 100644
--- a/src/crypto/sha512/sha512_test.go
Expand Down Expand Up @@ -1216,7 +1216,7 @@ index 6f5bc37197a4f4..9079b5a2e3d50d 100644
"crypto/sha1"
"crypto/sha256"
diff --git a/src/crypto/tls/handshake_client.go b/src/crypto/tls/handshake_client.go
index 0b35deefa145e6..718975817cd6c9 100644
index d046c86679ea51..4215d99122e585 100644
--- a/src/crypto/tls/handshake_client.go
+++ b/src/crypto/tls/handshake_client.go
@@ -657,12 +657,16 @@ func (hs *clientHandshakeState) doFullHandshake() error {
Expand Down Expand Up @@ -1278,7 +1278,7 @@ index 0b35deefa145e6..718975817cd6c9 100644
return err
}
diff --git a/src/crypto/tls/handshake_server.go b/src/crypto/tls/handshake_server.go
index eb87ee038c72d0..c8202a18153ea2 100644
index d5f8cc843ed6da..815d80fc9b6ab0 100644
--- a/src/crypto/tls/handshake_server.go
+++ b/src/crypto/tls/handshake_server.go
@@ -676,12 +676,16 @@ func (hs *serverHandshakeState) doFullHandshake() error {
Expand Down Expand Up @@ -1602,26 +1602,28 @@ index 33fd0ed52b1ff6..ffc3eeca9dbf95 100644
k, err := rsa.GenerateKey(rand.Reader, size)
if err != nil {
diff --git a/src/go/build/deps_test.go b/src/go/build/deps_test.go
index 59c0fdde558387..78a6e35e47383c 100644
index ee53b3114031f6..c3320e0e5c648f 100644
--- a/src/go/build/deps_test.go
+++ b/src/go/build/deps_test.go
@@ -430,6 +430,7 @@ var depsRules = `
@@ -431,7 +431,9 @@ var depsRules = `

# CRYPTO is core crypto algorithms - no cgo, fmt, net.
# Unfortunately, stuck with reflect via encoding/binary.
crypto/internal/boring/sig,
+ crypto/internal/boring/fipstls,
crypto/internal/boring/syso,
encoding/binary,
+ encoding/binary,
golang.org/x/sys/cpu,
@@ -442,6 +443,7 @@ var depsRules = `
hash, embed
< crypto
@@ -442,6 +444,7 @@ var depsRules = `
crypto/cipher,
crypto/internal/boring/bcache
< crypto/internal/boring
+ < crypto/internal/backend
< crypto/boring;

crypto/internal/alias
@@ -475,6 +477,7 @@ var depsRules = `
@@ -479,6 +482,7 @@ var depsRules = `
# CRYPTO-MATH is core bignum-based crypto - no cgo, net; fmt now ok.
CRYPTO, FMT, math/big
< crypto/internal/boring/bbig
Expand All @@ -1630,7 +1632,7 @@ index 59c0fdde558387..78a6e35e47383c 100644
< crypto/internal/mlkem768
< crypto/ed25519
diff --git a/src/net/http/client_test.go b/src/net/http/client_test.go
index 569b58ca6225c9..8e692fd60a095b 100644
index 33e69467c6a3f4..7b186b39c2bb4f 100644
--- a/src/net/http/client_test.go
+++ b/src/net/http/client_test.go
@@ -946,7 +946,9 @@ func testResponseSetsTLSConnectionState(t *testing.T, mode testMode) {
Expand Down
26 changes: 13 additions & 13 deletions patches/0005-Add-CNG-crypto-backend.patch
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ index 1dc7116efdff2e..b4c321d1d2babb 100644
// runtime_arg0 is declared in tls.go without a body.
// It's provided by package runtime,
diff --git a/src/crypto/internal/boring/fipstls/tls.go b/src/crypto/internal/boring/fipstls/tls.go
index 4e629a4db8f7c7..a7cd24a0d15647 100644
index f5b4827c688f3b..12df96069f6b83 100644
--- a/src/crypto/internal/boring/fipstls/tls.go
+++ b/src/crypto/internal/boring/fipstls/tls.go
@@ -2,7 +2,7 @@
Expand Down Expand Up @@ -838,10 +838,10 @@ index bc169888786321..e0d6f4c5040d91 100644

h := New()
diff --git a/src/crypto/sha256/sha256.go b/src/crypto/sha256/sha256.go
index c352fc6351fbf7..a3906bff3e13fb 100644
index 02c597d785ef68..268f1fdd49ecd3 100644
--- a/src/crypto/sha256/sha256.go
+++ b/src/crypto/sha256/sha256.go
@@ -158,7 +158,7 @@ func New() hash.Hash {
@@ -153,7 +153,7 @@ func New() hash.Hash {

// New224 returns a new hash.Hash computing the SHA224 checksum.
func New224() hash.Hash {
Expand All @@ -850,7 +850,7 @@ index c352fc6351fbf7..a3906bff3e13fb 100644
return boring.NewSHA224()
}
d := new(digest)
@@ -177,7 +177,9 @@ func (d *digest) Size() int {
@@ -172,7 +172,9 @@ func (d *digest) Size() int {
func (d *digest) BlockSize() int { return BlockSize }

func (d *digest) Write(p []byte) (nn int, err error) {
Expand All @@ -861,7 +861,7 @@ index c352fc6351fbf7..a3906bff3e13fb 100644
nn = len(p)
d.len += uint64(nn)
if d.nx > 0 {
@@ -201,7 +203,9 @@ func (d *digest) Write(p []byte) (nn int, err error) {
@@ -196,7 +198,9 @@ func (d *digest) Write(p []byte) (nn int, err error) {
}

func (d *digest) Sum(in []byte) []byte {
Expand All @@ -872,7 +872,7 @@ index c352fc6351fbf7..a3906bff3e13fb 100644
// Make a copy of d so that caller can keep writing and summing.
d0 := *d
hash := d0.checkSum()
@@ -262,7 +266,7 @@ func Sum256(data []byte) [Size]byte {
@@ -257,7 +261,7 @@ func Sum256(data []byte) [Size]byte {

// Sum224 returns the SHA224 checksum of the data.
func Sum224(data []byte) [Size224]byte {
Expand Down Expand Up @@ -1018,13 +1018,13 @@ index 9c1d3d279c472f..0ca7a863b73690 100644
package fipsonly

diff --git a/src/crypto/tls/handshake_server_tls13.go b/src/crypto/tls/handshake_server_tls13.go
index 21d798de37db0a..6c65da0ab04f9f 100644
index 7f15d05b288170..6cd5a57016fe7c 100644
--- a/src/crypto/tls/handshake_server_tls13.go
+++ b/src/crypto/tls/handshake_server_tls13.go
@@ -13,6 +13,7 @@ import (
"encoding/binary"
"errors"
"hash"
"internal/byteorder"
+ "internal/goexperiment"
"io"
"time"
Expand Down Expand Up @@ -1098,7 +1098,7 @@ index a0548a7f9179c5..ae6117a1554b7f 100644
package x509

diff --git a/src/go.mod b/src/go.mod
index 2beaccb4bf11e2..f4725710819882 100644
index 87e9c5ffbbffd2..4b362696c57e8a 100644
--- a/src/go.mod
+++ b/src/go.mod
@@ -4,6 +4,7 @@ go 1.23
Expand All @@ -1110,7 +1110,7 @@ index 2beaccb4bf11e2..f4725710819882 100644
golang.org/x/net v0.24.1-0.20240405221309-ec05fdcd7114
)
diff --git a/src/go.sum b/src/go.sum
index f5dd98dedf2f66..5160110cdb6b7c 100644
index 354008e0265c80..cecd373aab5a04 100644
--- a/src/go.sum
+++ b/src/go.sum
@@ -1,5 +1,7 @@
Expand All @@ -1122,7 +1122,7 @@ index f5dd98dedf2f66..5160110cdb6b7c 100644
golang.org/x/crypto v0.22.1-0.20240415215343-5defcc193aab/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M=
golang.org/x/net v0.24.1-0.20240405221309-ec05fdcd7114 h1:0+DQSN4OXt0ivfKIOXFQ+8vsRb1pNvvdl7DZ6AR07OQ=
diff --git a/src/go/build/deps_test.go b/src/go/build/deps_test.go
index 5f1e639335fa02..769b4e4f2c41e2 100644
index 7dae95ff2e5857..130ab718486f71 100644
--- a/src/go/build/deps_test.go
+++ b/src/go/build/deps_test.go
@@ -442,6 +442,10 @@ var depsRules = `
Expand All @@ -1136,7 +1136,7 @@ index 5f1e639335fa02..769b4e4f2c41e2 100644
< github.com/golang-fips/openssl/v2/internal/subtle
< github.com/golang-fips/openssl/v2
< crypto/internal/boring
@@ -478,6 +482,7 @@ var depsRules = `
@@ -482,6 +486,7 @@ var depsRules = `

# CRYPTO-MATH is core bignum-based crypto - no cgo, net; fmt now ok.
CRYPTO, FMT, math/big
Expand Down Expand Up @@ -1222,7 +1222,7 @@ index 00000000000000..99ee2542ca38a9
+const CNGCrypto = true
+const CNGCryptoInt = 1
diff --git a/src/internal/goexperiment/flags.go b/src/internal/goexperiment/flags.go
index e58baf9fa0ef4e..eb7871b0769055 100644
index 995c405fb54d2b..9c6bb5b4bedfe6 100644
--- a/src/internal/goexperiment/flags.go
+++ b/src/internal/goexperiment/flags.go
@@ -60,6 +60,7 @@ type Flags struct {
Expand Down
9 changes: 4 additions & 5 deletions patches/0013-remove-long-path-support-hack.patch
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,31 @@ process, so this this is a breaking change for the Microsoft Go fork.
Note that the Go standard library makes a best effort to support long
paths by using the `\\?\` prefix when possible, so this change should
only affect long relative paths, which can't be used with the `\\?\`.

---
src/runtime/os_windows.go | 23 +----------------------
1 file changed, 1 insertion(+), 22 deletions(-)

diff --git a/src/runtime/os_windows.go b/src/runtime/os_windows.go
index 1267afc003cc36..a6440484137bf3 100644
index fc7296f28ab12f..d3e0149c90febc 100644
--- a/src/runtime/os_windows.go
+++ b/src/runtime/os_windows.go
@@ -134,7 +134,6 @@ var (
@@ -136,7 +136,6 @@ var (
_NtCreateWaitCompletionPacket stdFunction
_NtAssociateWaitCompletionPacket stdFunction
_NtCancelWaitCompletionPacket stdFunction
- _RtlGetCurrentPeb stdFunction
_RtlGetVersion stdFunction

// These are from non-kernel32.dll, so we prefer to LoadLibraryEx them.
@@ -268,7 +267,6 @@ func loadOptionalSyscalls() {
@@ -286,7 +285,6 @@ func loadOptionalSyscalls() {
throw("NtCreateWaitCompletionPacket exists but NtCancelWaitCompletionPacket does not")
}
}
- _RtlGetCurrentPeb = windowsFindfunc(n32, []byte("RtlGetCurrentPeb\000"))
_RtlGetVersion = windowsFindfunc(n32, []byte("RtlGetVersion\000"))
}

@@ -432,26 +430,7 @@ var canUseLongPaths bool
@@ -450,26 +448,7 @@ var canUseLongPaths bool

// initLongPathSupport enables long path support.
func initLongPathSupport() {
Expand Down

0 comments on commit 5d030e4

Please sign in to comment.