From patchwork Thu Feb 4 21:43:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 376340 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1655759jah; Thu, 4 Feb 2021 13:46:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJwGEXtiHSfQQRBjJdWIeERmIwHfcnsQbnZ3GA0UEJX8G+2AkIvtIhQ9cfn1VnmrofU7J7wX X-Received: by 2002:a50:9310:: with SMTP id m16mr628228eda.94.1612475205405; Thu, 04 Feb 2021 13:46:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612475205; cv=none; d=google.com; s=arc-20160816; b=LYQ3l6rugZUiMZqD6oyaeXS2HUP28WhcY0EMtPK9jGFOoVTsp+kpVVtEOOEsAkkqZE BZUIsFwUMgaU81vWpY+umQWTa7H9SVAMCo1dYd6HkGe5EA9cUSbRD/OVunYO5b/LIhvC +0WkJ7+62w+P1gkxYJ72of+017ywtUwH5bQrHeySl4IbTYWhCw5gvsIKjMgA3eERzsEY qka2xY9HEd3R/yYoOFkr6CDBbtyS1kVYBHHXwWTZQIKxR1PcixeQL9scN0tvHWJuRPLF hIygRpUQ1cYa3K2j5zuaqtc/5tQWpcsf72UZRa3UX6sd88GQrbg0/5TkGrt4r6WQw/6V MJpA== 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=g2H2M2trN7O+hF5UdQLkbd5BwU/Kqg0aOCrMAr9yvMA=; b=U0K09AQiC+CQ4dVbfRthotXiw6yKLt5C0WKxxG7scnXFUOe+uqJgHC7GJnkpxFRVFC am7YmZ1HtZResgXPyCdcFMC7m8tO8jb+1Kthcub+c8GcasCunEa41PttVShufv3vKZbD BDg38Z1lIHrJLaeSjWY4Ni6eKGZkMROyF9HfpAPbsMs8aoBXgaZZa61LQBzGOsuHeV5u RGcZBh6qVQKKIlhdf7JdKJ5HaFOCMMTy+NFQZiUoRWH6YVfHj83hJ3/MyQT3dBxq1sQv mz9qUXWpylnVuKsK7P0pABYY2L7OcZRLELhjzQiLJLbiemvuxfew6yG/Z7St2X4qNMCS tzMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DN1fAENQ; 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 j4si3983455ejv.17.2021.02.04.13.46.44; Thu, 04 Feb 2021 13:46:45 -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=DN1fAENQ; 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 S230185AbhBDVp7 (ORCPT + 2 others); Thu, 4 Feb 2021 16:45:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230138AbhBDVps (ORCPT ); Thu, 4 Feb 2021 16:45:48 -0500 Received: from mail-qv1-xf2f.google.com (mail-qv1-xf2f.google.com [IPv6:2607:f8b0:4864:20::f2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9D18C061225 for ; Thu, 4 Feb 2021 13:44:11 -0800 (PST) Received: by mail-qv1-xf2f.google.com with SMTP id u16so2492787qvo.9 for ; Thu, 04 Feb 2021 13:44:11 -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=g2H2M2trN7O+hF5UdQLkbd5BwU/Kqg0aOCrMAr9yvMA=; b=DN1fAENQ8vD0G2gYQS+QnNBHTavkKklxLYVg8KfChPMydJuoC/EU+7T+uzg0AzhAm2 ESwVP9BcORzDD35xWtHGz7RlnRi7Ti3XWwNJb2wwt2doLQSfGxSS/DYFHmPyif0kYBtb jQcQlXXRfgMPl26LS2sMhZP/bKdHbutn8vFa5nzb4JM7XG4NUt9KCNiv0qfGMhSeVR3/ C7jmxrZg8i3gfV0mtuHAYvnSVLOq1OJxwUWJ8Jr3hxDDXC19Ni9RI9igQcuzlPk3NvCJ atcfoD+0+30M71J6FdUiVe6VF+a8Ye5JBya/o2j7oAzxCDswl2hhz/e122geO78QoXXK Y4jA== 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=g2H2M2trN7O+hF5UdQLkbd5BwU/Kqg0aOCrMAr9yvMA=; b=SM6OzGvjdfxeTLTmZhNBdBUJ0G6WgWtiGsWi5twaN81fR9zLTnKKvdSJzkFRYqoDFV VhGjXlQrEiDgoCEYab55QEmNSXMXbFzqX6BgydB/mTXuGZ/9G7aPuxUne21VYbpmN4ya XR5Pe12cLwGyxlJU0UV6bF4YicihdrDZb7yErXv4BRx1Lb8zJwu1U729MIWs4ymflEtM gbf3gnJfjp+Gu4BhkUOkLyLorcT3cjeg8Zq3+R++eCsTTWA8QY71HRh8y3/A0ZMHuxTs W78hRFXErmOAw7HHppo3KKGaCP6uvb9/Ga2zI8TUUnKBDb1GQ54VzkGVUQv4t8ijvlF4 JLHQ== X-Gm-Message-State: AOAM533TbYkoHGAd6YyuHjgVJYCVKlYi5vg5h42U4T2l9RGcd66yOpyu +1ZeI9oPNGRWoXXc+IO8QzzdxQ== X-Received: by 2002:ad4:58f1:: with SMTP id di17mr1336680qvb.57.1612475051044; Thu, 04 Feb 2021 13:44:11 -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 h185sm6353858qkd.122.2021.02.04.13.44.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Feb 2021 13:44:10 -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 v5 11/11] crypto: qce: Remove totallen and offset in qce_start Date: Thu, 4 Feb 2021 16:43:59 -0500 Message-Id: <20210204214359.1993065-12-thara.gopinath@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210204214359.1993065-1-thara.gopinath@linaro.org> References: <20210204214359.1993065-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 8599250946b7..3fc0b263d498 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;