diff options
author | Russ Cox <rsc@golang.org> | 2022-04-27 09:03:28 -0400 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2022-04-29 14:23:17 +0000 |
commit | fe006d641079e8943833573bd1275ef51eb7fb60 (patch) | |
tree | 3dbb788b864e749680f68ea0a658f0f6e33dfb20 /src/cmd/internal/notsha256/sha256block_decl.go | |
parent | ec7f5165ddc680efbac18dc15b4905844d9e8db9 (diff) | |
download | go-fe006d641079e8943833573bd1275ef51eb7fb60.tar.gz go-fe006d641079e8943833573bd1275ef51eb7fb60.zip |
[dev.boringcrypto] cmd/internal/notsha256: add new package
Package notsha256 implements the NOTSHA256 hash,
defined as bitwise NOT of SHA-256.
It will be used from the Go compiler toolchain where an
arbitrary hash is needed and the code currently reaches
for MD5, SHA1, or SHA256. The problem with all of those
is that when we add GOEXPERIMENT=boringcrypto, the
bootstrap process will not converge if the compiler itself
depends on the boringcrypto cgo code.
Using notsha256 avoids boringcrypto.
It is possible that I don't fully understand the convergence
problem and that there is a way to make the compiler converge
when using cgo, but keeping cgo out of the compiler seems safest.
It also makes clear that (except for the hack in codesign)
the code using this package doesn't care which hash is used.
For #51940.
Change-Id: Ie7c661183eacf8413a9d2074c96cbb9361e125ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/402594
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/cmd/internal/notsha256/sha256block_decl.go')
-rw-r--r-- | src/cmd/internal/notsha256/sha256block_decl.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/cmd/internal/notsha256/sha256block_decl.go b/src/cmd/internal/notsha256/sha256block_decl.go new file mode 100644 index 0000000000..5a822ee479 --- /dev/null +++ b/src/cmd/internal/notsha256/sha256block_decl.go @@ -0,0 +1,12 @@ +// Copyright 2013 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 386 || amd64 || ppc64le || ppc64 +// +build 386 amd64 ppc64le ppc64 + +package notsha256 + +//go:noescape + +func block(dig *digest, p []byte) |