]> Cypherpunks repositories - gostls13.git/commitdiff
crypto/internal/boring,crypto/sha1: remove cmd_go_bootstrap build tag
authorqmuntal <quimmuntal@gmail.com>
Tue, 11 Jul 2023 15:56:17 +0000 (17:56 +0200)
committerQuim Muntal <quimmuntal@gmail.com>
Thu, 20 Jul 2023 17:51:31 +0000 (17:51 +0000)
Since CL 402595, the Go compiler no longer uses any package under
crypto, so there is no need to explicitly exclude boring from the
go bootstrap build.

Change-Id: Ib71349fffaab151c6e1fb42a9684151439b70cc8
Reviewed-on: https://go-review.googlesource.com/c/go/+/508402
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
12 files changed:
src/crypto/internal/boring/aes.go
src/crypto/internal/boring/boring.go
src/crypto/internal/boring/ecdh.go
src/crypto/internal/boring/ecdsa.go
src/crypto/internal/boring/hmac.go
src/crypto/internal/boring/notboring.go
src/crypto/internal/boring/rand.go
src/crypto/internal/boring/rsa.go
src/crypto/internal/boring/sha.go
src/crypto/sha1/boring.go [deleted file]
src/crypto/sha1/notboring.go [deleted file]
src/crypto/sha1/sha1.go

index 6fae1d54f816afb0b48645fd5f595bc3e1de27c6..8819f576f4f4c5bdd3f26079fe54f9b6a8a62f1f 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build boringcrypto && linux && (amd64 || arm64) && !android && !cmd_go_bootstrap && !msan
+//go:build boringcrypto && linux && (amd64 || arm64) && !android && !msan
 
 package boring
 
index 102380a839f51697a471d7c994eadc4e99147294..ded36a92f921d353a9b712d75dd5b5a5aecf14c1 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build boringcrypto && linux && (amd64 || arm64) && !android && !cmd_go_bootstrap && !msan
+//go:build boringcrypto && linux && (amd64 || arm64) && !android && !msan
 
 package boring
 
index 8f46d8146f5eb035be4619bd62eb77e6bdf928c7..6a5d174c16b711d11d36a26bf98d82d1a8530355 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build boringcrypto && linux && (amd64 || arm64) && !android && !cmd_go_bootstrap && !msan
+//go:build boringcrypto && linux && (amd64 || arm64) && !android && !msan
 
 package boring
 
index e15f3682c7c834dbee7e895e6ccb4666ed065c57..2adfdb2c9f2eb0423c917b826f7f2fbcd05e4046 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build boringcrypto && linux && (amd64 || arm64) && !android && !cmd_go_bootstrap && !msan
+//go:build boringcrypto && linux && (amd64 || arm64) && !android && !msan
 
 package boring
 
index 6241a65f5fafdaa6f1a9389d777f3387c342bbff..ae926da69549bc188f7c14127dda978befc4252c 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build boringcrypto && linux && (amd64 || arm64) && !android && !cmd_go_bootstrap && !msan
+//go:build boringcrypto && linux && (amd64 || arm64) && !android && !msan
 
 package boring
 
index 1c5e4c742d6a83a5386e108c5b7b1189d29493ce..361dec9672ff553db70c6aa6e925a0bd5da5d67e 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build !(boringcrypto && linux && (amd64 || arm64) && !android && !cmd_go_bootstrap && !msan && cgo)
+//go:build !(boringcrypto && linux && (amd64 || arm64) && !android && !msan && cgo)
 
 package boring
 
index 7639c019098d388d0157aefdc3502e04196724f1..556b98a11245a52afee2a46272cc50cb73a1d885 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build boringcrypto && linux && (amd64 || arm64) && !android && !cmd_go_bootstrap && !msan
+//go:build boringcrypto && linux && (amd64 || arm64) && !android && !msan
 
 package boring
 
index fa693ea3198da6b4c61ad93227df99bca9b548a7..e3baa4454975bd73597d13acb25eb17c93ce0224 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build boringcrypto && linux && (amd64 || arm64) && !android && !cmd_go_bootstrap && !msan
+//go:build boringcrypto && linux && (amd64 || arm64) && !android && !msan
 
 package boring
 
index cf82f3f64fcbd1bd7f8acc2231760232c0dbf469..a49c11973897295ecd7f83a916f1cc3288e1c872 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build boringcrypto && linux && (amd64 || arm64) && !android && !cmd_go_bootstrap && !msan
+//go:build boringcrypto && linux && (amd64 || arm64) && !android && !msan
 
 package boring
 
diff --git a/src/crypto/sha1/boring.go b/src/crypto/sha1/boring.go
deleted file mode 100644 (file)
index b5786d1..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Extra indirection here so that when building go_bootstrap
-// cmd/internal/boring is not even imported, so that we don't
-// have to maintain changes to cmd/dist's deps graph.
-
-//go:build !cmd_go_bootstrap && cgo
-// +build !cmd_go_bootstrap,cgo
-
-package sha1
-
-import (
-       "crypto/internal/boring"
-       "hash"
-)
-
-const boringEnabled = boring.Enabled
-
-func boringNewSHA1() hash.Hash { return boring.NewSHA1() }
-
-func boringUnreachable() { boring.Unreachable() }
-
-func boringSHA1(p []byte) [20]byte { return boring.SHA1(p) }
diff --git a/src/crypto/sha1/notboring.go b/src/crypto/sha1/notboring.go
deleted file mode 100644 (file)
index 42ef879..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build cmd_go_bootstrap || !cgo
-// +build cmd_go_bootstrap !cgo
-
-package sha1
-
-import (
-       "hash"
-)
-
-const boringEnabled = false
-
-func boringNewSHA1() hash.Hash { panic("boringcrypto: not available") }
-
-func boringUnreachable() {}
-
-func boringSHA1([]byte) [20]byte { panic("boringcrypto: not available") }
index 43ab72a48548d9b31fca5f6caf9c8f33440b8fd5..bde642d905d70b7f836e4b9b386e3427d91e0683 100644 (file)
@@ -10,6 +10,7 @@ package sha1
 
 import (
        "crypto"
+       "crypto/internal/boring"
        "encoding/binary"
        "errors"
        "hash"
@@ -107,8 +108,8 @@ func (d *digest) Reset() {
 // implements encoding.BinaryMarshaler and encoding.BinaryUnmarshaler to
 // marshal and unmarshal the internal state of the hash.
 func New() hash.Hash {
-       if boringEnabled {
-               return boringNewSHA1()
+       if boring.Enabled {
+               return boring.NewSHA1()
        }
        d := new(digest)
        d.Reset()
@@ -120,7 +121,7 @@ func (d *digest) Size() int { return Size }
 func (d *digest) BlockSize() int { return BlockSize }
 
 func (d *digest) Write(p []byte) (nn int, err error) {
-       boringUnreachable()
+       boring.Unreachable()
        nn = len(p)
        d.len += uint64(nn)
        if d.nx > 0 {
@@ -144,7 +145,7 @@ func (d *digest) Write(p []byte) (nn int, err error) {
 }
 
 func (d *digest) Sum(in []byte) []byte {
-       boringUnreachable()
+       boring.Unreachable()
        // Make a copy of d so that caller can keep writing and summing.
        d0 := *d
        hash := d0.checkSum()
@@ -254,8 +255,8 @@ func (d *digest) constSum() [Size]byte {
 
 // Sum returns the SHA-1 checksum of the data.
 func Sum(data []byte) [Size]byte {
-       if boringEnabled {
-               return boringSHA1(data)
+       if boring.Enabled {
+               return boring.SHA1(data)
        }
        var d digest
        d.Reset()