crypto: arm - drop dependency on SIMD helper
Subsystems (2)
v2 cover crypto: arm - drop dependency on SIMD helper
From: Ard Biesheuvel <[email protected]>
The non-SIMD fallbacks in the ARM skcipher implementations have become dead code now that SIMD is always allowed in the contexts where skciphers may be used. So remove them.
While at it, remove the sync CTR helper function now that its last users have been dropped.
v2:
- drop unnecessary includes
- add patch #3
Ard Biesheuvel (3):
crypto: arm/aes-ce - stop using the SIMD helper
crypto: arm/aes-neonbs - stop using the SIMD helper
crypto: ctr - remove unused crypto_ctr_encrypt_walk()
arch/arm/crypto/Kconfig | 2 - arch/arm/crypto/aes-ce-glue.c | 104 ++---------------- arch/arm/crypto/aes-neonbs-glue.c | 116 ++------------------ include/crypto/ctr.h | 47 -------- 4 files changed, 20 insertions(+), 249 deletions(-)
base-commit: 99585c2192cb1ce212876e82ef01d1c98c7f4699
Signature · 1 line
2.49.0.472.ge94155a9ec-goog
PATCH v2 1/3 crypto: arm/aes-ce - stop using the SIMD helper
From: Ard Biesheuvel <[email protected]>
Now that ARM permits use of the NEON unit in softirq context as well as task context, there is no longer a need to rely on the SIMD helper module to construct async skciphers wrapping the sync ones, as the latter can always be called directly.
So remove these wrappers and the dependency on the SIMD helper. This permits the use of these algorithms by callers that only support synchronous use.
--- arch/arm/crypto/Kconfig | 1 - arch/arm/crypto/aes-ce-glue.c | 104 +++----------------- 2 files changed, 11 insertions(+), 94 deletions(-)
arch/arm/crypto/Kconfig +0 -1
@@ -200,7 +200,6 @@ config CRYPTO_AES_ARM_CE depends on KERNEL_MODE_NEON select CRYPTO_SKCIPHER select CRYPTO_LIB_AES - select CRYPTO_SIMD help Length-preserving ciphers: AES cipher algorithms (FIPS-197) with block cipher modes:
arch/arm/crypto/aes-ce-glue.c +11 -93
164 lines not on this page · raw message
Signature · 1 line
2.49.0.472.ge94155a9ec-goog
PATCH v2 2/3 crypto: arm/aes-neonbs - stop using the SIMD helper
In reply to Ard BiesheuvelFrom: Ard Biesheuvel <[email protected]>
Now that ARM permits use of the NEON unit in softirq context as well as task context, there is no longer a need to rely on the SIMD helper module to construct async skciphers wrapping the sync ones, as the latter can always be called directly.
So remove these wrappers and the dependency on the SIMD helper. This permits the use of these algorithms by callers that only support synchronous use.
--- arch/arm/crypto/Kconfig | 1 - arch/arm/crypto/aes-neonbs-glue.c | 116 ++------------------ 2 files changed, 9 insertions(+), 108 deletions(-)
arch/arm/crypto/Kconfig +0 -1
@@ -172,7 +172,6 @@ config CRYPTO_AES_ARM_BS select CRYPTO_AES_ARM select CRYPTO_SKCIPHER select CRYPTO_LIB_AES - select CRYPTO_SIMD help Length-preserving ciphers: AES cipher algorithms (FIPS-197) with block cipher modes:
arch/arm/crypto/aes-neonbs-glue.c +9 -107
196 lines not on this page · raw message
Signature · 1 line
2.49.0.472.ge94155a9ec-goog
PATCH v2 3/3 crypto: ctr - remove unused crypto_ctr_encrypt_walk()
In reply to Ard BiesheuvelFrom: Ard Biesheuvel <[email protected]>
crypto_ctr_encrypt_walk() is no longer used so remove it.
Note that some existing drivers currently rely on the transitive includes of some other crypto headers so retain those for the time being.
--- include/crypto/ctr.h | 47 -------------------- 1 file changed, 47 deletions(-)
include/crypto/ctr.h +0 -47
@@ -10,56 +10,9 @@#include <crypto/algapi.h> #include <crypto/internal/skcipher.h> -#include <linux/string.h> -#include <linux/types.h> #define CTR_RFC3686_NONCE_SIZE 4#define CTR_RFC3686_IV_SIZE 8#define CTR_RFC3686_BLOCK_SIZE 16 -static inline int crypto_ctr_encrypt_walk (struct skcipher_request *req, -void (*fn)(struct crypto_skcipher *, -const u8 *,u8 *)) -{ -struct crypto_skcipher *tfm =crypto_skcipher_reqtfm (req); -int blocksize =crypto_skcipher_chunksize (tfm); -u8 buf[MAX_CIPHER_BLOCKSIZE ]; -struct skcipher_walk walk; -int err; - -/* avoid integer division due to variable blocksize parameter */ -if (WARN_ON_ONCE (!is_power_of_2 (blocksize))) -return -EINVAL ; - - err =skcipher_walk_virt (&walk, req, false); - -while (walk.nbytes >0 ) { -const u8 *src = walk.src.virt.addr; -u8 *dst = walk.dst.virt.addr; -int nbytes = walk.nbytes; -int tail =0 ; - -if (nbytes < walk.total) { - tail = walk.nbytes & (blocksize -1 ); - nbytes -= tail; - } - -do { -int bsize =min (nbytes, blocksize); - -fn (tfm, walk.iv, buf); - -crypto_xor_cpy (dst, src, buf, bsize); -crypto_inc (walk.iv, blocksize); - - dst += bsize; - src += bsize; - nbytes -= bsize; - }while (nbytes >0 ); - - err =skcipher_walk_done (&walk, tail); - } -return err; -} -#endif /* _CRYPTO_CTR_H */
Signature · 1 line
2.49.0.472.ge94155a9ec-goog
Quoted 18 lines · Ard Biesheuvel
From: Ard Biesheuvel <[email protected]>
The non-SIMD fallbacks in the ARM skcipher implementations have become dead code now that SIMD is always allowed in the contexts where skciphers may be used. So remove them.
While at it, remove the sync CTR helper function now that its last users have been dropped.
v2:
- drop unnecessary includes
- add patch #3Ard Biesheuvel (3):
crypto: arm/aes-ce - stop using the SIMD helper
crypto: arm/aes-neonbs - stop using the SIMD helper
crypto: ctr - remove unusedcrypto_ctr_encrypt_walk()
Quoted 6 lines
arch/arm/crypto/Kconfig | 2 - arch/arm/crypto/aes-ce-glue.c | 104 ++---------------- arch/arm/crypto/aes-neonbs-glue.c | 116 ++------------------ include/crypto/ctr.h | 47 -------- 4 files changed, 20 insertions(+), 249 deletions(-)
- Eric
Herbert Xu
maintainerQuoted 18 lines · Ard Biesheuvel
From: Ard Biesheuvel <[email protected]>
The non-SIMD fallbacks in the ARM skcipher implementations have become dead code now that SIMD is always allowed in the contexts where skciphers may be used. So remove them.
While at it, remove the sync CTR helper function now that its last users have been dropped.
v2:
- drop unnecessary includes
- add patch #3Ard Biesheuvel (3):
crypto: arm/aes-ce - stop using the SIMD helper
crypto: arm/aes-neonbs - stop using the SIMD helper
crypto: ctr - remove unusedcrypto_ctr_encrypt_walk()
Quoted 10 lines
arch/arm/crypto/Kconfig | 2 - arch/arm/crypto/aes-ce-glue.c | 104 ++---------------- arch/arm/crypto/aes-neonbs-glue.c | 116 ++------------------ include/crypto/ctr.h | 47 -------- 4 files changed, 20 insertions(+), 249 deletions(-)base-commit:
99585c2192cb1ce212876e82ef01d1c98c7f4699Signature · 1 line
2.49.0.472.ge94155a9ec-goog
All applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt