Skip to content

Commit 0a4491d

Browse files
chelsiocryptoherbertx
authored andcommitted
crypto: chelsio - count incomplete block in IV
The partial block should count as one and appropriately appended to IV. eg 499B for AES CTR should count 32 block than 31 and correct count value is updated in iv out. Signed-off-by: Atul Gupta <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 33ddc10 commit 0a4491d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/crypto/chelsio/chcr_algo.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,8 +1094,8 @@ static int chcr_final_cipher_iv(struct ablkcipher_request *req,
10941094
int ret = 0;
10951095

10961096
if (subtype == CRYPTO_ALG_SUB_TYPE_CTR)
1097-
ctr_add_iv(iv, req->info, (reqctx->processed /
1098-
AES_BLOCK_SIZE));
1097+
ctr_add_iv(iv, req->info, DIV_ROUND_UP(reqctx->processed,
1098+
AES_BLOCK_SIZE));
10991099
else if (subtype == CRYPTO_ALG_SUB_TYPE_XTS)
11001100
ret = chcr_update_tweak(req, iv, 1);
11011101
else if (subtype == CRYPTO_ALG_SUB_TYPE_CBC) {

0 commit comments

Comments
 (0)