diff options
author | Ayush Sawal <ayush.sawal@chelsio.com> | 2020-06-01 23:11:58 +0530 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-06-01 15:50:26 -0700 |
commit | f3b140ad8575b74c78be50f34079e1cf43b0302d (patch) | |
tree | 98bc6176fab4399996d86f6b17d06b1b288b7ccb /drivers/crypto/chelsio/chcr_ipsec.c | |
parent | 76d7728db724466490c2c3dd4f84c3357f550615 (diff) |
Crypto/chcr: Fixes compilations warnings
This patch fixes the compilation warnings displayed by sparse tool for
chcr driver.
V1->V2
Avoid type casting by using get_unaligned_be32() and
put_unaligned_be16/32() functions.
The key which comes from stack is an u8 byte stream so we store it in
an unsigned char array(ablkctx->key). The function get_aes_decrypt_key()
is a used to calculate the reverse round key for decryption, for this
operation the key has to be divided into 4 bytes, so to extract 4 bytes
from an u8 byte stream and store it in an u32 variable, get_aligned_be32()
is used. Similarly for copying back the key from u32 variable to the
original u8 key stream, put_aligned_be32() is used.
Signed-off-by: Ayush Sawal <ayush.sawal@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/crypto/chelsio/chcr_ipsec.c')
-rw-r--r-- | drivers/crypto/chelsio/chcr_ipsec.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/crypto/chelsio/chcr_ipsec.c b/drivers/crypto/chelsio/chcr_ipsec.c index d25689837b26..3a10f51ad6fd 100644 --- a/drivers/crypto/chelsio/chcr_ipsec.c +++ b/drivers/crypto/chelsio/chcr_ipsec.c @@ -403,7 +403,7 @@ inline void *copy_esn_pktxt(struct sk_buff *skb, xo = xfrm_offload(skb); aadiv->spi = (esphdr->spi); - seqlo = htonl(esphdr->seq_no); + seqlo = ntohl(esphdr->seq_no); seqno = cpu_to_be64(seqlo + ((u64)xo->seq.hi << 32)); memcpy(aadiv->seq_no, &seqno, 8); iv = skb_transport_header(skb) + sizeof(struct ip_esp_hdr); |