From patchwork Sun Feb 7 14:39:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 378117 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp3954130jah; Sun, 7 Feb 2021 06:42:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJxziPXsVPmoF6wy8fsJ/BMjeNh+uV1zVrDxgISnNDHGOLBAtZ2BP4XFi8OTCAt45tq7faeM X-Received: by 2002:a05:6402:34c3:: with SMTP id w3mr13210850edc.3.1612708945832; Sun, 07 Feb 2021 06:42:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612708945; cv=none; d=google.com; s=arc-20160816; b=G6VrwnIbrTl8NLsGfswRcLQyeO4cCX6a1wWGZ6CsmN2NAjuVspg5kSXrLmDsrLWA/c K7fkpO2D9PP3nSPAWHOIwg5FmBHx7UeMdS3fbtLhIUPKMoGmhYE8HetE8LhVgBl/+CWv qMLoVUUEVroq79l0d1BOW1kPTOnKoUGIQ/KSfQ7nxRMkZU9wzFtRLsfuTAY9iqeR0T3S cfPJhuhPRFAMFeTXQzDXvuOzBBCaTg5xz6QMdnxTSrZDwTdLSH8E4RbPzzghcPwnvdb5 vwte/xt+RNXi6AKViSl8Gdjm/8KVezz51nk/rMpJr4IOVg7AuigmGXrpU6vWm4O3On+M A99w== 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=S634bOI/l2hQTpgSJr3nVqoDwyDnHV1Gw6IbuFUoXuA=; b=mArcAPhJ4aS0LA2R+rbXMoagRGtVR1bnhmAbeuiydZXaO3LmBJf6M8ynyLVHr/KTZj 1c2sY0FlnzRAH76iyiIh/VHfbOz3cwmWGZ1OiO5Yh9QAnBo89gr6jpJKmc2uJc48mMfu UsOF7OHKV1DOCQ2cZefZ0xalInm6EPJRPytw6nCCD1NqwhN2RQH2ofQKuKmQAr/QfjqS WAv407WwK9JLrhKpblK/HaIqXJrl1R/R//uyGMzQVZ51cNG5Wkhp8PBu8SKA0uuKKXxg kG1OBEOn1/yl2OhdWhiZ/+xKyE1AJodruPqznlk8lKjPNC47khDLYOwUIlteWGpGKq4p YqiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EEeoLHA9; 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 g26si9550734edy.55.2021.02.07.06.42.25; Sun, 07 Feb 2021 06:42:25 -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=EEeoLHA9; 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 S229996AbhBGOmU (ORCPT + 2 others); Sun, 7 Feb 2021 09:42:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229999AbhBGOla (ORCPT ); Sun, 7 Feb 2021 09:41:30 -0500 Received: from mail-qk1-x734.google.com (mail-qk1-x734.google.com [IPv6:2607:f8b0:4864:20::734]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C56B7C061225 for ; Sun, 7 Feb 2021 06:39:58 -0800 (PST) Received: by mail-qk1-x734.google.com with SMTP id a19so11981910qka.2 for ; Sun, 07 Feb 2021 06:39:58 -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=S634bOI/l2hQTpgSJr3nVqoDwyDnHV1Gw6IbuFUoXuA=; b=EEeoLHA9p2j7vGSuG5F6ZMbLX6ECOyCXPLqBP18J1BbcKXAQZslEq0a/S0MfRmOJtn UySXexTVD2tdCjiyJztu+2cOw28gOa+eP7OvFqgtkDnDBFAWHyCE4ivLYEzGiKRaPhz9 q9PGLP0fi0jJfU5FtvMRpyNjzoj26Ae/Zau0UwQAmF0F7N7d5+PgJ2ZU3691JQsFk4Xh 8p5tHrRMIfUNvIHZvPtQKu1iaXnfllBTFstFvq7II7BT3/lUNxYnqbObie0vmXMNo5z9 VRYoSFaytaOb5p7fjDbR3rx7Zuq7CFqVhFVPfnXiF82WCRVol68BKF8+RVigODJTeCqq 8zBQ== 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=S634bOI/l2hQTpgSJr3nVqoDwyDnHV1Gw6IbuFUoXuA=; b=UwiuJsZLTV582foPQZwM+EwSuoS1CjXs36eNt2RWmmayXEMS79vJ1sh8AQxPggk5/H 71l6fWlPMYTG1WAQToS41zHziFzPHEK3mcQhq68eZ6ifbTd+c2lcvu2Hfwt7qReHqjED We/nNinLFmrQJ3S6S6ySkE+8WpondJbq+hq5/bgFvgIdy7AXH53k2F8yrpRdMLbOzSrc WpOALb3nsGw7OpwFHNQigr1nBrWgux2ASIJLepNdXABjJx+2+JusXi8+c6b+nNWovp3s iqs7EJw3u3DzKtGw4gXXwLeSSQhna1MO5sZ7ZlHpjcG6oHum6n9PQ5vSchskrfGAAU2V oPqQ== X-Gm-Message-State: AOAM532/Ldpau8a+Tx7kjCjGOlIkYI+iN5C8g+3ZhqhlCvPUzUstBj8w WJUhmSt9awbjAtMgd72/CjpuCQ== X-Received: by 2002:a37:aa4e:: with SMTP id t75mr12500918qke.343.1612708798033; Sun, 07 Feb 2021 06:39:58 -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 c81sm13941493qkb.88.2021.02.07.06.39.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Feb 2021 06:39:57 -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 v6 11/11] crypto: qce: Remove totallen and offset in qce_start Date: Sun, 7 Feb 2021 09:39:46 -0500 Message-Id: <20210207143946.2099859-12-thara.gopinath@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210207143946.2099859-1-thara.gopinath@linaro.org> References: <20210207143946.2099859-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 66a226d1205e..9fec5bdc29ec 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;