Crypto/chcr: fix for hmac(sha) test fails
authorDevulapally Shiva Krishna <shiva@chelsio.com>
Tue, 5 May 2020 03:12:57 +0000 (08:42 +0530)
committerDavid S. Miller <davem@davemloft.net>
Thu, 7 May 2020 00:44:11 +0000 (17:44 -0700)
The hmac(sha) test fails for a zero length source text data.
For hmac(sha) minimum length of the data must be of block-size.
So fix this by including the data_len for the last block.

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

index 0d25af4..b8c1c4d 100644 (file)
@@ -2005,7 +2005,7 @@ static int chcr_ahash_digest(struct ahash_request *req)
        req_ctx->data_len += params.bfr_len + params.sg_len;
 
        if (req->nbytes == 0) {
-               create_last_hash_block(req_ctx->reqbfr, bs, 0);
+               create_last_hash_block(req_ctx->reqbfr, bs, req_ctx->data_len);
                params.more = 1;
                params.bfr_len = bs;
        }