Skip to content

Commit a56772d

Browse files
committed
Merge branch 'chelsio-crypto-fixes'
Ayush Sawal says: ==================== Fixing compilation warnings and errors Patch 1: Fixes the warnings seen when compiling using sparse tool. Patch 2: Fixes a cocci check error introduced after commit 567be3a ("crypto: chelsio - Use multiple txq/rxq per tfm to process the requests"). V1->V2 patch1: Avoid type casting by using get_unaligned_be32() and put_unaligned_be16/32() functions. patch2: Modified subject of the patch. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 76d7728 + 055be68 commit a56772d

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

drivers/crypto/chelsio/chcr_algo.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ static void get_aes_decrypt_key(unsigned char *dec_key,
256256
return;
257257
}
258258
for (i = 0; i < nk; i++)
259-
w_ring[i] = be32_to_cpu(*(u32 *)&key[4 * i]);
259+
w_ring[i] = get_unaligned_be32(&key[i * 4]);
260260

261261
i = 0;
262262
temp = w_ring[nk - 1];
@@ -275,7 +275,7 @@ static void get_aes_decrypt_key(unsigned char *dec_key,
275275
}
276276
i--;
277277
for (k = 0, j = i % nk; k < nk; k++) {
278-
*((u32 *)dec_key + k) = htonl(w_ring[j]);
278+
put_unaligned_be32(w_ring[j], &dec_key[k * 4]);
279279
j--;
280280
if (j < 0)
281281
j += nk;
@@ -1464,6 +1464,7 @@ static int chcr_device_init(struct chcr_context *ctx)
14641464
if (!ctx->dev) {
14651465
u_ctx = assign_chcr_device();
14661466
if (!u_ctx) {
1467+
err = -ENXIO;
14671468
pr_err("chcr device assignment fails\n");
14681469
goto out;
14691470
}
@@ -2926,8 +2927,7 @@ static int ccm_format_packet(struct aead_request *req,
29262927
memcpy(ivptr, req->iv, 16);
29272928
}
29282929
if (assoclen)
2929-
*((unsigned short *)(reqctx->scratch_pad + 16)) =
2930-
htons(assoclen);
2930+
put_unaligned_be16(assoclen, &reqctx->scratch_pad[16]);
29312931

29322932
rc = generate_b0(req, ivptr, op_type);
29332933
/* zero the ctr value */
@@ -3201,8 +3201,7 @@ static struct sk_buff *create_gcm_wr(struct aead_request *req,
32013201
} else {
32023202
memcpy(ivptr, req->iv, GCM_AES_IV_SIZE);
32033203
}
3204-
*((unsigned int *)(ivptr + 12)) = htonl(0x01);
3205-
3204+
put_unaligned_be32(0x01, &ivptr[12]);
32063205
ulptx = (struct ulptx_sgl *)(ivptr + 16);
32073206

32083207
chcr_add_aead_dst_ent(req, phys_cpl, qid);

drivers/crypto/chelsio/chcr_ipsec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ inline void *copy_esn_pktxt(struct sk_buff *skb,
403403
xo = xfrm_offload(skb);
404404

405405
aadiv->spi = (esphdr->spi);
406-
seqlo = htonl(esphdr->seq_no);
406+
seqlo = ntohl(esphdr->seq_no);
407407
seqno = cpu_to_be64(seqlo + ((u64)xo->seq.hi << 32));
408408
memcpy(aadiv->seq_no, &seqno, 8);
409409
iv = skb_transport_header(skb) + sizeof(struct ip_esp_hdr);

0 commit comments

Comments
 (0)