]> Cypherpunks repositories - gostls13.git/commit
crypto/aes: move to crypto/internal/fips/aes
authorFilippo Valsorda <filippo@golang.org>
Fri, 1 Nov 2024 10:46:34 +0000 (11:46 +0100)
committerGopher Robot <gobot@golang.org>
Tue, 19 Nov 2024 00:29:22 +0000 (00:29 +0000)
commitc4aea467842efc3baf6cd2f5ad19fe23d7304c2e
treea126f0969ea2fd15c993e627456d052413353ba6
parent0240c91383fb5bdbdc2676637662db95e87b77db
crypto/aes: move to crypto/internal/fips/aes

The crypto/aes <-> crypto/cipher interfaces and the hardware support
upgrades were layered over the years, and had grown unwieldily.

Before: conditionally wrap the private crypto/aes type in private types
that implement an interface that's interface-upgraded by crypto/cipher
to replace the generic implementation in crypto/cipher.

crypto/aes depended on crypto/cipher, which is backwards.

After: provide concrete exported implementations of modes in
crypto/internal/fips/aes that crypto/cipher returns if the input Block
is the crypto/internal/fips/aes concrete implementation.

crypto/aes and crypto/cipher both depend on crypto/internal/fips/aes.

Also, made everything follow go.dev/wiki/TargetSpecific by only putting
the minimal code necessary and no exported functions in build-tagged
files.

The GCM integration still uses an interface upgrade, because the generic
implementation is complex enough that it was not trivial to duplicate.
This will be fixed in a future CL to make review easier.

For #69536

Change-Id: I21c2b93a498edb31c562b1aca824e21e8457fdff
Reviewed-on: https://go-review.googlesource.com/c/go/+/624395
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
55 files changed:
src/crypto/aes/aes.go [new file with mode: 0644]
src/crypto/aes/aes_test.go
src/crypto/aes/cbc_ppc64x.go [deleted file]
src/crypto/aes/cbc_s390x.go [deleted file]
src/crypto/aes/cipher.go [deleted file]
src/crypto/aes/cipher_asm.go [deleted file]
src/crypto/aes/cipher_generic.go [deleted file]
src/crypto/aes/cipher_s390x.go [deleted file]
src/crypto/aes/ctr_s390x.go [deleted file]
src/crypto/aes/modes.go [deleted file]
src/crypto/aes/modes_test.go [deleted file]
src/crypto/cipher/cbc.go
src/crypto/cipher/ctr.go
src/crypto/cipher/gcm.go
src/crypto/cipher/modes_test.go [new file with mode: 0644]
src/crypto/internal/fips/aes/_asm/ctr/ctr_amd64_asm.go [moved from src/crypto/aes/_asm/ctr/ctr_amd64_asm.go with 100% similarity]
src/crypto/internal/fips/aes/_asm/ctr/go.mod [moved from src/crypto/aes/_asm/ctr/go.mod with 100% similarity]
src/crypto/internal/fips/aes/_asm/ctr/go.sum [moved from src/crypto/aes/_asm/ctr/go.sum with 100% similarity]
src/crypto/internal/fips/aes/_asm/gcm/gcm_amd64_asm.go [moved from src/crypto/aes/_asm/gcm/gcm_amd64_asm.go with 99% similarity]
src/crypto/internal/fips/aes/_asm/gcm/go.mod [moved from src/crypto/aes/_asm/gcm/go.mod with 100% similarity]
src/crypto/internal/fips/aes/_asm/gcm/go.sum [moved from src/crypto/aes/_asm/gcm/go.sum with 100% similarity]
src/crypto/internal/fips/aes/_asm/standard/aes_amd64.go [moved from src/crypto/aes/_asm/standard/asm_amd64.go with 99% similarity]
src/crypto/internal/fips/aes/_asm/standard/go.mod [moved from src/crypto/aes/_asm/standard/go.mod with 100% similarity]
src/crypto/internal/fips/aes/_asm/standard/go.sum [moved from src/crypto/aes/_asm/standard/go.sum with 100% similarity]
src/crypto/internal/fips/aes/aes.go [new file with mode: 0644]
src/crypto/internal/fips/aes/aes_amd64.s [moved from src/crypto/aes/asm_amd64.s with 100% similarity]
src/crypto/internal/fips/aes/aes_arm64.s [moved from src/crypto/aes/asm_arm64.s with 100% similarity]
src/crypto/internal/fips/aes/aes_asm.go [new file with mode: 0644]
src/crypto/internal/fips/aes/aes_generic.go [moved from src/crypto/aes/block.go with 90% similarity]
src/crypto/internal/fips/aes/aes_noasm.go [new file with mode: 0644]
src/crypto/internal/fips/aes/aes_ppc64x.s [moved from src/crypto/aes/asm_ppc64x.s with 100% similarity]
src/crypto/internal/fips/aes/aes_s390x.go [new file with mode: 0644]
src/crypto/internal/fips/aes/aes_s390x.s [moved from src/crypto/aes/asm_s390x.s with 87% similarity]
src/crypto/internal/fips/aes/aes_test.go [new file with mode: 0644]
src/crypto/internal/fips/aes/cbc.go [new file with mode: 0644]
src/crypto/internal/fips/aes/cbc_noasm.go [new file with mode: 0644]
src/crypto/internal/fips/aes/cbc_ppc64x.go [new file with mode: 0644]
src/crypto/internal/fips/aes/cbc_s390x.go [new file with mode: 0644]
src/crypto/internal/fips/aes/const.go [moved from src/crypto/aes/const.go with 97% similarity]
src/crypto/internal/fips/aes/ctr.go [moved from src/crypto/aes/ctr_asm.go with 61% similarity]
src/crypto/internal/fips/aes/ctr_amd64.s [moved from src/crypto/aes/ctr_amd64.s with 100% similarity]
src/crypto/internal/fips/aes/ctr_arm64.s [moved from src/crypto/aes/ctr_arm64.s with 100% similarity]
src/crypto/internal/fips/aes/ctr_arm64_gen.go [moved from src/crypto/aes/ctr_arm64_gen.go with 100% similarity]
src/crypto/internal/fips/aes/ctr_asm.go [new file with mode: 0644]
src/crypto/internal/fips/aes/ctr_noasm.go [new file with mode: 0644]
src/crypto/internal/fips/aes/ctr_s390x.go [new file with mode: 0644]
src/crypto/internal/fips/aes/gcm_amd64.s [moved from src/crypto/aes/gcm_amd64.s with 100% similarity]
src/crypto/internal/fips/aes/gcm_arm64.s [moved from src/crypto/aes/gcm_arm64.s with 100% similarity]
src/crypto/internal/fips/aes/gcm_asm.go [moved from src/crypto/aes/aes_gcm.go with 87% similarity]
src/crypto/internal/fips/aes/gcm_noasm.go [new file with mode: 0644]
src/crypto/internal/fips/aes/gcm_ppc64x.go [moved from src/crypto/aes/gcm_ppc64x.go with 84% similarity]
src/crypto/internal/fips/aes/gcm_ppc64x.s [moved from src/crypto/aes/gcm_ppc64x.s with 100% similarity]
src/crypto/internal/fips/aes/gcm_s390x.go [moved from src/crypto/aes/gcm_s390x.go with 85% similarity]
src/crypto/internal/fips/aes/interface_test.go [new file with mode: 0644]
src/go/build/deps_test.go