Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp7071335yba; Thu, 2 May 2019 03:48:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqxjFgMZpJVvzABVi1AP3l90i4YhAoclyb+80s6elYwixCiNG9KAWqOYZXpiD+LS56GiMsP4 X-Received: by 2002:a17:902:294b:: with SMTP id g69mr2986985plb.57.1556794105723; Thu, 02 May 2019 03:48:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556794105; cv=none; d=google.com; s=arc-20160816; b=X7WO3dEAi20ryrmtJWyGUHAeJACpmtDTrg9jqwxJGC94rP2gSfmwQU4+2eziBdi3UB wb1tx0ihAKid8y5tZVcx8/++HT/v0xG83bBTi5PcmF/FLw3cPvPH3JGUNb6Rgjj0DaFB HDHxsu6I/Sr60fLwkg4oL+/Ck+ekiOEeTGQegDKR5pSO8ASUQ8HAl1U67UCR6vvAkScp sHpwuhP+Hwh5qqcjpAXNuctdrpeA72yMy4gCQQjJ8y2Jx29vJtosesV3/WN8NjaVrhPD VOg5VJoOpdxOdo55wzR8N5DvqCmCkAv4dxqY+24TE2fgn909O6WGC1CiLDJx8JK5jmD5 sNzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=/xEOiGTfAYq09lxrL1xXTF0Dzk85wm7W85giSWM3t5k=; b=Z216i1lI0uNmn2eYpsOgkGj9b50rsLvqqJGGGrl2AP6CDgrrwalpIKMd49IsMDA/ID iKUU+uWopXeKZV6efY405wiHLB+OAJbNlRGBpqiak4KhwrdGTRd77wOCaXV2/beQh94r LqeWaMvDOOMGSBzqxswbEpBgjGuRlWZH3I4ctezBQgQvJPJUpihI1dLk9rvb8zoutreM X5qKNfbSkv/EhgdfpHi8SonAOlk44HaXR8QcWfnSE9jw2VmTkWck8OrJyCYG1psyYVRG THqFDteDcAcdKs7HgP4CrxiAxpDmE3mdBdjV6fhKYjI6ochFyc6KRkpoW1/WJCmqbOGu XikQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w12si6617427pgh.531.2019.05.02.03.48.10; Thu, 02 May 2019 03:48:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726283AbfEBKsD (ORCPT + 99 others); Thu, 2 May 2019 06:48:03 -0400 Received: from stargate.chelsio.com ([12.32.117.8]:32869 "EHLO stargate.chelsio.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726231AbfEBKsD (ORCPT ); Thu, 2 May 2019 06:48:03 -0400 Received: from beagle7.asicdesigners.com (beagle7.asicdesigners.com [10.192.192.157]) by stargate.chelsio.com (8.13.8/8.13.8) with ESMTP id x42AlxuD028174; Thu, 2 May 2019 03:47:59 -0700 From: Atul Gupta To: herbert@gondor.apana.org.au Cc: linux-crypto@vger.kernel.org, davem@davemloft.net, dt@chelsio.com, atul.gupta@chelsio.com Subject: [PATCH 3/4] crypto:chelsio count incomplete block in IV Date: Thu, 2 May 2019 03:47:57 -0700 Message-Id: <20190502104757.22234-1-atul.gupta@chelsio.com> X-Mailer: git-send-email 2.20.0.rc2.7.g965798d MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org 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 --- drivers/crypto/chelsio/chcr_algo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/chelsio/chcr_algo.c b/drivers/crypto/chelsio/chcr_algo.c index 73bbd49..177f572 100644 --- a/drivers/crypto/chelsio/chcr_algo.c +++ b/drivers/crypto/chelsio/chcr_algo.c @@ -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) { -- 1.8.3.1