Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp599213rda; Sun, 22 Oct 2023 01:19:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHG6jvi/rOt/GK5+RNpyZprlNRcR+eEZoRDHK2V12YqmKOEt1eab7/OpPagQVO7GCa6ejk4 X-Received: by 2002:a05:6358:60cc:b0:135:acfd:8786 with SMTP id i12-20020a05635860cc00b00135acfd8786mr7460123rwi.3.1697962762355; Sun, 22 Oct 2023 01:19:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697962762; cv=none; d=google.com; s=arc-20160816; b=zYzVkMUYUd3ge3UT0PO7kZdB9PXnJhQBEdTsNORwG2DgABkfKEpShhpc/P9vbLzmeN w59c+E5VqRkmsB82K1rnr5cJbNbJCX/j7ZQM0jrOLc4wvxacDH3nKe8PlwnQ4r6DL065 bahKXByO1ipeLf28AM3qr24YjPwV1s7wkNqQMczxIIAgv5UB6I+AnsMV9KLgFt/MjJDz kdoYqJwE0rZs1nuJAnTc9ZkyqFonJFA9750s4kyyrO0qgb+gau28xbEWbta0un2Jikaq KR/kLLalzJyAA2zj1ASgYpFCd7jkC8I8YaY8js8m0mRmuPSaf6POrOXq9vyVPmQ9FNoD YpUA== 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:to:from :dkim-signature; bh=7lqYMRX9as6BscyWczpIIQRMHEdb0bewvUcyeOAl5DY=; fh=uKl1CTlin8qnxt56ErGp3UOINPCBskOXHDuKvJLDQbo=; b=LoAxX+Sanh9GSZtIAh3ADw2pJfRudDXJy5miyi+XlKKi4avGVtB1VLshcxoTHkL/OH jCPZd+Q+eJCwowhhXvmpA+VW2ZMoXpr9DdKPtoFpqBX6ETWF6kBVb/PXdWt4PrEHnhmv LQA/BV8xe7q3U9k701vB6WPf4TWO77D9GJjDGJjvt9UhBQA0w8NoF0DIgpP+8Bj6RmkM wBeXeB2CWzWy7/wLaFsWIM+qb3WnftxA9D7wPGFuhfMLPsgVUgJ/Rw06Tgp5oRPILk0Y UCxzC2JcgS1P4cVyWglYKZlbU6G6hC6gjVb/XhjFu5n70lA/wxdaaVC2UaYV+2EyPekJ SErg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=P0+onzyn; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id j1-20020a056a00130100b006be1dd29127si4655242pfu.127.2023.10.22.01.19.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Oct 2023 01:19:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=P0+onzyn; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id B2C50805747F; Sun, 22 Oct 2023 01:19:19 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231722AbjJVITO (ORCPT + 99 others); Sun, 22 Oct 2023 04:19:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231739AbjJVISx (ORCPT ); Sun, 22 Oct 2023 04:18:53 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A38C2D63 for ; Sun, 22 Oct 2023 01:18:49 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64860C433CC for ; Sun, 22 Oct 2023 08:18:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697962729; bh=DgquwnLDj9ZPnrfqI9YyHmqxn4/fEiZRBImpandoewA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=P0+onzynMVCsOEuYEz7Hg51zOOiTWIIIFg3RkOhc66SHFaqgNVukgXCXvj/RRPtQ8 trSlHDhVr9qt84p3x/8cHMd1A958kKbC89WnlVpkE98LyekpL00l2Migsl2kGH4Wwh exlSQcP3HuWXQ506FRCE1MUt9NPw7p48La27XljFLfbRxethCZ0etslZlOhZeP8RA+ 4GL527iwIE0Z/ORbcyscREwE0ze66gfeGnxZf6khw0RY0KylnNYaP4b5cCSJTyjRpr VdkDAPF+cesDHqQWlLJVGN5nDckz58j5C3qkKfwISQVAFyF8mLliGPD8e32p9AfYGE RA/2CwvC4+OgQ== From: Eric Biggers To: linux-crypto@vger.kernel.org Subject: [PATCH 27/30] crypto: talitos - stop using crypto_ahash::init Date: Sun, 22 Oct 2023 01:10:57 -0700 Message-ID: <20231022081100.123613-28-ebiggers@kernel.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231022081100.123613-1-ebiggers@kernel.org> References: <20231022081100.123613-1-ebiggers@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Sun, 22 Oct 2023 01:19:19 -0700 (PDT) From: Eric Biggers The function pointer crypto_ahash::init is an internal implementation detail of the ahash API that exists to help it support both ahash and shash algorithms. With an upcoming refactoring of how the ahash API supports shash algorithms, this field will be removed. Some drivers are invoking crypto_ahash::init to call into their own code, which is unnecessary and inefficient. The talitos driver is one of those drivers. Make it just call its own code directly. Signed-off-by: Eric Biggers --- drivers/crypto/talitos.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c index e8f710d87007b..e39fc46a0718e 100644 --- a/drivers/crypto/talitos.c +++ b/drivers/crypto/talitos.c @@ -2112,27 +2112,28 @@ static int ahash_finup(struct ahash_request *areq) { struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); req_ctx->last = 1; return ahash_process_req(areq, areq->nbytes); } static int ahash_digest(struct ahash_request *areq) { - struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); - struct crypto_ahash *ahash = crypto_ahash_reqtfm(areq); - - ahash->init(areq); - req_ctx->last = 1; + ahash_init(areq); + return ahash_finup(areq); +} - return ahash_process_req(areq, areq->nbytes); +static int ahash_digest_sha224_swinit(struct ahash_request *areq) +{ + ahash_init_sha224_swinit(areq); + return ahash_finup(areq); } static int ahash_export(struct ahash_request *areq, void *out) { struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); struct talitos_export_state *export = out; struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); struct talitos_ctx *ctx = crypto_ahash_ctx(tfm); struct device *dev = ctx->dev; dma_addr_t dma; @@ -3235,20 +3236,22 @@ static struct talitos_crypto_alg *talitos_alg_alloc(struct device *dev, if (!(priv->features & TALITOS_FTR_HMAC_OK) && !strncmp(alg->cra_name, "hmac", 4)) { devm_kfree(dev, t_alg); return ERR_PTR(-ENOTSUPP); } if (!(priv->features & TALITOS_FTR_SHA224_HWINIT) && (!strcmp(alg->cra_name, "sha224") || !strcmp(alg->cra_name, "hmac(sha224)"))) { t_alg->algt.alg.hash.init = ahash_init_sha224_swinit; + t_alg->algt.alg.hash.digest = + ahash_digest_sha224_swinit; t_alg->algt.desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU | DESC_HDR_SEL0_MDEUA | DESC_HDR_MODE0_MDEU_SHA256; } break; default: dev_err(dev, "unknown algorithm type %d\n", t_alg->algt.type); devm_kfree(dev, t_alg); return ERR_PTR(-EINVAL); -- 2.42.0