Skip to content

Commit 691f82f

Browse files
committed
fix TestDependencies
1 parent e8de376 commit 691f82f

File tree

4 files changed

+67
-86
lines changed

4 files changed

+67
-86
lines changed

patches/0002-Vendor-crypto-backends.patch

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Use a 'go' that was recently built by the current branch to ensure stable result
99
src/crypto/internal/backend/deps_ignore.go | 19 +
1010
src/go.mod | 5 +
1111
src/go.sum | 4 +
12+
src/go/build/deps_test.go | 14 +-
1213
src/go/build/vendor_test.go | 2 +
1314
.../golang-fips/openssl/v2/.gitignore | 1 +
1415
.../golang-fips/openssl/v2/.gitleaks.toml | 9 +
@@ -74,7 +75,7 @@ Use a 'go' that was recently built by the current branch to ensure stable result
7475
.../internal/subtle/aliasing.go | 32 +
7576
.../internal/sysdll/sys_windows.go | 55 ++
7677
src/vendor/modules.txt | 11 +
77-
68 files changed, 11005 insertions(+)
78+
69 files changed, 11016 insertions(+), 3 deletions(-)
7879
create mode 100644 src/crypto/internal/backend/deps_ignore.go
7980
create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/.gitignore
8081
create mode 100644 src/vendor/github.com/golang-fips/openssl/v2/.gitleaks.toml
@@ -142,7 +143,7 @@ Use a 'go' that was recently built by the current branch to ensure stable result
142143

