Skip to content

Commit 58a6535

Browse files
Stanimir Varbanovherbertx
authored andcommitted
crypto: qce - fix sparse warnings
Fix few sparse warnings of type: - sparse: incorrect type in argument - sparse: incorrect type in initializer Signed-off-by: Stanimir Varbanov <svarbanov@mm-sol.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 178f827 commit 58a6535

3 files changed

Lines changed: 20 additions & 17 deletions

File tree

‎drivers/crypto/qce/common.c‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ static void qce_xtskey(struct qce_device *qce, const u8 *enckey,
201201
unsigned int xtsklen = enckeylen / (2 * sizeof(u32));
202202
unsigned int xtsdusize;
203203

204-
qce_cpu_to_be32p_array(xtskey, enckey + enckeylen / 2, enckeylen / 2);
204+
qce_cpu_to_be32p_array((__be32 *)xtskey, enckey + enckeylen / 2,
205+
enckeylen / 2);
205206
qce_write_array(qce, REG_ENCR_XTS_KEY0, xtskey, xtsklen);
206207

207208
/* xts du size 512B */
@@ -262,7 +263,8 @@ static int qce_setup_regs_ahash(struct crypto_async_request *async_req,
262263
u32 authkey_words = rctx->authklen / sizeof(u32);
263264

264265
qce_cpu_to_be32p_array(mackey, rctx->authkey, rctx->authklen);
265-
qce_write_array(qce, REG_AUTH_KEY0, mackey, authkey_words);
266+
qce_write_array(qce, REG_AUTH_KEY0, (u32 *)mackey,
267+
authkey_words);
266268
}
267269

268270
if (IS_CMAC(rctx->flags))
@@ -274,12 +276,13 @@ static int qce_setup_regs_ahash(struct crypto_async_request *async_req,
274276
qce_cpu_to_be32p_array(auth, rctx->digest, digestsize);
275277

276278
iv_words = (IS_SHA1(rctx->flags) || IS_SHA1_HMAC(rctx->flags)) ? 5 : 8;
277-
qce_write_array(qce, REG_AUTH_IV0, auth, iv_words);
279+
qce_write_array(qce, REG_AUTH_IV0, (u32 *)auth, iv_words);
278280

279281
if (rctx->first_blk)
280282
qce_clear_array(qce, REG_AUTH_BYTECNT0, 4);
281283
else
282-
qce_write_array(qce, REG_AUTH_BYTECNT0, rctx->byte_count, 2);
284+
qce_write_array(qce, REG_AUTH_BYTECNT0,
285+
(u32 *)rctx->byte_count, 2);
283286

284287
auth_cfg = qce_auth_cfg(rctx->flags, 0);
285288

@@ -354,15 +357,15 @@ static int qce_setup_regs_ablkcipher(struct crypto_async_request *async_req,
354357
return -EINVAL;
355358
}
356359

357-
qce_write_array(qce, REG_ENCR_KEY0, enckey, enckey_words);
360+
qce_write_array(qce, REG_ENCR_KEY0, (u32 *)enckey, enckey_words);
358361

359362
if (!IS_ECB(flags)) {
360363
if (IS_XTS(flags))
361364
qce_xts_swapiv(enciv, rctx->iv, ivsize);
362365
else
363366
qce_cpu_to_be32p_array(enciv, rctx->iv, ivsize);
364367

365-
qce_write_array(qce, REG_CNTR0_IV0, enciv, enciv_words);
368+
qce_write_array(qce, REG_CNTR0_IV0, (u32 *)enciv, enciv_words);
366369
}
367370

368371
if (IS_ENCRYPT(flags))

‎drivers/crypto/qce/common.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ struct qce_alg_template {
8585
struct list_head entry;
8686
u32 crypto_alg_type;
8787
unsigned long alg_flags;
88-
const __be32 *std_iv;
88+
const u32 *std_iv;
8989
union {
9090
struct crypto_alg crypto;
9191
struct ahash_alg ahash;

‎drivers/crypto/qce/sha.c‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525

2626
static LIST_HEAD(ahash_algs);
2727

28-
static const __be32 std_iv_sha1[SHA256_DIGEST_SIZE / sizeof(__be32)] = {
28+
static const u32 std_iv_sha1[SHA256_DIGEST_SIZE / sizeof(u32)] = {
2929
SHA1_H0, SHA1_H1, SHA1_H2, SHA1_H3, SHA1_H4, 0, 0, 0
3030
};
3131

32-
static const __be32 std_iv_sha256[SHA256_DIGEST_SIZE / sizeof(__be32)] = {
32+
static const u32 std_iv_sha256[SHA256_DIGEST_SIZE / sizeof(u32)] = {
3333
SHA256_H0, SHA256_H1, SHA256_H2, SHA256_H3,
3434
SHA256_H4, SHA256_H5, SHA256_H6, SHA256_H7
3535
};
@@ -132,7 +132,7 @@ static int qce_ahash_init(struct ahash_request *req)
132132
{
133133
struct qce_sha_reqctx *rctx = ahash_request_ctx(req);
134134
struct qce_alg_template *tmpl = to_ahash_tmpl(req->base.tfm);
135-
const __be32 *std_iv = tmpl->std_iv;
135+
const u32 *std_iv = tmpl->std_iv;
136136

137137
memset(rctx, 0, sizeof(*rctx));
138138
rctx->first_blk = true;
@@ -156,15 +156,15 @@ static int qce_ahash_export(struct ahash_request *req, void *out)
156156
struct sha1_state *out_state = out;
157157

158158
out_state->count = rctx->count;
159-
qce_cpu_to_be32p_array(out_state->state, rctx->digest,
160-
digestsize);
159+
qce_cpu_to_be32p_array((__be32 *)out_state->state,
160+
rctx->digest, digestsize);
161161
memcpy(out_state->buffer, rctx->buf, blocksize);
162162
} else if (IS_SHA256(flags) || IS_SHA256_HMAC(flags)) {
163163
struct sha256_state *out_state = out;
164164

165165
out_state->count = rctx->count;
166-
qce_cpu_to_be32p_array(out_state->state, rctx->digest,
167-
digestsize);
166+
qce_cpu_to_be32p_array((__be32 *)out_state->state,
167+
rctx->digest, digestsize);
168168
memcpy(out_state->buf, rctx->buf, blocksize);
169169
} else {
170170
return -EINVAL;
@@ -199,8 +199,8 @@ static int qce_import_common(struct ahash_request *req, u64 in_count,
199199
count += SHA_PADDING;
200200
}
201201

202-
rctx->byte_count[0] = (__be32)(count & ~SHA_PADDING_MASK);
203-
rctx->byte_count[1] = (__be32)(count >> 32);
202+
rctx->byte_count[0] = (__force __be32)(count & ~SHA_PADDING_MASK);
203+
rctx->byte_count[1] = (__force __be32)(count >> 32);
204204
qce_cpu_to_be32p_array((__be32 *)rctx->digest, (const u8 *)state,
205205
digestsize);
206206
rctx->buflen = (unsigned int)(in_count & (blocksize - 1));
@@ -454,7 +454,7 @@ struct qce_ahash_def {
454454
unsigned int digestsize;
455455
unsigned int blocksize;
456456
unsigned int statesize;
457-
const __be32 *std_iv;
457+
const u32 *std_iv;
458458
};
459459

460460
static const struct qce_ahash_def ahash_def[] = {

0 commit comments

Comments
 (0)