apm821xx: Revert upstream fix which breaks compile
authorHauke Mehrtens <hauke@hauke-m.de>
Thu, 20 Jun 2019 09:40:23 +0000 (11:40 +0200)
committerHauke Mehrtens <hauke@hauke-m.de>
Thu, 20 Jun 2019 10:53:53 +0000 (12:53 +0200)
This reverts a commit added in kernel v4.4.179 which breaks compilation
on the apm821xx target.

This fixes the following compile problem:
drivers/crypto/amcc/crypto4xx_core.c: In function 'crypto4xx_ablkcipher_done':
drivers/crypto/amcc/crypto4xx_core.c:650:21: warning: dereferencing 'void *' pointer
  if (pd_uinfo->sa_va->sa_command_0.bf.save_iv == SA_SAVE_IV) {
                     ^
drivers/crypto/amcc/crypto4xx_core.c:650:21: error: request for member 'sa_command_0' in something not a structure or union
drivers/crypto/amcc/crypto4xx_core.c:651:38: error: implicit declaration of function 'crypto_skcipher_reqtfm' [-Werror=implicit-function-declaration]
   struct crypto_skcipher *skcipher = crypto_skcipher_reqtfm(req);
                                      ^
drivers/crypto/amcc/crypto4xx_core.c:651:61: error: 'req' undeclared (first use in this function)
   struct crypto_skcipher *skcipher = crypto_skcipher_reqtfm(req);
                                                             ^
drivers/crypto/amcc/crypto4xx_core.c:651:61: note: each undeclared identifier is reported only once for each function it appears in
drivers/crypto/amcc/crypto4xx_core.c:653:3: error: implicit declaration of function 'crypto4xx_memcpy_from_le32' [-Werror=implicit-function-declaration]
   crypto4xx_memcpy_from_le32((u32 *)req->iv,
   ^
drivers/crypto/amcc/crypto4xx_core.c:654:19: warning: dereferencing 'void *' pointer
    pd_uinfo->sr_va->save_iv,
                   ^
drivers/crypto/amcc/crypto4xx_core.c:654:19: error: request for member 'save_iv' in something not a structure or union
drivers/crypto/amcc/crypto4xx_core.c:655:4: error: implicit declaration of function 'crypto_skcipher_ivsize' [-Werror=implicit-function-declaration]
    crypto_skcipher_ivsize(skcipher));
    ^
cc1: some warnings being treated as errors

Fixes: 6c5c3a2edccf ("kernel: Update to version 4.4.182")
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
target/linux/apm821xx/patches-4.4/003-Revert-crypto-crypto4xx-properly-set-IV-after-de-and.patch [new file with mode: 0644]

diff --git a/target/linux/apm821xx/patches-4.4/003-Revert-crypto-crypto4xx-properly-set-IV-after-de-and.patch b/target/linux/apm821xx/patches-4.4/003-Revert-crypto-crypto4xx-properly-set-IV-after-de-and.patch
new file mode 100644 (file)
index 0000000..428b416
--- /dev/null
@@ -0,0 +1,43 @@
+From 8d9f1b2c4ad8b86c4a5af5e4787ea4eae7853f6d Mon Sep 17 00:00:00 2001
+From: Hauke Mehrtens <hauke@hauke-m.de>
+Date: Thu, 20 Jun 2019 11:29:15 +0200
+Subject: Revert "crypto: crypto4xx - properly set IV after de- and encrypt"
+
+This reverts commit e9a60ab1609a7d975922adad1bf9c46ac6954584.
+
+This fixes a compile problem in upstream kernel 4.4.
+---
+ drivers/crypto/amcc/crypto4xx_alg.c  | 3 +--
+ drivers/crypto/amcc/crypto4xx_core.c | 9 ---------
+ 2 files changed, 1 insertion(+), 11 deletions(-)
+
+--- a/drivers/crypto/amcc/crypto4xx_alg.c
++++ b/drivers/crypto/amcc/crypto4xx_alg.c
+@@ -138,8 +138,7 @@ static int crypto4xx_setkey_aes(struct c
+       sa = (struct dynamic_sa_ctl *) ctx->sa_in;
+       ctx->hash_final = 0;
+-      set_dynamic_sa_command_0(sa, SA_NOT_SAVE_HASH, (cm == CRYPTO_MODE_CBC ?
+-                               SA_SAVE_IV : SA_NOT_SAVE_IV),
++      set_dynamic_sa_command_0(sa, SA_NOT_SAVE_HASH, SA_NOT_SAVE_IV,
+                                SA_LOAD_HASH_FROM_SA, SA_LOAD_IV_FROM_STATE,
+                                SA_NO_HEADER_PROC, SA_HASH_ALG_NULL,
+                                SA_CIPHER_ALG_AES, SA_PAD_TYPE_ZERO,
+--- a/drivers/crypto/amcc/crypto4xx_core.c
++++ b/drivers/crypto/amcc/crypto4xx_core.c
+@@ -646,15 +646,6 @@ static u32 crypto4xx_ablkcipher_done(str
+               addr = dma_map_page(dev->core_dev->device, sg_page(dst),
+                                   dst->offset, dst->length, DMA_FROM_DEVICE);
+       }
+-
+-      if (pd_uinfo->sa_va->sa_command_0.bf.save_iv == SA_SAVE_IV) {
+-              struct crypto_skcipher *skcipher = crypto_skcipher_reqtfm(req);
+-
+-              crypto4xx_memcpy_from_le32((u32 *)req->iv,
+-                      pd_uinfo->sr_va->save_iv,
+-                      crypto_skcipher_ivsize(skcipher));
+-      }
+-
+       crypto4xx_ret_sg_desc(dev, pd_uinfo);
+       if (ablk_req->base.complete != NULL)
+               ablk_req->base.complete(&ablk_req->base, 0);