// 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
// 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
// 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
// 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
// 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
// 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
// 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
// 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
// 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
+++ /dev/null
-// 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) }
+++ /dev/null
-// 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") }
import (
"crypto"
+ "crypto/internal/boring"
"encoding/binary"
"errors"
"hash"
// 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()
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 {
}
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()
// 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()