Devulapally Shiva Krishna 6b363a286c Crypto/chcr: fix ctr, cbc, xts and rfc3686-ctr failed tests
This solves the following issues observed during self test when
CONFIG_CRYPTO_MANAGER_EXTRA_TESTS is enabled.

1. Added fallback for cbc, ctr and rfc3686 if req->nbytes is zero
and for xts added a fallback case if req->nbytes is not multiple of 16.

2. In case of cbc-aes, solved wrong iv update. When
chcr_cipher_fallback() is called, used req->info pointer instead of
reqctx->iv.

3. In cbc-aes decryption there was a wrong result. This occurs when
chcr_cipher_fallback() is called from chcr_handle_cipher_resp().
In the fallback function iv(req->info) used is wrongly updated.
So use the initial iv for this case.

4)In case of ctr-aes encryption observed wrong result. In adjust_ctr_overflow()
there is condition which checks if ((bytes / AES_BLOCK_SIZE) > c),
where c is the number of blocks which can be processed without iv overflow,
but for the above bytes (req->nbytes < 32 , not a multiple of 16) this
condition fails and the 2nd block is corrupted as it requires the rollover iv.
So added a '=' condition in this to take care of this.

5)In rfc3686-ctr there was wrong result observed. This occurs when
chcr_cipher_fallback() is called from chcr_handle_cipher_resp().
Here also copying initial_iv in init_iv pointer for handling the fallback
case correctly.

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>
2020-05-06 17:44:11 -07:00
..
2020-04-24 21:03:57 +02:00
2020-03-23 07:59:38 +01:00
2020-04-24 12:44:19 -07:00
2020-04-03 15:05:35 -07:00
2020-04-10 11:32:22 +02:00
2020-04-23 09:36:40 -07:00
2020-04-24 10:20:08 -07:00
2020-04-14 11:58:04 -07:00
2020-04-04 18:07:59 -07:00
2020-04-08 21:25:49 -07:00
2020-03-20 13:45:25 +01:00
2020-04-16 13:52:31 -07:00
2020-03-30 11:43:51 -07:00
2020-03-19 23:04:32 -05:00
2020-04-08 21:03:40 -07:00
2020-04-26 09:43:05 -07:00
2020-04-03 15:05:35 -07:00
2020-04-20 10:19:22 -04:00
2020-03-31 16:13:09 -07:00
2020-04-03 14:25:02 -07:00
2020-04-08 21:03:40 -07:00
2020-04-10 10:06:54 -07:00
2020-03-31 10:05:01 -07:00
2020-04-03 14:25:02 -07:00
2020-03-30 14:58:26 -07:00
2020-04-23 09:28:15 -07:00
2020-04-17 06:05:29 -04:00
2020-04-07 19:48:52 -07:00
2020-04-21 14:21:20 +02:00
2020-04-02 15:50:04 -07:00
2020-04-03 15:05:35 -07:00
2020-03-23 08:04:08 +01:00
2020-04-05 11:12:59 -07:00
2020-04-02 17:03:53 -07:00
2020-04-20 10:19:22 -04:00
2020-04-20 10:19:22 -04:00
2020-04-07 20:24:34 -07:00
2020-03-19 07:41:03 +01:00
2020-04-17 10:35:17 -07:00
2020-04-03 13:12:26 -07:00
2020-04-08 10:51:53 -07:00
2020-04-08 10:51:53 -07:00