Commit 453e3090 authored by Christian Lamparter's avatar Christian Lamparter Committed by Herbert Xu

crypto: crypto4xx - fix dynamic_sa_ctl's sa_contents declaration

The driver had a union dynamic_sa_contents in place that
described the meaning of the bits in the sa_contents
variable.
Signed-off-by: default avatarChristian Lamparter <chunkeey@googlemail.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent c587e65d
...@@ -149,7 +149,7 @@ static int crypto4xx_setkey_aes(struct crypto_ablkcipher *cipher, ...@@ -149,7 +149,7 @@ static int crypto4xx_setkey_aes(struct crypto_ablkcipher *cipher,
SA_NOT_COPY_HDR); SA_NOT_COPY_HDR);
crypto4xx_memcpy_le(ctx->sa_in + get_dynamic_sa_offset_key_field(ctx), crypto4xx_memcpy_le(ctx->sa_in + get_dynamic_sa_offset_key_field(ctx),
key, keylen); key, keylen);
sa->sa_contents = SA_AES_CONTENTS | (keylen << 2); sa->sa_contents.w = SA_AES_CONTENTS | (keylen << 2);
sa->sa_command_1.bf.key_len = keylen >> 3; sa->sa_command_1.bf.key_len = keylen >> 3;
ctx->is_hash = 0; ctx->is_hash = 0;
ctx->direction = DIR_INBOUND; ctx->direction = DIR_INBOUND;
...@@ -219,7 +219,7 @@ static int crypto4xx_hash_alg_init(struct crypto_tfm *tfm, ...@@ -219,7 +219,7 @@ static int crypto4xx_hash_alg_init(struct crypto_tfm *tfm,
SA_NOT_COPY_PAD, SA_NOT_COPY_PAYLOAD, SA_NOT_COPY_PAD, SA_NOT_COPY_PAYLOAD,
SA_NOT_COPY_HDR); SA_NOT_COPY_HDR);
ctx->direction = DIR_INBOUND; ctx->direction = DIR_INBOUND;
sa->sa_contents = SA_HASH160_CONTENTS; sa->sa_contents.w = SA_HASH160_CONTENTS;
sa_in = (struct dynamic_sa_hash160 *) ctx->sa_in; sa_in = (struct dynamic_sa_hash160 *) ctx->sa_in;
/* Need to zero hash digest in SA */ /* Need to zero hash digest in SA */
memset(sa_in->inner_digest, 0, sizeof(sa_in->inner_digest)); memset(sa_in->inner_digest, 0, sizeof(sa_in->inner_digest));
......
...@@ -40,9 +40,9 @@ u32 get_dynamic_sa_offset_state_ptr_field(struct crypto4xx_ctx *ctx) ...@@ -40,9 +40,9 @@ u32 get_dynamic_sa_offset_state_ptr_field(struct crypto4xx_ctx *ctx)
union dynamic_sa_contents cts; union dynamic_sa_contents cts;
if (ctx->direction == DIR_INBOUND) if (ctx->direction == DIR_INBOUND)
cts.w = ((struct dynamic_sa_ctl *) ctx->sa_in)->sa_contents; cts.w = ((struct dynamic_sa_ctl *) ctx->sa_in)->sa_contents.w;
else else
cts.w = ((struct dynamic_sa_ctl *) ctx->sa_out)->sa_contents; cts.w = ((struct dynamic_sa_ctl *) ctx->sa_out)->sa_contents.w;
offset = cts.bf.key_size offset = cts.bf.key_size
+ cts.bf.inner_size + cts.bf.inner_size
+ cts.bf.outer_size + cts.bf.outer_size
...@@ -66,9 +66,9 @@ u32 get_dynamic_sa_iv_size(struct crypto4xx_ctx *ctx) ...@@ -66,9 +66,9 @@ u32 get_dynamic_sa_iv_size(struct crypto4xx_ctx *ctx)
union dynamic_sa_contents cts; union dynamic_sa_contents cts;
if (ctx->direction == DIR_INBOUND) if (ctx->direction == DIR_INBOUND)
cts.w = ((struct dynamic_sa_ctl *) ctx->sa_in)->sa_contents; cts.w = ((struct dynamic_sa_ctl *) ctx->sa_in)->sa_contents.w;
else else
cts.w = ((struct dynamic_sa_ctl *) ctx->sa_out)->sa_contents; cts.w = ((struct dynamic_sa_ctl *) ctx->sa_out)->sa_contents.w;
return (cts.bf.iv0 + cts.bf.iv1 + cts.bf.iv2 + cts.bf.iv3) * 4; return (cts.bf.iv0 + cts.bf.iv1 + cts.bf.iv2 + cts.bf.iv3) * 4;
} }
...@@ -77,9 +77,9 @@ u32 get_dynamic_sa_offset_key_field(struct crypto4xx_ctx *ctx) ...@@ -77,9 +77,9 @@ u32 get_dynamic_sa_offset_key_field(struct crypto4xx_ctx *ctx)
union dynamic_sa_contents cts; union dynamic_sa_contents cts;
if (ctx->direction == DIR_INBOUND) if (ctx->direction == DIR_INBOUND)
cts.w = ((struct dynamic_sa_ctl *) ctx->sa_in)->sa_contents; cts.w = ((struct dynamic_sa_ctl *) ctx->sa_in)->sa_contents.w;
else else
cts.w = ((struct dynamic_sa_ctl *) ctx->sa_out)->sa_contents; cts.w = ((struct dynamic_sa_ctl *) ctx->sa_out)->sa_contents.w;
return sizeof(struct dynamic_sa_ctl); return sizeof(struct dynamic_sa_ctl);
} }
...@@ -169,7 +169,7 @@ union sa_command_1 { ...@@ -169,7 +169,7 @@ union sa_command_1 {
} __attribute__((packed)); } __attribute__((packed));
struct dynamic_sa_ctl { struct dynamic_sa_ctl {
u32 sa_contents; union dynamic_sa_contents sa_contents;
union sa_command_0 sa_command_0; union sa_command_0 sa_command_0;
union sa_command_1 sa_command_1; union sa_command_1 sa_command_1;
} __attribute__((packed)); } __attribute__((packed));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment