From patchwork Thu Feb 11 20:01:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 381039 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp2375214jah; Thu, 11 Feb 2021 12:06:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJzm+GR/sMaOxt1woML8HdLrmPfMdH1l7oHatA5FEp/hDTxWzXGdY/uVEZHahwItqWNvnJ2Q X-Received: by 2002:a17:906:2747:: with SMTP id a7mr10372347ejd.250.1613073983169; Thu, 11 Feb 2021 12:06:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613073983; cv=none; d=google.com; s=arc-20160816; b=rXB1rg3gQNM2vmm0mgM64u3BKpG4A1sMeoCbXkdYn7ikmvknCw9btm6gLXqNRlXaLx xJjpjAYiR2zj4iUCp53hHnxuEUdp4uoLg43kvhVbB1MxrEYz+oZl8tamtHZthV4a14lY sA/9+1u5ZH5sFNmjAhq9OJ+HqhE6S8LCtlKDIBMypB55fMAi+2p36FbWMMFy0t8/m5H/ dipih6KckPisLvJM0zeUdw+In7DZQ4kSfc9n4ZsbIqb73LgZOS+4Vg2YdGVM7L8Xqc8b MudrcxUcT04wt5EwMgwhjLRnGBNCS/J6tMz+KKzcCUxAcVbtxfsZ3Gj2LVsIM0tlrSbv UCzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=yUg8PjWDYd61mmuXP9fMk4GBLqx+aixrVP+sxaFHojE=; b=YeHnvvbMwy0iPS5H9bv9F3A2lRkTY1h+z6ddFtOhZ4YDG8of6zBKeJxU0tvTpz6Hqe ILrgY8X2bXszW5KyyyUDrgcJT/JljOoG6HTX+b2g4TPzOVsEx3dOtiQIr+AaLaX86HIo q8gx+sTAOl9eniCKFBdwm+N/AdYJog+QrgBUzTg1mD1WnEcFsF4ti3XJrmqFmqJ65s3k Y3h52eZQTmm2pN6fkjvra+1Gtq7vX7/ycnzjNuT5Oa0C8er4Xsr5iqNPBWmGAYMSMXK7 OZiqBnlU+stX0KMFTVBBjbQE/XxxDGirwwaO5jEWn+IrEvu0j9czlWEsLsAgH5UKf7Ax j7lQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H+iuusQ2; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hy24si4520322ejc.149.2021.02.11.12.06.23; Thu, 11 Feb 2021 12:06:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H+iuusQ2; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231561AbhBKUGF (ORCPT + 2 others); Thu, 11 Feb 2021 15:06:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231209AbhBKUDt (ORCPT ); Thu, 11 Feb 2021 15:03:49 -0500 Received: from mail-qt1-x82b.google.com (mail-qt1-x82b.google.com [IPv6:2607:f8b0:4864:20::82b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00D3FC061223 for ; Thu, 11 Feb 2021 12:01:41 -0800 (PST) Received: by mail-qt1-x82b.google.com with SMTP id w20so5121986qta.0 for ; Thu, 11 Feb 2021 12:01:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yUg8PjWDYd61mmuXP9fMk4GBLqx+aixrVP+sxaFHojE=; b=H+iuusQ2wjFpZVfkabh0ima5dHCfVyuBGimWWiag35rG40BUAOpRl8HGilt0sfR6FF TluNCdAM6w+JsuDVOhPgm77s9xXntGbFJ8vJx7saC6HvffOqkDlLCLBblFXAmW5COVx2 dgS8ILn2PTfM3FlLOXiOEppRTHBStvvg5CT9aqeiPL7Wx3UOA2+7r4WQuRDGlYVaWISb ECnw3zJiVTFrsoJeNPVlB9loHg0hJ8y/xWqKb+TxgsonFK+oJQ1qQPSNl2TadLSscHbh axjHqA66zGP8Hjj5Nl1g9ftka8vbn0bmqOGOm74LZxX6tj/VLcPVz/UJ58vToiBAxMLf v6pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yUg8PjWDYd61mmuXP9fMk4GBLqx+aixrVP+sxaFHojE=; b=uVLzguPL6mc5GlP13yXedqbwm3bFM5+xcZU9feVXg3xS0uSO2wKgtkQRw2IxkWOD7i bxmaJaU6K5X7xgak2vKbZag9y1CFq9Obbwpih5ZlL2XADcfl1yZRcpHYulJ0A1AJ3ZPG xZTQ9EBBWen1JgrD7xLA/ehrxjyIzlfd1c0sSmK/Q4uK4yb1B3icYC+dFSQ+Kvpurfz/ knmb/UerhrOcNCrgGcg7qD8m6f6JEgradGvg8CWZWQDgTnUvfzODuO1E/6ln4ksP0lVe EwwsuPSiBdrVqGuyR9GcMUtrrMOIToEIK/RwHyIDVXz3b5y5uznv5prnst/2Pu5b9rPg lpjA== X-Gm-Message-State: AOAM530oHAuHF1QLh3w/St40g+Ggtw1LPqLS6Ho7rnW+sEabsNaOI5cq 8KMpXsb+pj15buiBHVCFIBpR+HX+zE+jqA== X-Received: by 2002:ac8:4cc8:: with SMTP id l8mr9071981qtv.284.1613073700051; Thu, 11 Feb 2021 12:01:40 -0800 (PST) Received: from pop-os.fios-router.home (pool-71-163-245-5.washdc.fios.verizon.net. [71.163.245.5]) by smtp.googlemail.com with ESMTPSA id 17sm4496243qtu.23.2021.02.11.12.01.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Feb 2021 12:01:39 -0800 (PST) From: Thara Gopinath To: herbert@gondor.apana.org.au, davem@davemloft.net, bjorn.andersson@linaro.org Cc: ebiggers@google.com, ardb@kernel.org, sivaprak@codeaurora.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 11/11] crypto: qce: Remove totallen and offset in qce_start Date: Thu, 11 Feb 2021 15:01:28 -0500 Message-Id: <20210211200128.2886388-12-thara.gopinath@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210211200128.2886388-1-thara.gopinath@linaro.org> References: <20210211200128.2886388-1-thara.gopinath@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org totallen is used to get the size of the data to be transformed. This is also available via nbytes or cryptlen in the qce_sha_reqctx and qce_cipher_ctx. Similarly offset convey nothing for the supported encryption and authentication transformations and is always 0. Remove these two redundant parameters in qce_start. Reviewed-by: Bjorn Andersson Signed-off-by: Thara Gopinath --- drivers/crypto/qce/common.c | 17 +++++++---------- drivers/crypto/qce/common.h | 3 +-- drivers/crypto/qce/sha.c | 2 +- drivers/crypto/qce/skcipher.c | 2 +- 4 files changed, 10 insertions(+), 14 deletions(-) -- 2.25.1 diff --git a/drivers/crypto/qce/common.c b/drivers/crypto/qce/common.c index f7bc701a4aa2..dceb9579d87a 100644 --- a/drivers/crypto/qce/common.c +++ b/drivers/crypto/qce/common.c @@ -140,8 +140,7 @@ static u32 qce_auth_cfg(unsigned long flags, u32 key_size) return cfg; } -static int qce_setup_regs_ahash(struct crypto_async_request *async_req, - u32 totallen, u32 offset) +static int qce_setup_regs_ahash(struct crypto_async_request *async_req) { struct ahash_request *req = ahash_request_cast(async_req); struct crypto_ahash *ahash = __crypto_ahash_cast(async_req->tfm); @@ -306,8 +305,7 @@ static void qce_xtskey(struct qce_device *qce, const u8 *enckey, qce_write(qce, REG_ENCR_XTS_DU_SIZE, cryptlen); } -static int qce_setup_regs_skcipher(struct crypto_async_request *async_req, - u32 totallen, u32 offset) +static int qce_setup_regs_skcipher(struct crypto_async_request *async_req) { struct skcipher_request *req = skcipher_request_cast(async_req); struct qce_cipher_reqctx *rctx = skcipher_request_ctx(req); @@ -367,7 +365,7 @@ static int qce_setup_regs_skcipher(struct crypto_async_request *async_req, qce_write(qce, REG_ENCR_SEG_CFG, encr_cfg); qce_write(qce, REG_ENCR_SEG_SIZE, rctx->cryptlen); - qce_write(qce, REG_ENCR_SEG_START, offset & 0xffff); + qce_write(qce, REG_ENCR_SEG_START, 0); if (IS_CTR(flags)) { qce_write(qce, REG_CNTR_MASK, ~0); @@ -376,7 +374,7 @@ static int qce_setup_regs_skcipher(struct crypto_async_request *async_req, qce_write(qce, REG_CNTR_MASK2, ~0); } - qce_write(qce, REG_SEG_SIZE, totallen); + qce_write(qce, REG_SEG_SIZE, rctx->cryptlen); /* get little endianness */ config = qce_config_reg(qce, 1); @@ -388,17 +386,16 @@ static int qce_setup_regs_skcipher(struct crypto_async_request *async_req, } #endif -int qce_start(struct crypto_async_request *async_req, u32 type, u32 totallen, - u32 offset) +int qce_start(struct crypto_async_request *async_req, u32 type) { switch (type) { #ifdef CONFIG_CRYPTO_DEV_QCE_SKCIPHER case CRYPTO_ALG_TYPE_SKCIPHER: - return qce_setup_regs_skcipher(async_req, totallen, offset); + return qce_setup_regs_skcipher(async_req); #endif #ifdef CONFIG_CRYPTO_DEV_QCE_SHA case CRYPTO_ALG_TYPE_AHASH: - return qce_setup_regs_ahash(async_req, totallen, offset); + return qce_setup_regs_ahash(async_req); #endif default: return -EINVAL; diff --git a/drivers/crypto/qce/common.h b/drivers/crypto/qce/common.h index 85ba16418a04..3bc244bcca2d 100644 --- a/drivers/crypto/qce/common.h +++ b/drivers/crypto/qce/common.h @@ -94,7 +94,6 @@ struct qce_alg_template { void qce_cpu_to_be32p_array(__be32 *dst, const u8 *src, unsigned int len); int qce_check_status(struct qce_device *qce, u32 *status); void qce_get_version(struct qce_device *qce, u32 *major, u32 *minor, u32 *step); -int qce_start(struct crypto_async_request *async_req, u32 type, u32 totallen, - u32 offset); +int qce_start(struct crypto_async_request *async_req, u32 type); #endif /* _COMMON_H_ */ diff --git a/drivers/crypto/qce/sha.c b/drivers/crypto/qce/sha.c index 2813c9a27a6e..8e6fcf2c21cc 100644 --- a/drivers/crypto/qce/sha.c +++ b/drivers/crypto/qce/sha.c @@ -113,7 +113,7 @@ static int qce_ahash_async_req_handle(struct crypto_async_request *async_req) qce_dma_issue_pending(&qce->dma); - ret = qce_start(async_req, tmpl->crypto_alg_type, 0, 0); + ret = qce_start(async_req, tmpl->crypto_alg_type); if (ret) goto error_terminate; diff --git a/drivers/crypto/qce/skcipher.c b/drivers/crypto/qce/skcipher.c index 2e6ab1d33a31..c0a0d8c4fce1 100644 --- a/drivers/crypto/qce/skcipher.c +++ b/drivers/crypto/qce/skcipher.c @@ -144,7 +144,7 @@ qce_skcipher_async_req_handle(struct crypto_async_request *async_req) qce_dma_issue_pending(&qce->dma); - ret = qce_start(async_req, tmpl->crypto_alg_type, req->cryptlen, 0); + ret = qce_start(async_req, tmpl->crypto_alg_type); if (ret) goto error_terminate;