aboutsummaryrefslogtreecommitdiff
path: root/src/crypto/sha1/boring.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2022-04-27 09:02:53 -0400
committerRuss Cox <rsc@golang.org>2022-04-29 14:23:27 +0000
commit0ec08283c8e3a673d9916c186f8d2f5428846862 (patch)
tree8763286823f38bed61ef2f1346d64482652b6d84 /src/crypto/sha1/boring.go
parent3cb10d14b7671ceee374d90ae0d4c3d024838f8a (diff)
downloadgo-0ec08283c8e3a673d9916c186f8d2f5428846862.tar.gz
go-0ec08283c8e3a673d9916c186f8d2f5428846862.zip
[dev.boringcrypto] crypto/internal/boring: make SHA calls allocation-free
The standard Go implementations are allocation-free. Making the BoringCrypto ones the same helps avoid surprises, including in some of our own tests. For #51940. Change-Id: Ic9c5dc46f5e29ca85f571244be2b380ec2cf89c9 Reviewed-on: https://go-review.googlesource.com/c/go/+/395876 Reviewed-by: Roland Shoemaker <roland@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/crypto/sha1/boring.go')
-rw-r--r--src/crypto/sha1/boring.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/crypto/sha1/boring.go b/src/crypto/sha1/boring.go
index 1cacf93f9b4..b5786d1bf4e 100644
--- a/src/crypto/sha1/boring.go
+++ b/src/crypto/sha1/boring.go
@@ -6,8 +6,8 @@
// 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
-// +build !cmd_go_bootstrap
+//go:build !cmd_go_bootstrap && cgo
+// +build !cmd_go_bootstrap,cgo
package sha1
@@ -21,3 +21,5 @@ 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) }