466f0a0a78f75084c4fca5b11725f35f4fd37a28
[openwrt/openwrt.git] / target / linux / apm821xx / patches-4.14 / 020-0002-crypto-crypto4xx-remove-unused-definitions-and-write.patch
1 From 81065f66dd99b3af58626a914b8c0fcff6b8b0ba Mon Sep 17 00:00:00 2001
2 From: Christian Lamparter <chunkeey@googlemail.com>
3 Date: Fri, 25 Aug 2017 15:47:15 +0200
4 Subject: [PATCH 02/25] crypto: crypto4xx - remove unused definitions and
5 write-only variables
6
7 This patch removes several unused code and definitons
8 (structs, variables, ...).
9
10 Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
11 Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
12 ---
13 drivers/crypto/amcc/crypto4xx_alg.c | 6 ------
14 drivers/crypto/amcc/crypto4xx_core.c | 2 +-
15 drivers/crypto/amcc/crypto4xx_core.h | 16 ----------------
16 3 files changed, 1 insertion(+), 23 deletions(-)
17
18 --- a/drivers/crypto/amcc/crypto4xx_alg.c
19 +++ b/drivers/crypto/amcc/crypto4xx_alg.c
20 @@ -75,7 +75,6 @@ int crypto4xx_encrypt(struct ablkcipher_
21 struct crypto4xx_ctx *ctx = crypto_tfm_ctx(req->base.tfm);
22
23 ctx->direction = DIR_OUTBOUND;
24 - ctx->hash_final = 0;
25 ctx->is_hash = 0;
26 ctx->pd_ctl = 0x1;
27
28 @@ -89,7 +88,6 @@ int crypto4xx_decrypt(struct ablkcipher_
29 struct crypto4xx_ctx *ctx = crypto_tfm_ctx(req->base.tfm);
30
31 ctx->direction = DIR_INBOUND;
32 - ctx->hash_final = 0;
33 ctx->is_hash = 0;
34 ctx->pd_ctl = 1;
35
36 @@ -136,7 +134,6 @@ static int crypto4xx_setkey_aes(struct c
37 }
38 /* Setup SA */
39 sa = (struct dynamic_sa_ctl *) ctx->sa_in;
40 - ctx->hash_final = 0;
41
42 set_dynamic_sa_command_0(sa, SA_NOT_SAVE_HASH, SA_NOT_SAVE_IV,
43 SA_LOAD_HASH_FROM_SA, SA_LOAD_IV_FROM_STATE,
44 @@ -191,7 +188,6 @@ static int crypto4xx_hash_alg_init(struc
45
46 ctx->dev = my_alg->dev;
47 ctx->is_hash = 1;
48 - ctx->hash_final = 0;
49
50 /* Create SA */
51 if (ctx->sa_in_dma_addr || ctx->sa_out_dma_addr)
52 @@ -256,7 +252,6 @@ int crypto4xx_hash_update(struct ahash_r
53 struct crypto4xx_ctx *ctx = crypto_tfm_ctx(req->base.tfm);
54
55 ctx->is_hash = 1;
56 - ctx->hash_final = 0;
57 ctx->pd_ctl = 0x11;
58 ctx->direction = DIR_INBOUND;
59
60 @@ -274,7 +269,6 @@ int crypto4xx_hash_digest(struct ahash_r
61 {
62 struct crypto4xx_ctx *ctx = crypto_tfm_ctx(req->base.tfm);
63
64 - ctx->hash_final = 1;
65 ctx->pd_ctl = 0x11;
66 ctx->direction = DIR_INBOUND;
67
68 --- a/drivers/crypto/amcc/crypto4xx_core.c
69 +++ b/drivers/crypto/amcc/crypto4xx_core.c
70 @@ -964,7 +964,7 @@ u32 crypto4xx_build_pd(struct crypto_asy
71
72 sa->sa_command_1.bf.hash_crypto_offset = 0;
73 pd->pd_ctl.w = ctx->pd_ctl;
74 - pd->pd_ctl_len.w = 0x00400000 | (ctx->bypass << 24) | datalen;
75 + pd->pd_ctl_len.w = 0x00400000 | datalen;
76 pd_uinfo->state = PD_ENTRY_INUSE;
77 wmb();
78 /* write any value to push engine to read a pd */
79 --- a/drivers/crypto/amcc/crypto4xx_core.h
80 +++ b/drivers/crypto/amcc/crypto4xx_core.h
81 @@ -72,7 +72,6 @@ struct pd_uinfo {
82 struct crypto4xx_device {
83 struct crypto4xx_core_device *core_dev;
84 char *name;
85 - u64 ce_phy_address;
86 void __iomem *ce_base;
87 void __iomem *trng_base;
88
89 @@ -127,21 +126,9 @@ struct crypto4xx_ctx {
90 u32 sa_len;
91 u32 offset_to_sr_ptr; /* offset to state ptr, in dynamic sa */
92 u32 direction;
93 - u32 next_hdr;
94 u32 save_iv;
95 - u32 pd_ctl_len;
96 u32 pd_ctl;
97 - u32 bypass;
98 u32 is_hash;
99 - u32 hash_final;
100 -};
101 -
102 -struct crypto4xx_req_ctx {
103 - struct crypto4xx_device *dev; /* Device in which
104 - operation to send to */
105 - void *sa;
106 - u32 sa_dma_addr;
107 - u16 sa_len;
108 };
109
110 struct crypto4xx_alg_common {
111 @@ -172,9 +159,6 @@ static inline struct crypto4xx_alg *cryp
112
113 extern int crypto4xx_alloc_sa(struct crypto4xx_ctx *ctx, u32 size);
114 extern void crypto4xx_free_sa(struct crypto4xx_ctx *ctx);
115 -extern u32 crypto4xx_alloc_sa_rctx(struct crypto4xx_ctx *ctx,
116 - struct crypto4xx_ctx *rctx);
117 -extern void crypto4xx_free_sa_rctx(struct crypto4xx_ctx *rctx);
118 extern void crypto4xx_free_ctx(struct crypto4xx_ctx *ctx);
119 extern u32 crypto4xx_alloc_state_record(struct crypto4xx_ctx *ctx);
120 extern u32 get_dynamic_sa_offset_state_ptr_field(struct crypto4xx_ctx *ctx);