143144
diff --git a/src/crypto/internal/backend/deps_ignore.go b/src/crypto/internal/backend/deps_ignore.go
144145
new file mode 100644
145-
index 00000000000000..979ee34f54acba
146+
index 00000000000000..ba6d196a54f69d
146147
--- /dev/null
147148
+++ b/src/crypto/internal/backend/deps_ignore.go
148149
@@ -0,0 +1,19 @@
@@ -152,7 +153,7 @@ index 00000000000000..979ee34f54acba
152153
+
153154
+//go:build ms_ignore_backend_deps
154155
+
155-
+package backend
156+
+package main
156157
+
157158
+import (
158159
+ _ "github.com/golang-fips/openssl/v2"
@@ -190,6 +191,59 @@ index 9e661352f16e0b..abebb59dcd7739 100644
190191
golang.org/x/crypto v0.30.0 h1:RwoQn3GkWiMkzlX562cLB7OxWvjH1L8xutO2WoJcRoY=
191192
golang.org/x/crypto v0.30.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
192193
golang.org/x/net v0.32.1-0.20241206180132-552d8ac903a1 h1:+Yk1FZ5E+/ewA0nOO/HRYs9E4yeqpGOShuSAdzCNNoQ=
194+
diff --git a/src/go/build/deps_test.go b/src/go/build/deps_test.go
195+
index e3e01077c18b17..5551a24f8a844e 100644
196+
--- a/src/go/build/deps_test.go
197+
+++ b/src/go/build/deps_test.go
198+
@@ -503,7 +503,7 @@ var depsRules = `
199+
NONE < crypto/internal/boring/sig, crypto/internal/boring/syso;
200+
sync/atomic < crypto/internal/boring/bcache;
201+
202+
- FIPS, internal/godebug, hash, embed,
203+
+ FIPS, internal/godebug, hash, embed, encoding/binary,
204+
crypto/internal/boring/sig,
205+
crypto/internal/boring/syso,
206+
crypto/internal/boring/bcache
207+
@@ -513,6 +513,12 @@ var depsRules = `
208+
< crypto/sha3
209+
< crypto/internal/fips140hash
210+
< crypto/cipher
211+
+ < github.com/golang-fips/openssl/v2/internal/subtle
212+
+ < github.com/golang-fips/openssl/v2
213+
+ < github.com/microsoft/go-crypto-winnative/internal/subtle
214+
+ < github.com/microsoft/go-crypto-winnative/internal/sysdll
215+
+ < github.com/microsoft/go-crypto-winnative/internal/bcrypt
216+
+ < github.com/microsoft/go-crypto-winnative/cng
217+
< crypto/internal/boring
218+
< crypto/boring
219+
< crypto/aes,
220+
@@ -534,6 +540,8 @@ var depsRules = `
221+
# CRYPTO-MATH is crypto that exposes math/big APIs - no cgo, net; fmt now ok.
222+
223+
CRYPTO, FMT, math/big
224+
+ < github.com/golang-fips/openssl/v2/bbig
225+
+ < github.com/microsoft/go-crypto-winnative/cng/bbig
226+
< crypto/internal/boring/bbig
227+
< crypto/rand
228+
< crypto/ed25519 # depends on crypto/rand.Reader
229+
@@ -837,7 +845,7 @@ var buildIgnore = []byte("\n//go:build ignore")
230+
231+
func findImports(pkg string) ([]string, error) {
232+
vpkg := pkg
233+
- if strings.HasPrefix(pkg, "golang.org") {
234+
+ if strings.HasPrefix(pkg, "golang.org") || strings.HasPrefix(pkg, "github.com") {
235+
vpkg = "vendor/" + pkg
236+
}
237+
dir := filepath.Join(Default.GOROOT, "src", vpkg)
238+
@@ -847,7 +855,7 @@ func findImports(pkg string) ([]string, error) {
239+
}
240+
var imports []string
241+
var haveImport = map[string]bool{}
242+
- if pkg == "crypto/internal/boring" {
243+
+ if pkg == "crypto/internal/boring" || pkg == "github.com/golang-fips/openssl/v2" {
244+
haveImport["C"] = true // kludge: prevent C from appearing in crypto/internal/boring imports
245+
}
246+
fset := token.NewFileSet()
193247
diff --git a/src/go/build/vendor_test.go b/src/go/build/vendor_test.go
194248
index 7f6237ffd59c11..1d0b9b20e9b1d4 100644
195249
--- a/src/go/build/vendor_test.go

patches/0003-Add-crypto-backend-foundation.patch

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ index 00000000000000..5e4b436554d44d
519519
+// from complaining about the missing body
520520
+// (because the implementation might be here).
521521
diff --git a/src/go/build/deps_test.go b/src/go/build/deps_test.go
522-
index e3e01077c18b17..a46d6c034ca1e0 100644
522+
index 5551a24f8a844e..c86b63454c6f7a 100644
523523
--- a/src/go/build/deps_test.go
524524
+++ b/src/go/build/deps_test.go
525525
@@ -493,6 +493,8 @@ var depsRules = `
@@ -532,7 +532,7 @@ index e3e01077c18b17..a46d6c034ca1e0 100644
532532

533533
crypto, hash !< FIPS;
534534
@@ -506,7 +508,8 @@ var depsRules = `
535-
FIPS, internal/godebug, hash, embed,
535+
FIPS, internal/godebug, hash, embed, encoding/binary,
536536
crypto/internal/boring/sig,
537537
crypto/internal/boring/syso,
538538
- crypto/internal/boring/bcache
@@ -541,17 +541,17 @@ index e3e01077c18b17..a46d6c034ca1e0 100644
541541
< crypto/internal/fips140only
542542
< crypto
543543
< crypto/subtle
544-
@@ -514,6 +517,7 @@ var depsRules = `
545-
< crypto/internal/fips140hash
546-
< crypto/cipher
544+
@@ -520,6 +523,7 @@ var depsRules = `
545+
< github.com/microsoft/go-crypto-winnative/internal/bcrypt
546+
< github.com/microsoft/go-crypto-winnative/cng
547547
< crypto/internal/boring
548548
+ < crypto/internal/backend
549549
< crypto/boring
550550
< crypto/aes,
551551
crypto/des,
552-
@@ -535,6 +539,7 @@ var depsRules = `
553-
554-
CRYPTO, FMT, math/big
552+
@@ -543,6 +547,7 @@ var depsRules = `
553+
< github.com/golang-fips/openssl/v2/bbig
554+
< github.com/microsoft/go-crypto-winnative/cng/bbig
555555
< crypto/internal/boring/bbig
556556
+ < crypto/internal/backend/bbig
557557
< crypto/rand

patches/0005-Add-OpenSSL-crypto-backend.patch

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ Subject: [PATCH] Add OpenSSL crypto backend
99
.../internal/backend/bbig/big_openssl.go | 12 +
1010
.../internal/backend/fips140/openssl.go | 41 ++
1111
src/crypto/internal/backend/openssl_linux.go | 358 ++++++++++++++++++
12-
src/go/build/deps_test.go | 9 +-
1312
src/os/exec/exec_test.go | 9 +
14-
7 files changed, 428 insertions(+), 5 deletions(-)
13+
6 files changed, 422 insertions(+), 2 deletions(-)
1514
create mode 100644 src/crypto/internal/backend/bbig/big_openssl.go
1615
create mode 100644 src/crypto/internal/backend/fips140/openssl.go
1716
create mode 100644 src/crypto/internal/backend/openssl_linux.go
@@ -475,54 +474,6 @@ index 00000000000000..0f3aea733ac2a5
475474
+
476475
+ return openssl.VerifyDSA(pub, hashed, sig)
477476
+}
478-
diff --git a/src/go/build/deps_test.go b/src/go/build/deps_test.go
479-
index a46d6c034ca1e0..12086de2c2e766 100644
480-
--- a/src/go/build/deps_test.go
481-
+++ b/src/go/build/deps_test.go
482-
@@ -505,7 +505,7 @@ var depsRules = `
483-
NONE < crypto/internal/boring/sig, crypto/internal/boring/syso;
484-
sync/atomic < crypto/internal/boring/bcache;
485-
486-
- FIPS, internal/godebug, hash, embed,
487-
+ FIPS, internal/godebug, hash, embed, encoding/binary,
488-
crypto/internal/boring/sig,
489-
crypto/internal/boring/syso,
490-
crypto/internal/boring/bcache,
491-
@@ -516,6 +516,8 @@ var depsRules = `
492-
< crypto/sha3
493-
< crypto/internal/fips140hash
494-
< crypto/cipher
495-
+ < github.com/golang-fips/openssl/v2/internal/subtle
496-
+ < github.com/golang-fips/openssl/v2
497-
< crypto/internal/boring
498-
< crypto/internal/backend
499-
< crypto/boring
500-
@@ -538,6 +540,7 @@ var depsRules = `
501-
# CRYPTO-MATH is crypto that exposes math/big APIs - no cgo, net; fmt now ok.
502-
503-
CRYPTO, FMT, math/big
504-
+ < github.com/golang-fips/openssl/v2/bbig
505-
< crypto/internal/boring/bbig
506-
< crypto/internal/backend/bbig
507-
< crypto/rand
508-
@@ -842,7 +845,7 @@ var buildIgnore = []byte("\n//go:build ignore")
509-
510-
func findImports(pkg string) ([]string, error) {
511-
vpkg := pkg
512-
- if strings.HasPrefix(pkg, "golang.org") {
513-
+ if strings.HasPrefix(pkg, "golang.org") || strings.HasPrefix(pkg, "github.com") {
514-
vpkg = "vendor/" + pkg
515-
}
516-
dir := filepath.Join(Default.GOROOT, "src", vpkg)
517-
@@ -852,7 +855,7 @@ func findImports(pkg string) ([]string, error) {
518-
}
519-
var imports []string
520-
var haveImport = map[string]bool{}
521-
- if pkg == "crypto/internal/boring" {
522-
+ if pkg == "crypto/internal/boring" || pkg == "github.com/golang-fips/openssl/v2" {
523-
haveImport["C"] = true // kludge: prevent C from appearing in crypto/internal/boring imports
524-
}
525-
fset := token.NewFileSet()
526477
diff --git a/src/os/exec/exec_test.go b/src/os/exec/exec_test.go
527478
index 8c623871932f7d..2fa55073f5c19c 100644
528479
--- a/src/os/exec/exec_test.go

patches/0006-Add-CNG-crypto-backend.patch

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ Subject: [PATCH] Add CNG crypto backend
77
src/crypto/internal/backend/bbig/big_cng.go | 12 +
88
src/crypto/internal/backend/cng_windows.go | 329 ++++++++++++++++++++
99
src/crypto/internal/backend/fips140/cng.go | 33 ++
10-
src/go/build/deps_test.go | 5 +
11-
4 files changed, 379 insertions(+)
10+
3 files changed, 374 insertions(+)
1211
create mode 100644 src/crypto/internal/backend/bbig/big_cng.go
1312
create mode 100644 src/crypto/internal/backend/cng_windows.go
1413
create mode 100644 src/crypto/internal/backend/fips140/cng.go
@@ -405,26 +404,3 @@ index 00000000000000..f769d15f94ab05
405404
+ }
406405
+ return enabled != 0
407406
+}
408-
diff --git a/src/go/build/deps_test.go b/src/go/build/deps_test.go
409-
index 3de94c93629e3d..8effe9041f3f5f 100644
410-
--- a/src/go/build/deps_test.go
411-
+++ b/src/go/build/deps_test.go
412-
@@ -517,6 +517,10 @@ var depsRules = `
413-
< crypto/sha3
414-
< crypto/internal/fips140hash
415-
< crypto/cipher
416-
+ < github.com/microsoft/go-crypto-winnative/internal/subtle
417-
+ < github.com/microsoft/go-crypto-winnative/internal/sysdll
418-
+ < github.com/microsoft/go-crypto-winnative/internal/bcrypt
419-
+ < github.com/microsoft/go-crypto-winnative/cng
420-
< github.com/golang-fips/openssl/v2/internal/subtle
421-
< github.com/golang-fips/openssl/v2
422-
< crypto/internal/boring
423-
@@ -542,6 +546,7 @@ var depsRules = `
424-
# CRYPTO-MATH is crypto that exposes math/big APIs - no cgo, net; fmt now ok.
425-
426-
CRYPTO, FMT, math/big
427-
+ < github.com/microsoft/go-crypto-winnative/cng/bbig
428-
< github.com/golang-fips/openssl/v2/bbig
429-
< crypto/internal/boring/bbig
430-
< crypto/internal/backend/bbig

0 commit comments

Comments
 (0)