crypto/internal/boring,crypto/sha1: remove cmd_go_bootstrap build tag

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>
This commit is contained in:
qmuntal 2023-07-11 17:56:17 +02:00 committed by Quim Muntal
parent ddf3a1cd6d
commit cac69594d1
12 changed files with 16 additions and 60 deletions

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View File

@ -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) }

View File

@ -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") }

View 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()