@@ -4,6 +4,7 @@ Date: Tue, 17 Dec 2024 13:17:39 +0000
44Subject: [PATCH] Add Darwin crypto backend
55
66---
7+ .gitignore | 2 +
78 src/crypto/ecdsa/ecdsa.go | 6 +-
89 src/crypto/ed25519/ed25519_test.go | 3 +-
910 .../internal/backend/bbig/big_darwin.go | 12 +
@@ -21,19 +22,32 @@ Subject: [PATCH] Add Darwin crypto backend
2122 .../goexperiment/exp_darwincrypto_off.go | 9 +
2223 .../goexperiment/exp_darwincrypto_on.go | 9 +
2324 src/internal/goexperiment/flags.go | 1 +
24- 17 files changed, 502 insertions(+), 13 deletions(-)
25+ 18 files changed, 504 insertions(+), 13 deletions(-)
2526 create mode 100644 src/crypto/internal/backend/bbig/big_darwin.go
2627 create mode 100644 src/crypto/internal/backend/darwin_darwin.go
2728 create mode 100644 src/crypto/internal/backend/fips140/darwin.go
2829 create mode 100644 src/crypto/rsa/darwin.go
2930 create mode 100644 src/internal/goexperiment/exp_darwincrypto_off.go
3031 create mode 100644 src/internal/goexperiment/exp_darwincrypto_on.go
3132
33+ diff --git a/.gitignore b/.gitignore
34+ index c6512e64a4ef39..b3b01db73b009d 100644
35+ --- a/.gitignore
36+ +++ b/.gitignore
37+ @@ -46,6 +46,8 @@ _testmain.go
38+ /test/run.out
39+ /test/times.out
40+
41+ + !/src/vendor/github.com/microsoft/go-crypto-darwin/internal/cryptokit/CryptoKit.o
42+ +
43+ # This file includes artifacts of Go build that should not be checked in.
44+ # For files created by specific development environment (e.g. editor),
45+ # use alternative ways to exclude files from git.
3246diff --git a/src/crypto/ecdsa/ecdsa.go b/src/crypto/ecdsa/ecdsa.go
33- index 41ac17df22d7d7..84a7ba02c88620 100644
47+ index 049da55bd70f2c..cd075f0efbc744 100644
3448--- a/src/crypto/ecdsa/ecdsa.go
3549+++ b/src/crypto/ecdsa/ecdsa.go
36- @@ -159 ,7 +159 ,7 @@ func (priv *PrivateKey) Sign(rand io.Reader, digest []byte, opts crypto.SignerOp
50+ @@ -161 ,7 +161 ,7 @@ func (priv *PrivateKey) Sign(rand io.Reader, digest []byte, opts crypto.SignerOp
3751 func GenerateKey(c elliptic.Curve, rand io.Reader) (*PrivateKey, error) {
3852 randutil.MaybeReadByte(rand)
3953
@@ -42,7 +56,7 @@ index 41ac17df22d7d7..84a7ba02c88620 100644
4256 x, y, d, err := boring.GenerateKeyECDSA(c.Params().Name)
4357 if err != nil {
4458 return nil, err
45- @@ -208 ,7 +208 ,7 @@ var errNoAsm = errors.New("no assembly implementation available")
59+ @@ -210 ,7 +210 ,7 @@ var errNoAsm = errors.New("no assembly implementation available")
4660 func SignASN1(rand io.Reader, priv *PrivateKey, hash []byte) ([]byte, error) {
4761 randutil.MaybeReadByte(rand)
4862
@@ -51,7 +65,7 @@ index 41ac17df22d7d7..84a7ba02c88620 100644
5165 b, err := boringPrivateKey(priv)
5266 if err != nil {
5367 return nil, err
54- @@ -319 ,7 +319 ,7 @@ func addASN1IntBytes(b *cryptobyte.Builder, bytes []byte) {
68+ @@ -321 ,7 +321 ,7 @@ func addASN1IntBytes(b *cryptobyte.Builder, bytes []byte) {
5569 // The inputs are not considered confidential, and may leak through timing side
5670 // channels, or if an attacker has control of part of the inputs.
5771 func VerifyASN1(pub *PublicKey, hash, sig []byte) bool {
@@ -688,7 +702,7 @@ index 7d7115cff81cea..d3ba67fe4d0611 100644
688702 }
689703 default:
690704diff --git a/src/go.mod b/src/go.mod
691- index 897c3802237b4e..0119f5ce8fe623 100644
705+ index e9da0eb1301b93..f03fcd766104e9 100644
692706--- a/src/go.mod
693707+++ b/src/go.mod
694708@@ -4,6 +4,7 @@ go 1.24
@@ -700,7 +714,7 @@ index 897c3802237b4e..0119f5ce8fe623 100644
700714 golang.org/x/crypto v0.30.0
701715 golang.org/x/net v0.32.1-0.20241206180132-552d8ac903a1
702716diff --git a/src/go.sum b/src/go.sum
703- index 7cece574a42291..6050c2fe0c5081 100644
717+ index b464f023942b74..90bd105cd407fb 100644
704718--- a/src/go.sum
705719+++ b/src/go.sum
706720@@ -1,5 +1,7 @@
@@ -712,7 +726,7 @@ index 7cece574a42291..6050c2fe0c5081 100644
712726 github.com/microsoft/go-crypto-winnative v0.0.0-20250108090702-b49854c00e37/go.mod h1:JkxQeL8dGcyCuKjn1Etz4NmQrOMImMy4BA9hptEfVFA=
713727 golang.org/x/crypto v0.30.0 h1:RwoQn3GkWiMkzlX562cLB7OxWvjH1L8xutO2WoJcRoY=
714728diff --git a/src/go/build/deps_test.go b/src/go/build/deps_test.go
715- index 1fcadbf6c19d79..b0da426bf18177 100644
729+ index 997244c84e57c5..4b0585fe1bea25 100644
716730--- a/src/go/build/deps_test.go
717731+++ b/src/go/build/deps_test.go
718732@@ -519,6 +519,8 @@ var depsRules = `
0 commit comments