]> Cypherpunks repositories - gostls13.git/commit
[dev.boringcrypto] cmd/internal/notsha256: add new package
authorRuss Cox <rsc@golang.org>
Wed, 27 Apr 2022 13:03:28 +0000 (09:03 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 29 Apr 2022 14:23:17 +0000 (14:23 +0000)
commitfe006d641079e8943833573bd1275ef51eb7fb60
tree3dbb788b864e749680f68ea0a658f0f6e33dfb20
parentec7f5165ddc680efbac18dc15b4905844d9e8db9
[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>
src/cmd/internal/notsha256/example_test.go [new file with mode: 0644]
src/cmd/internal/notsha256/sha256.go [new file with mode: 0644]
src/cmd/internal/notsha256/sha256_test.go [new file with mode: 0644]
src/cmd/internal/notsha256/sha256block.go [new file with mode: 0644]
src/cmd/internal/notsha256/sha256block_386.s [new file with mode: 0644]
src/cmd/internal/notsha256/sha256block_amd64.go [new file with mode: 0644]
src/cmd/internal/notsha256/sha256block_amd64.s [new file with mode: 0644]
src/cmd/internal/notsha256/sha256block_arm64.s [new file with mode: 0644]
src/cmd/internal/notsha256/sha256block_decl.go [new file with mode: 0644]
src/cmd/internal/notsha256/sha256block_generic.go [new file with mode: 0644]
src/cmd/internal/notsha256/sha256block_ppc64x.s [new file with mode: 0644]