From c2c5bc8041a1e3b7df39c2aebc3109c4bb3812b6 Mon Sep 17 00:00:00 2001 From: CN_SZTL Date: Tue, 11 Aug 2020 22:54:05 +0800 Subject: [PATCH] ipq40xx: revert changes of some patches Signed-off-by: CN_SZTL --- ...pto-qce-fix-ctr-aes-qce-block-chunk-sizes.patch | 6 ++++-- .../042-crypto-qce-fix-xts-aes-qce-key-sizes.patch | 8 +++++--- ...o-qce-save-a-sg-table-slot-for-result-buf.patch | 14 ++++++++++---- .../044-crypto-qce-update-the-skcipher-IV.patch | 6 ++++-- ...ypto-qce-initialize-fallback-only-for-AES.patch | 6 ++++-- ...to-qce-use-cryptlen-when-adding-extra-sgl.patch | 14 ++++++++++---- ...o-qce-handle-AES-XTS-cases-that-qce-fails.patch | 8 +++++++- 7 files changed, 44 insertions(+), 18 deletions(-) diff --git a/target/linux/ipq40xx/patches-4.19/041-crypto-qce-fix-ctr-aes-qce-block-chunk-sizes.patch b/target/linux/ipq40xx/patches-4.19/041-crypto-qce-fix-ctr-aes-qce-block-chunk-sizes.patch index 59f7445a15..7d822c59d6 100644 --- a/target/linux/ipq40xx/patches-4.19/041-crypto-qce-fix-ctr-aes-qce-block-chunk-sizes.patch +++ b/target/linux/ipq40xx/patches-4.19/041-crypto-qce-fix-ctr-aes-qce-block-chunk-sizes.patch @@ -9,6 +9,8 @@ size belongs. Signed-off-by: Eneas U de Queiroz +diff --git a/drivers/crypto/qce/skcipher.c b/drivers/crypto/qce/skcipher.c +index 0376bb969834..0776286cfc9e 100644 --- a/drivers/crypto/qce/skcipher.c +++ b/drivers/crypto/qce/skcipher.c @@ -261,6 +261,7 @@ struct qce_skcipher_def { @@ -19,7 +21,7 @@ Signed-off-by: Eneas U de Queiroz unsigned int ivsize; unsigned int min_keysize; unsigned int max_keysize; -@@ -289,7 +290,8 @@ static const struct qce_skcipher_def skc +@@ -289,7 +290,8 @@ static const struct qce_skcipher_def skcipher_def[] = { .flags = QCE_ALG_AES | QCE_MODE_CTR, .name = "ctr(aes)", .drv_name = "ctr-aes-qce", @@ -29,7 +31,7 @@ Signed-off-by: Eneas U de Queiroz .ivsize = AES_BLOCK_SIZE, .min_keysize = AES_MIN_KEY_SIZE, .max_keysize = AES_MAX_KEY_SIZE, -@@ -359,6 +361,7 @@ static int qce_skcipher_register_one(con +@@ -359,6 +361,7 @@ static int qce_skcipher_register_one(const struct qce_skcipher_def *def, def->drv_name); alg->base.cra_blocksize = def->blocksize; diff --git a/target/linux/ipq40xx/patches-4.19/042-crypto-qce-fix-xts-aes-qce-key-sizes.patch b/target/linux/ipq40xx/patches-4.19/042-crypto-qce-fix-xts-aes-qce-key-sizes.patch index 50b888351c..dd58dcd801 100644 --- a/target/linux/ipq40xx/patches-4.19/042-crypto-qce-fix-xts-aes-qce-key-sizes.patch +++ b/target/linux/ipq40xx/patches-4.19/042-crypto-qce-fix-xts-aes-qce-key-sizes.patch @@ -8,9 +8,11 @@ skcipher_def, and halved when checking if it is AES-128/192/256. Signed-off-by: Eneas U de Queiroz +diff --git a/drivers/crypto/qce/skcipher.c b/drivers/crypto/qce/skcipher.c +index 0776286cfc9e..9b1bb32515b4 100644 --- a/drivers/crypto/qce/skcipher.c +++ b/drivers/crypto/qce/skcipher.c -@@ -168,7 +168,7 @@ static int qce_skcipher_setkey(struct cr +@@ -168,7 +168,7 @@ static int qce_skcipher_setkey(struct crypto_skcipher *ablk, const u8 *key, return -EINVAL; if (IS_AES(flags)) { @@ -19,7 +21,7 @@ Signed-off-by: Eneas U de Queiroz case AES_KEYSIZE_128: case AES_KEYSIZE_256: break; -@@ -203,13 +203,15 @@ static int qce_skcipher_crypt(struct skc +@@ -203,13 +203,15 @@ static int qce_skcipher_crypt(struct skcipher_request *req, int encrypt) struct qce_cipher_ctx *ctx = crypto_skcipher_ctx(tfm); struct qce_cipher_reqctx *rctx = skcipher_request_ctx(req); struct qce_alg_template *tmpl = to_cipher_tmpl(tfm); @@ -37,7 +39,7 @@ Signed-off-by: Eneas U de Queiroz SKCIPHER_REQUEST_ON_STACK(subreq, ctx->fallback); skcipher_request_set_tfm(subreq, ctx->fallback); -@@ -302,8 +304,8 @@ static const struct qce_skcipher_def skc +@@ -302,8 +304,8 @@ static const struct qce_skcipher_def skcipher_def[] = { .drv_name = "xts-aes-qce", .blocksize = AES_BLOCK_SIZE, .ivsize = AES_BLOCK_SIZE, diff --git a/target/linux/ipq40xx/patches-4.19/043-crypto-qce-save-a-sg-table-slot-for-result-buf.patch b/target/linux/ipq40xx/patches-4.19/043-crypto-qce-save-a-sg-table-slot-for-result-buf.patch index 95650690fb..9f107db035 100644 --- a/target/linux/ipq40xx/patches-4.19/043-crypto-qce-save-a-sg-table-slot-for-result-buf.patch +++ b/target/linux/ipq40xx/patches-4.19/043-crypto-qce-save-a-sg-table-slot-for-result-buf.patch @@ -21,9 +21,11 @@ for the result buffer is guaranteed to be unused. Signed-off-by: Eneas U de Queiroz +diff --git a/drivers/crypto/qce/dma.c b/drivers/crypto/qce/dma.c +index 4797e795c9b9..db560c3d3e4f 100644 --- a/drivers/crypto/qce/dma.c +++ b/drivers/crypto/qce/dma.c -@@ -55,7 +55,8 @@ void qce_dma_release(struct qce_dma_data +@@ -55,7 +55,8 @@ void qce_dma_release(struct qce_dma_data *dma) } struct scatterlist * @@ -33,7 +35,7 @@ Signed-off-by: Eneas U de Queiroz { struct scatterlist *sg = sgt->sgl, *sg_last = NULL; -@@ -68,12 +69,13 @@ qce_sgtable_add(struct sg_table *sgt, st +@@ -68,12 +69,13 @@ qce_sgtable_add(struct sg_table *sgt, struct scatterlist *new_sgl) if (!sg) return ERR_PTR(-EINVAL); @@ -48,9 +50,11 @@ Signed-off-by: Eneas U de Queiroz } return sg_last; +diff --git a/drivers/crypto/qce/dma.h b/drivers/crypto/qce/dma.h +index 130235d17bb4..0be71f7f7a58 100644 --- a/drivers/crypto/qce/dma.h +++ b/drivers/crypto/qce/dma.h -@@ -50,6 +50,7 @@ int qce_dma_prep_sgs(struct qce_dma_data +@@ -50,6 +50,7 @@ int qce_dma_prep_sgs(struct qce_dma_data *dma, struct scatterlist *sg_in, void qce_dma_issue_pending(struct qce_dma_data *dma); int qce_dma_terminate_all(struct qce_dma_data *dma); struct scatterlist * @@ -59,9 +63,11 @@ Signed-off-by: Eneas U de Queiroz + int max_ents); #endif /* _DMA_H_ */ +diff --git a/drivers/crypto/qce/skcipher.c b/drivers/crypto/qce/skcipher.c +index 12f882032544..33d998f5cf5f 100644 --- a/drivers/crypto/qce/skcipher.c +++ b/drivers/crypto/qce/skcipher.c -@@ -103,13 +103,13 @@ qce_skcipher_async_req_handle(struct cry +@@ -103,13 +103,13 @@ qce_skcipher_async_req_handle(struct crypto_async_request *async_req) sg_init_one(&rctx->result_sg, qce->dma.result_buf, QCE_RESULT_BUF_SZ); diff --git a/target/linux/ipq40xx/patches-4.19/044-crypto-qce-update-the-skcipher-IV.patch b/target/linux/ipq40xx/patches-4.19/044-crypto-qce-update-the-skcipher-IV.patch index 33be510a82..de7829e767 100644 --- a/target/linux/ipq40xx/patches-4.19/044-crypto-qce-update-the-skcipher-IV.patch +++ b/target/linux/ipq40xx/patches-4.19/044-crypto-qce-update-the-skcipher-IV.patch @@ -7,9 +7,11 @@ Update the IV after the completion of each cipher operation. Signed-off-by: Eneas U de Queiroz +diff --git a/drivers/crypto/qce/skcipher.c b/drivers/crypto/qce/skcipher.c +index 33d998f5cf5f..51377395ed53 100644 --- a/drivers/crypto/qce/skcipher.c +++ b/drivers/crypto/qce/skcipher.c -@@ -29,6 +29,7 @@ static void qce_skcipher_done(void *data +@@ -29,6 +29,7 @@ static void qce_skcipher_done(void *data) struct qce_cipher_reqctx *rctx = skcipher_request_ctx(req); struct qce_alg_template *tmpl = to_cipher_tmpl(crypto_skcipher_reqtfm(req)); struct qce_device *qce = tmpl->qce; @@ -17,7 +19,7 @@ Signed-off-by: Eneas U de Queiroz enum dma_data_direction dir_src, dir_dst; u32 status; int error; -@@ -53,6 +54,7 @@ static void qce_skcipher_done(void *data +@@ -53,6 +54,7 @@ static void qce_skcipher_done(void *data) if (error < 0) dev_dbg(qce->dev, "skcipher operation error (%x)\n", status); diff --git a/target/linux/ipq40xx/patches-4.19/046-crypto-qce-initialize-fallback-only-for-AES.patch b/target/linux/ipq40xx/patches-4.19/046-crypto-qce-initialize-fallback-only-for-AES.patch index e3adaf864e..b673884ba2 100644 --- a/target/linux/ipq40xx/patches-4.19/046-crypto-qce-initialize-fallback-only-for-AES.patch +++ b/target/linux/ipq40xx/patches-4.19/046-crypto-qce-initialize-fallback-only-for-AES.patch @@ -12,9 +12,11 @@ restricted to AES. Signed-off-by: Eneas U de Queiroz +diff --git a/drivers/crypto/qce/skcipher.c b/drivers/crypto/qce/skcipher.c +index 51377395ed53..5a4863091f2a 100644 --- a/drivers/crypto/qce/skcipher.c +++ b/drivers/crypto/qce/skcipher.c -@@ -246,7 +246,15 @@ static int qce_skcipher_init(struct cryp +@@ -246,7 +246,15 @@ static int qce_skcipher_init(struct crypto_skcipher *tfm) memset(ctx, 0, sizeof(*ctx)); crypto_skcipher_set_reqsize(tfm, sizeof(struct qce_cipher_reqctx)); @@ -30,7 +32,7 @@ Signed-off-by: Eneas U de Queiroz ctx->fallback = crypto_alloc_skcipher(crypto_tfm_alg_name(&tfm->base), 0, CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK); -@@ -375,14 +383,18 @@ static int qce_skcipher_register_one(con +@@ -375,14 +383,18 @@ static int qce_skcipher_register_one(const struct qce_skcipher_def *def, alg->base.cra_priority = 300; alg->base.cra_flags = CRYPTO_ALG_ASYNC | diff --git a/target/linux/ipq40xx/patches-4.19/047-crypto-qce-use-cryptlen-when-adding-extra-sgl.patch b/target/linux/ipq40xx/patches-4.19/047-crypto-qce-use-cryptlen-when-adding-extra-sgl.patch index aabc8fd622..8003f7502a 100644 --- a/target/linux/ipq40xx/patches-4.19/047-crypto-qce-use-cryptlen-when-adding-extra-sgl.patch +++ b/target/linux/ipq40xx/patches-4.19/047-crypto-qce-use-cryptlen-when-adding-extra-sgl.patch @@ -20,9 +20,11 @@ destination buffer to req->cryptlen before appending the result buf. Signed-off-by: Eneas U de Queiroz +diff --git a/drivers/crypto/qce/dma.c b/drivers/crypto/qce/dma.c +index db560c3d3e4f..0ae9d28afa69 100644 --- a/drivers/crypto/qce/dma.c +++ b/drivers/crypto/qce/dma.c -@@ -56,9 +56,10 @@ void qce_dma_release(struct qce_dma_data +@@ -56,9 +56,10 @@ void qce_dma_release(struct qce_dma_data *dma) struct scatterlist * qce_sgtable_add(struct sg_table *sgt, struct scatterlist *new_sgl, @@ -34,7 +36,7 @@ Signed-off-by: Eneas U de Queiroz while (sg) { if (!sg_page(sg)) -@@ -69,13 +70,13 @@ qce_sgtable_add(struct sg_table *sgt, st +@@ -69,13 +70,13 @@ qce_sgtable_add(struct sg_table *sgt, struct scatterlist *new_sgl, if (!sg) return ERR_PTR(-EINVAL); @@ -52,9 +54,11 @@ Signed-off-by: Eneas U de Queiroz } return sg_last; +diff --git a/drivers/crypto/qce/dma.h b/drivers/crypto/qce/dma.h +index 0be71f7f7a58..710d5e370293 100644 --- a/drivers/crypto/qce/dma.h +++ b/drivers/crypto/qce/dma.h -@@ -51,6 +51,6 @@ void qce_dma_issue_pending(struct qce_dm +@@ -51,6 +51,6 @@ void qce_dma_issue_pending(struct qce_dma_data *dma); int qce_dma_terminate_all(struct qce_dma_data *dma); struct scatterlist * qce_sgtable_add(struct sg_table *sgt, struct scatterlist *sg_add, @@ -62,9 +66,11 @@ Signed-off-by: Eneas U de Queiroz + unsigned int max_len); #endif /* _DMA_H_ */ +diff --git a/drivers/crypto/qce/skcipher.c b/drivers/crypto/qce/skcipher.c +index 5af74f2431ca..188eb234ba2c 100644 --- a/drivers/crypto/qce/skcipher.c +++ b/drivers/crypto/qce/skcipher.c -@@ -105,13 +105,14 @@ qce_skcipher_async_req_handle(struct cry +@@ -105,13 +105,14 @@ qce_skcipher_async_req_handle(struct crypto_async_request *async_req) sg_init_one(&rctx->result_sg, qce->dma.result_buf, QCE_RESULT_BUF_SZ); diff --git a/target/linux/ipq40xx/patches-4.19/049-crypto-qce-handle-AES-XTS-cases-that-qce-fails.patch b/target/linux/ipq40xx/patches-4.19/049-crypto-qce-handle-AES-XTS-cases-that-qce-fails.patch index 00dc3791ab..eee2241d19 100644 --- a/target/linux/ipq40xx/patches-4.19/049-crypto-qce-handle-AES-XTS-cases-that-qce-fails.patch +++ b/target/linux/ipq40xx/patches-4.19/049-crypto-qce-handle-AES-XTS-cases-that-qce-fails.patch @@ -9,6 +9,8 @@ fallback cipher handle them. Signed-off-by: Eneas U de Queiroz +diff --git a/drivers/crypto/qce/common.c b/drivers/crypto/qce/common.c +index 3849d7bcaeb0..3e0fcd7613f1 100644 --- a/drivers/crypto/qce/common.c +++ b/drivers/crypto/qce/common.c @@ -23,8 +23,6 @@ @@ -20,6 +22,8 @@ Signed-off-by: Eneas U de Queiroz static inline u32 qce_read(struct qce_device *qce, u32 offset) { return readl(qce->base + offset); +diff --git a/drivers/crypto/qce/common.h b/drivers/crypto/qce/common.h +index 3252efa41e7a..5f9d3c4e3ead 100644 --- a/drivers/crypto/qce/common.h +++ b/drivers/crypto/qce/common.h @@ -20,6 +20,9 @@ @@ -32,9 +36,11 @@ Signed-off-by: Eneas U de Queiroz /* key size in bytes */ #define QCE_SHA_HMAC_KEY_SIZE 64 #define QCE_MAX_CIPHER_KEY_SIZE AES_KEYSIZE_256 +diff --git a/drivers/crypto/qce/skcipher.c b/drivers/crypto/qce/skcipher.c +index 9b72fec2ab2e..e46cb8269640 100644 --- a/drivers/crypto/qce/skcipher.c +++ b/drivers/crypto/qce/skcipher.c -@@ -213,9 +213,14 @@ static int qce_skcipher_crypt(struct skc +@@ -213,9 +213,14 @@ static int qce_skcipher_crypt(struct skcipher_request *req, int encrypt) rctx->flags |= encrypt ? QCE_ENCRYPT : QCE_DECRYPT; keylen = IS_XTS(rctx->flags) ? ctx->enc_keylen >> 1 : ctx->enc_keylen;