aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/apm821xx/patches-4.14/120-0006-crypto-crypto4xx-performance-optimizations.patch
diff options
context:
space:
mode:
authorChristian Lamparter <chunkeey@gmail.com>2018-04-28 22:08:09 +0200
committerJohn Crispin <john@phrozen.org>2018-05-18 09:14:09 +0200
commit16e39624b728264bd4759580f6292bffefcae466 (patch)
tree1023cbd038a9f71d8b9be71b3ac6411e714313d2 /target/linux/apm821xx/patches-4.14/120-0006-crypto-crypto4xx-performance-optimizations.patch
parente6e51ce87fac2d6b9d082336f8d767f12154d79b (diff)
downloadupstream-16e39624b728264bd4759580f6292bffefcae466.tar.gz
upstream-16e39624b728264bd4759580f6292bffefcae466.tar.bz2
upstream-16e39624b728264bd4759580f6292bffefcae466.zip
apm821xx: backport and reassign crypto4xx patches
This patch backports several patches that went upstream into Herbert Xu's cryptodev-2.6 tree: crypto: Use zeroing memory allocator instead of allocator/memset crypto: crypto4xx - performance optimizations crypto: crypto4xx - convert to skcipher crypto: crypto4xx - avoid VLA use crypto: crypto4xx - add aes-ctr support crypto: crypto4xx - properly set IV after de- and encrypt crypto: crypto4xx - extend aead fallback checks crypto: crypto4xx - put temporary dst sg into request ctx The older, outstanding patches from 120-wxyz series have been upstreamed as well and therefore they have been reassigned to fit into the series. Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
Diffstat (limited to 'target/linux/apm821xx/patches-4.14/120-0006-crypto-crypto4xx-performance-optimizations.patch')
-rw-r--r--target/linux/apm821xx/patches-4.14/120-0006-crypto-crypto4xx-performance-optimizations.patch158
1 files changed, 0 insertions, 158 deletions
diff --git a/target/linux/apm821xx/patches-4.14/120-0006-crypto-crypto4xx-performance-optimizations.patch b/target/linux/apm821xx/patches-4.14/120-0006-crypto-crypto4xx-performance-optimizations.patch
deleted file mode 100644
index 0475fdaf8f..0000000000
--- a/target/linux/apm821xx/patches-4.14/120-0006-crypto-crypto4xx-performance-optimizations.patch
+++ /dev/null
@@ -1,158 +0,0 @@
-From 30afcbb01a750a1ef0cee8a0861a347912c2e4fb Mon Sep 17 00:00:00 2001
-From: Christian Lamparter <chunkeey@gmail.com>
-Date: Thu, 21 Dec 2017 16:00:01 +0100
-Subject: [PATCH 6/6] crypto: crypto4xx - performance optimizations
-
-This patch provides a cheap 2MiB/s+ (~ 6%) performance
-improvement over the current code. This is because the
-compiler can now optimize several endian swap memcpy.
-
-Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
----
- drivers/crypto/amcc/crypto4xx_alg.c | 32 +++++++++++++++++++-------------
- drivers/crypto/amcc/crypto4xx_core.c | 22 +++++++++++-----------
- drivers/crypto/amcc/crypto4xx_core.h | 6 ++++--
- 3 files changed, 34 insertions(+), 26 deletions(-)
-
---- a/drivers/crypto/amcc/crypto4xx_alg.c
-+++ b/drivers/crypto/amcc/crypto4xx_alg.c
-@@ -74,32 +74,38 @@ static void set_dynamic_sa_command_1(str
- sa->sa_command_1.bf.copy_hdr = cp_hdr;
- }
-
--int crypto4xx_encrypt(struct ablkcipher_request *req)
-+static inline int crypto4xx_crypt(struct ablkcipher_request *req,
-+ const unsigned int ivlen, bool decrypt)
- {
- struct crypto4xx_ctx *ctx = crypto_tfm_ctx(req->base.tfm);
-- unsigned int ivlen = crypto_ablkcipher_ivsize(
-- crypto_ablkcipher_reqtfm(req));
- __le32 iv[ivlen];
-
- if (ivlen)
- crypto4xx_memcpy_to_le32(iv, req->info, ivlen);
-
- return crypto4xx_build_pd(&req->base, ctx, req->src, req->dst,
-- req->nbytes, iv, ivlen, ctx->sa_out, ctx->sa_len, 0);
-+ req->nbytes, iv, ivlen, decrypt ? ctx->sa_in : ctx->sa_out,
-+ ctx->sa_len, 0);
- }
-
--int crypto4xx_decrypt(struct ablkcipher_request *req)
-+int crypto4xx_encrypt_noiv(struct ablkcipher_request *req)
- {
-- struct crypto4xx_ctx *ctx = crypto_tfm_ctx(req->base.tfm);
-- unsigned int ivlen = crypto_ablkcipher_ivsize(
-- crypto_ablkcipher_reqtfm(req));
-- __le32 iv[ivlen];
-+ return crypto4xx_crypt(req, 0, false);
-+}
-
-- if (ivlen)
-- crypto4xx_memcpy_to_le32(iv, req->info, ivlen);
-+int crypto4xx_encrypt_iv(struct ablkcipher_request *req)
-+{
-+ return crypto4xx_crypt(req, AES_IV_SIZE, false);
-+}
-
-- return crypto4xx_build_pd(&req->base, ctx, req->src, req->dst,
-- req->nbytes, iv, ivlen, ctx->sa_in, ctx->sa_len, 0);
-+int crypto4xx_decrypt_noiv(struct ablkcipher_request *req)
-+{
-+ return crypto4xx_crypt(req, 0, true);
-+}
-+
-+int crypto4xx_decrypt_iv(struct ablkcipher_request *req)
-+{
-+ return crypto4xx_crypt(req, AES_IV_SIZE, true);
- }
-
- /**
---- a/drivers/crypto/amcc/crypto4xx_core.c
-+++ b/drivers/crypto/amcc/crypto4xx_core.c
-@@ -582,7 +582,7 @@ static void crypto4xx_aead_done(struct c
- struct scatterlist *dst = pd_uinfo->dest_va;
- size_t cp_len = crypto_aead_authsize(
- crypto_aead_reqtfm(aead_req));
-- u32 icv[cp_len];
-+ u32 icv[AES_BLOCK_SIZE];
- int err = 0;
-
- if (pd_uinfo->using_sd) {
-@@ -597,7 +597,7 @@ static void crypto4xx_aead_done(struct c
- if (pd_uinfo->sa_va->sa_command_0.bf.dir == DIR_OUTBOUND) {
- /* append icv at the end */
- crypto4xx_memcpy_from_le32(icv, pd_uinfo->sr_va->save_digest,
-- cp_len);
-+ sizeof(icv));
-
- scatterwalk_map_and_copy(icv, dst, aead_req->cryptlen,
- cp_len, 1);
-@@ -607,7 +607,7 @@ static void crypto4xx_aead_done(struct c
- aead_req->assoclen + aead_req->cryptlen -
- cp_len, cp_len, 0);
-
-- crypto4xx_memcpy_from_le32(icv, icv, cp_len);
-+ crypto4xx_memcpy_from_le32(icv, icv, sizeof(icv));
-
- if (crypto_memneq(icv, pd_uinfo->sr_va->save_digest, cp_len))
- err = -EBADMSG;
-@@ -1124,8 +1124,8 @@ static struct crypto4xx_alg_common crypt
- .max_keysize = AES_MAX_KEY_SIZE,
- .ivsize = AES_IV_SIZE,
- .setkey = crypto4xx_setkey_aes_cbc,
-- .encrypt = crypto4xx_encrypt,
-- .decrypt = crypto4xx_decrypt,
-+ .encrypt = crypto4xx_encrypt_iv,
-+ .decrypt = crypto4xx_decrypt_iv,
- }
- }
- }},
-@@ -1148,8 +1148,8 @@ static struct crypto4xx_alg_common crypt
- .max_keysize = AES_MAX_KEY_SIZE,
- .ivsize = AES_IV_SIZE,
- .setkey = crypto4xx_setkey_aes_cfb,
-- .encrypt = crypto4xx_encrypt,
-- .decrypt = crypto4xx_decrypt,
-+ .encrypt = crypto4xx_encrypt_iv,
-+ .decrypt = crypto4xx_decrypt_iv,
- }
- }
- } },
-@@ -1197,8 +1197,8 @@ static struct crypto4xx_alg_common crypt
- .min_keysize = AES_MIN_KEY_SIZE,
- .max_keysize = AES_MAX_KEY_SIZE,
- .setkey = crypto4xx_setkey_aes_ecb,
-- .encrypt = crypto4xx_encrypt,
-- .decrypt = crypto4xx_decrypt,
-+ .encrypt = crypto4xx_encrypt_noiv,
-+ .decrypt = crypto4xx_decrypt_noiv,
- }
- }
- } },
-@@ -1221,8 +1221,8 @@ static struct crypto4xx_alg_common crypt
- .max_keysize = AES_MAX_KEY_SIZE,
- .ivsize = AES_IV_SIZE,
- .setkey = crypto4xx_setkey_aes_ofb,
-- .encrypt = crypto4xx_encrypt,
-- .decrypt = crypto4xx_decrypt,
-+ .encrypt = crypto4xx_encrypt_iv,
-+ .decrypt = crypto4xx_decrypt_iv,
- }
- }
- } },
---- a/drivers/crypto/amcc/crypto4xx_core.h
-+++ b/drivers/crypto/amcc/crypto4xx_core.h
-@@ -168,8 +168,10 @@ int crypto4xx_setkey_aes_ofb(struct cryp
- const u8 *key, unsigned int keylen);
- int crypto4xx_setkey_rfc3686(struct crypto_ablkcipher *cipher,
- const u8 *key, unsigned int keylen);
--int crypto4xx_encrypt(struct ablkcipher_request *req);
--int crypto4xx_decrypt(struct ablkcipher_request *req);
-+int crypto4xx_encrypt_iv(struct ablkcipher_request *req);
-+int crypto4xx_decrypt_iv(struct ablkcipher_request *req);
-+int crypto4xx_encrypt_noiv(struct ablkcipher_request *req);
-+int crypto4xx_decrypt_noiv(struct ablkcipher_request *req);
- int crypto4xx_rfc3686_encrypt(struct ablkcipher_request *req);
- int crypto4xx_rfc3686_decrypt(struct ablkcipher_request *req);
- int crypto4xx_sha1_alg_init(struct crypto_tfm *tfm);