Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp983090rdb; Sun, 1 Oct 2023 14:16:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGPyFPjzE65krF5HYZhJWPEf070UNZk8lxyEWpbSto2XNqqQ46MxY1w3Z3P9rDqap2lmG7V X-Received: by 2002:a05:6870:d189:b0:1d7:503:1502 with SMTP id a9-20020a056870d18900b001d705031502mr13069387oac.59.1696194998018; Sun, 01 Oct 2023 14:16:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696194997; cv=none; d=google.com; s=arc-20160816; b=lYOZwOsC1m/5WgnHRPrKbuNTfrYRrKiyibJCL89+292RtiP9b5TTFC4ZSwHha+9TiF 0Du5YO8JPOTCAp/SdPc5fxJy1cZp/j8CZRhDIQziKNgjr3xT9f3RHv49rUjR94tPnKjs mkN1le6mjfEdBIXHjKJEOGJcmGD02Bc9kXQ0tzrWRnYZ+wbnLFFpiX5/9kULrO97CchM VUxgYdMpQSka8ies3XqKorABEf3HgTaWPdn7JHfFcvjR+NETtmGetAiTpHomGTCRx0iY bKqn3KQjzElNF3tr7BuHqXgw7FZGNleqVuSuU9yU1zCJYAlCAvr1x75JqJ8XrrUI3geJ E8gg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=S5gdKKBRI8HMjzMvfQFYDp6loku3qgrG9OQcfyEaG8Y=; fh=KceVNXvzI0OqVSX6huLPHayQNsRj6iF9yN5TaVnnl64=; b=IoqbbLAP4JklpI7JIFTwFJwVtkl/LPuYxdvqcgFsNEBWYt/ZpUNUX3AJjoikbHOKMO D/gGgN9xzjzlAF8uIDr4AvMeWLR33HdUC0VNU/YrbHf3DwZXgRjoHUyKklrKs3gNdHJa Bpxu0r2Zth17mDyshz4hIZlpvaXLFCj17B63jXv2HVVIsKEv+v1jkUvRXxqSlXqwDWDx yMQQTgTnutFhTVDOkIqPhXIOWTPScI1/10o76VvlGC1eU2VtOB1z3eQ7gO2hyGYW1V6G QfA/culQEQ0CTLl4Qst853CecvpKp2E+TBXs1aKsiC9WVoAS3keDQwkvHdiU45jrcZ0g eRag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=ENJDV8FQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id a21-20020a63e855000000b005784ab1c4afsi26891499pgk.736.2023.10.01.14.16.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 14:16:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=ENJDV8FQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 0071980924B6; Sun, 1 Oct 2023 13:22:00 -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 S235363AbjJAUOK (ORCPT + 99 others); Sun, 1 Oct 2023 16:14:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235346AbjJAUOJ (ORCPT ); Sun, 1 Oct 2023 16:14:09 -0400 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 344B0D3 for ; Sun, 1 Oct 2023 13:14:06 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-32799639a2aso936198f8f.3 for ; Sun, 01 Oct 2023 13:14:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1696191244; x=1696796044; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=S5gdKKBRI8HMjzMvfQFYDp6loku3qgrG9OQcfyEaG8Y=; b=ENJDV8FQI78y78EglS69TxeGxUl/zickH6M2Iw6RqqbDpzVNH7ywqOc5FryAzAQdfo ZuP6zHwaHwnf9HCfsz5CXh+tLxz8PoFvscwLEhbefPx5QVjoqX1KmXP9n66dKz6ryxYH tCBDYgkx/1R4SI9HKVh7zok8NHyvmXXBhttmuKc2StwabPKDrwAu4t+zMA+MnSGPHcbN /FDW1HCcs3EItuOQZMIUejk/TFYTXVC8XTMOe2/xCNarO96Cby/kcjhqiFRQAIUG3o/m aLACJyFofk8zJxiqT66akr6qKK844hmkDnJtn3RluPm/n3jIbt6JmDgtmIkfKdkxSSMo VLTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696191244; x=1696796044; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=S5gdKKBRI8HMjzMvfQFYDp6loku3qgrG9OQcfyEaG8Y=; b=ipMb1OlVwwCBhwdZ57E/doAEuVM3MGbvESODCv9t+Zuflcszo1weXNq7GYWi3R5l0u b3YhdWz0okZ92ni3aQMwXQt8VVo86LOvG9cLnKvHiCPkQs4jx7GkjAaE1+9vX0vvU7j/ DIF62JoGvTeA4XJNw/VAkcCqfJ05K7J6ebhK+ngczbiNRmqTtYqxhV8SryEBftWbFZAp dGq6l2orEMtCUahNR579qr+k5VsHH1cBD1H+ImCkKVqtftrvN+1Q/wI8O1lGbFCh1LnX PIxV/owjkgxauyIW0cX9ROUdfaSRSv1ZZkyQCCqFUVjIbg+esvcNuN6ggN5G6MLrlpbR dWrg== X-Gm-Message-State: AOJu0YzgA8y9srz5JLyX7f9f6qFTMXU4GAVLANrIzPqBaQXCYyHw+WDb h+Ool6n44/Hq98EkasmFoztd6Q== X-Received: by 2002:a5d:63cb:0:b0:319:6e3f:d5f0 with SMTP id c11-20020a5d63cb000000b003196e3fd5f0mr9162433wrw.44.1696191244674; Sun, 01 Oct 2023 13:14:04 -0700 (PDT) Received: from arnold.baylibre (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id j6-20020a5d6046000000b003259b068ba6sm6141665wrt.7.2023.10.01.13.14.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 13:14:03 -0700 (PDT) From: Corentin Labbe To: andrew@aj.id.au, davem@davemloft.net, herbert@gondor.apana.org.au, joel@jms.id.au, john.allen@amd.com, neal_liu@aspeedtech.com, thomas.lendacky@amd.com Cc: linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, Corentin Labbe Subject: [PATCH] crypto: Move akcipher_request_cast helper to crypto header Date: Sun, 1 Oct 2023 20:13:57 +0000 Message-Id: <20231001201357.2052949-1-clabbe@baylibre.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable 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-kernel@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, 01 Oct 2023 13:22:01 -0700 (PDT) There is already 2 driver implementing their own akcipher_request_cast. In the future there will be also rockchip and allwinner driver that will need this. This is sufficient to move it in crypto headers. Signed-off-by: Corentin Labbe --- drivers/crypto/aspeed/aspeed-acry.c | 6 ------ drivers/crypto/ccp/ccp-crypto-rsa.c | 6 ------ include/crypto/akcipher.h | 7 +++++++ 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/crypto/aspeed/aspeed-acry.c b/drivers/crypto/aspeed/aspeed-acry.c index 247c568aa8df..ecb6e984367b 100644 --- a/drivers/crypto/aspeed/aspeed-acry.c +++ b/drivers/crypto/aspeed/aspeed-acry.c @@ -137,12 +137,6 @@ enum aspeed_rsa_key_mode { ASPEED_RSA_DATA_MODE, }; -static inline struct akcipher_request * - akcipher_request_cast(struct crypto_async_request *req) -{ - return container_of(req, struct akcipher_request, base); -} - static int aspeed_acry_do_fallback(struct akcipher_request *req) { struct crypto_akcipher *cipher = crypto_akcipher_reqtfm(req); diff --git a/drivers/crypto/ccp/ccp-crypto-rsa.c b/drivers/crypto/ccp/ccp-crypto-rsa.c index a14f85512cf4..32c9f524f3d5 100644 --- a/drivers/crypto/ccp/ccp-crypto-rsa.c +++ b/drivers/crypto/ccp/ccp-crypto-rsa.c @@ -19,12 +19,6 @@ #include "ccp-crypto.h" -static inline struct akcipher_request *akcipher_request_cast( - struct crypto_async_request *req) -{ - return container_of(req, struct akcipher_request, base); -} - static inline int ccp_copy_and_save_keypart(u8 **kpbuf, unsigned int *kplen, const u8 *buf, size_t sz) { diff --git a/include/crypto/akcipher.h b/include/crypto/akcipher.h index 670508f1dca1..4b6e610db18d 100644 --- a/include/crypto/akcipher.h +++ b/include/crypto/akcipher.h @@ -498,4 +498,11 @@ static inline int crypto_akcipher_set_priv_key(struct crypto_akcipher *tfm, return alg->set_priv_key(tfm, key, keylen); } + +static inline struct akcipher_request * + akcipher_request_cast(struct crypto_async_request *req) +{ + return container_of(req, struct akcipher_request, base); +} + #endif -- 2.41.0