crypto: algapi - make crypto_xor() take separate dst and src arguments
There are quite a number of occurrences in the kernel of the pattern if (dst != src) memcpy(dst, src, walk.total % AES_BLOCK_SIZE); crypto_xor(dst, final, walk.total % AES_BLOCK_SIZE); or crypto_xor(keystream, src, nbytes); memcpy(dst, keystream, nbytes); where crypto_xor() is preceded or followed by a memcpy() invocation that is only there because crypto_xor() uses its output parameter as one of the inputs. To avoid having to add new instances of this pattern in the arm64 code, which will be refactored to implement non-SIMD fallbacks, add an alternative implementation called crypto_xor_cpy(), taking separate input and output arguments. This removes the need for the separate memcpy(). Signed-off-by:Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by:
Herbert Xu <herbert@gondor.apana.org.au>
Showing
- arch/arm/crypto/aes-ce-glue.c 1 addition, 3 deletionsarch/arm/crypto/aes-ce-glue.c
- arch/arm/crypto/aes-neonbs-glue.c 2 additions, 3 deletionsarch/arm/crypto/aes-neonbs-glue.c
- arch/arm64/crypto/aes-glue.c 1 addition, 3 deletionsarch/arm64/crypto/aes-glue.c
- arch/arm64/crypto/aes-neonbs-glue.c 2 additions, 3 deletionsarch/arm64/crypto/aes-neonbs-glue.c
- arch/sparc/crypto/aes_glue.c 1 addition, 2 deletionsarch/sparc/crypto/aes_glue.c
- arch/x86/crypto/aesni-intel_glue.c 2 additions, 2 deletionsarch/x86/crypto/aesni-intel_glue.c
- arch/x86/crypto/blowfish_glue.c 1 addition, 2 deletionsarch/x86/crypto/blowfish_glue.c
- arch/x86/crypto/cast5_avx_glue.c 1 addition, 2 deletionsarch/x86/crypto/cast5_avx_glue.c
- arch/x86/crypto/des3_ede_glue.c 1 addition, 2 deletionsarch/x86/crypto/des3_ede_glue.c
- crypto/ctr.c 1 addition, 2 deletionscrypto/ctr.c
- crypto/pcbc.c 4 additions, 8 deletionscrypto/pcbc.c
- drivers/crypto/vmx/aes_ctr.c 1 addition, 2 deletionsdrivers/crypto/vmx/aes_ctr.c
- drivers/md/dm-crypt.c 5 additions, 6 deletionsdrivers/md/dm-crypt.c
- include/crypto/algapi.h 19 additions, 0 deletionsinclude/crypto/algapi.h
Loading
Please register or sign in to comment