db57f7b3a81c32beec0f3c30b5b40a471caf18f7
[openwrt/staging/yousong.git] /
1 From 453e3090b9c3f5da70b21648c2244e9821f0916d Mon Sep 17 00:00:00 2001
2 From: Christian Lamparter <chunkeey@googlemail.com>
3 Date: Fri, 25 Aug 2017 15:47:19 +0200
4 Subject: [PATCH 06/25] crypto: crypto4xx - fix dynamic_sa_ctl's sa_contents
5 declaration
6
7 The driver had a union dynamic_sa_contents in place that
8 described the meaning of the bits in the sa_contents
9 variable.
10
11 Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
12 Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
13 ---
14 drivers/crypto/amcc/crypto4xx_alg.c | 4 ++--
15 drivers/crypto/amcc/crypto4xx_sa.c | 12 ++++++------
16 drivers/crypto/amcc/crypto4xx_sa.h | 2 +-
17 3 files changed, 9 insertions(+), 9 deletions(-)
18
19 --- a/drivers/crypto/amcc/crypto4xx_alg.c
20 +++ b/drivers/crypto/amcc/crypto4xx_alg.c
21 @@ -150,7 +150,7 @@ static int crypto4xx_setkey_aes(struct c
22 SA_NOT_COPY_HDR);
23 crypto4xx_memcpy_le(ctx->sa_in + get_dynamic_sa_offset_key_field(ctx),
24 key, keylen);
25 - sa->sa_contents = SA_AES_CONTENTS | (keylen << 2);
26 + sa->sa_contents.w = SA_AES_CONTENTS | (keylen << 2);
27 sa->sa_command_1.bf.key_len = keylen >> 3;
28 ctx->is_hash = 0;
29 ctx->direction = DIR_INBOUND;
30 @@ -220,7 +220,7 @@ static int crypto4xx_hash_alg_init(struc
31 SA_NOT_COPY_PAD, SA_NOT_COPY_PAYLOAD,
32 SA_NOT_COPY_HDR);
33 ctx->direction = DIR_INBOUND;
34 - sa->sa_contents = SA_HASH160_CONTENTS;
35 + sa->sa_contents.w = SA_HASH160_CONTENTS;
36 sa_in = (struct dynamic_sa_hash160 *) ctx->sa_in;
37 /* Need to zero hash digest in SA */
38 memset(sa_in->inner_digest, 0, sizeof(sa_in->inner_digest));
39 --- a/drivers/crypto/amcc/crypto4xx_sa.c
40 +++ b/drivers/crypto/amcc/crypto4xx_sa.c
41 @@ -40,9 +40,9 @@ u32 get_dynamic_sa_offset_state_ptr_fiel
42 union dynamic_sa_contents cts;
43
44 if (ctx->direction == DIR_INBOUND)
45 - cts.w = ((struct dynamic_sa_ctl *) ctx->sa_in)->sa_contents;
46 + cts.w = ((struct dynamic_sa_ctl *) ctx->sa_in)->sa_contents.w;
47 else
48 - cts.w = ((struct dynamic_sa_ctl *) ctx->sa_out)->sa_contents;
49 + cts.w = ((struct dynamic_sa_ctl *) ctx->sa_out)->sa_contents.w;
50 offset = cts.bf.key_size
51 + cts.bf.inner_size
52 + cts.bf.outer_size
53 @@ -66,9 +66,9 @@ u32 get_dynamic_sa_iv_size(struct crypto
54 union dynamic_sa_contents cts;
55
56 if (ctx->direction == DIR_INBOUND)
57 - cts.w = ((struct dynamic_sa_ctl *) ctx->sa_in)->sa_contents;
58 + cts.w = ((struct dynamic_sa_ctl *) ctx->sa_in)->sa_contents.w;
59 else
60 - cts.w = ((struct dynamic_sa_ctl *) ctx->sa_out)->sa_contents;
61 + cts.w = ((struct dynamic_sa_ctl *) ctx->sa_out)->sa_contents.w;
62 return (cts.bf.iv0 + cts.bf.iv1 + cts.bf.iv2 + cts.bf.iv3) * 4;
63 }
64
65 @@ -77,9 +77,9 @@ u32 get_dynamic_sa_offset_key_field(stru
66 union dynamic_sa_contents cts;
67
68 if (ctx->direction == DIR_INBOUND)
69 - cts.w = ((struct dynamic_sa_ctl *) ctx->sa_in)->sa_contents;
70 + cts.w = ((struct dynamic_sa_ctl *) ctx->sa_in)->sa_contents.w;
71 else
72 - cts.w = ((struct dynamic_sa_ctl *) ctx->sa_out)->sa_contents;
73 + cts.w = ((struct dynamic_sa_ctl *) ctx->sa_out)->sa_contents.w;
74
75 return sizeof(struct dynamic_sa_ctl);
76 }
77 --- a/drivers/crypto/amcc/crypto4xx_sa.h
78 +++ b/drivers/crypto/amcc/crypto4xx_sa.h
79 @@ -169,7 +169,7 @@ union sa_command_1 {
80 } __attribute__((packed));
81
82 struct dynamic_sa_ctl {
83 - u32 sa_contents;
84 + union dynamic_sa_contents sa_contents;
85 union sa_command_0 sa_command_0;
86 union sa_command_1 sa_command_1;
87 } __attribute__((packed));