Crypto/chcr: fix gcm-aes and rfc4106-gcm failed tests
authorDevulapally Shiva Krishna <shiva@chelsio.com>
Tue, 5 May 2020 03:12:53 +0000 (08:42 +0530)
committerDavid S. Miller <davem@davemloft.net>
Thu, 7 May 2020 00:44:11 +0000 (17:44 -0700)
commitd91a3159e8d9a1bf58c2aaad1ef10a09bc91350c
tree0347a03d3b041a845f7042dadb995f10fc19ed96
parent33395f4a5c1b68a4eaa49af62ff3bbed71d98598
Crypto/chcr: fix gcm-aes and rfc4106-gcm failed tests

This patch fixes two issues observed during self tests with
CONFIG_CRYPTO_MANAGER_EXTRA_TESTS enabled.

1. gcm(aes) hang issue , that happens during decryption.
2. rfc4106-gcm-aes-chcr encryption unexpectedly succeeded.

For gcm-aes decryption , authtag is not mapped due to
sg_nents_for_len(upto size: assoclen+ cryptlen - authsize).
So fix it by dma_mapping authtag.
Also replaced sg_nents() to sg_nents_for_len() in case of aead_dma_unmap().

For rfc4106-gcm-aes-chcr, used crypto_ipsec_check_assoclen() for checking
the validity of assoclen.

Signed-off-by: Ayush Sawal <ayush.sawal@chelsio.com>
Signed-off-by: Devulapally Shiva Krishna <shiva@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/crypto/chelsio/chcr_algo.c