Skip to contentSkip to conversation

crypto:chelsio count incomplete block in IV

PATCH In review Atul Gupta 1 participant 1 message May 2, 2019

Subsystems (2)
lore
Share & tools
lore

Atul Gupta

author
#0 lore raw

PATCH 3/4 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.

---
 drivers/crypto/chelsio/chcr_algo.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/crypto/chelsio/chcr_algo.c +2 -2
index 73bbd49..177f572 100644
@@ -1094,8 +1094,8 @@ static int chcr_final_cipher_iv(struct ablkcipher_request *req,
 	int ret = 0;
 
 	if (subtype == CRYPTO_ALG_SUB_TYPE_CTR)
-		ctr_add_iv(iv, req->info, (reqctx->processed /
-			   AES_BLOCK_SIZE));
+		ctr_add_iv(iv, req->info, DIV_ROUND_UP(reqctx->processed,
+						       AES_BLOCK_SIZE));
 	else if (subtype == CRYPTO_ALG_SUB_TYPE_XTS)
 		ret = chcr_update_tweak(req, iv, 1);
 	else if (subtype == CRYPTO_ALG_SUB_TYPE_CBC) {
Signature · 1 line
1.8.3.1