Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1360731pxb; Wed, 20 Oct 2021 03:36:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmxl7Nqg99OYrxxndJS+ZBtu+6d04GEnKl1KJ6wRnsBnrPKAxPT7SSJFCSBoX5nV1nTSis X-Received: by 2002:aa7:88cb:0:b0:44d:4b3f:36c1 with SMTP id k11-20020aa788cb000000b0044d4b3f36c1mr5417015pff.76.1634726201943; Wed, 20 Oct 2021 03:36:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634726201; cv=none; d=google.com; s=arc-20160816; b=TNfTGPHfiQ20i3tVu4duhjkq1xvmaW6qRI5gTh1/yMi0bcWYZOpMaNBlbGUQfMlz+a kfKrrXonirPcKLO3qdniekFXkfHo/9GmQeHBK/EbqRBCvxflooNrLkuuCtnBHCIIlwRe 3LmLuu8YXbKuV7eY0wK1GlqFQf1DfDnzs9gYA8M2uHPWT4QtpcuDegm3wwvs6OwsyObH icmhebetZ+d6BvfptS3yjYTKhTSkXrA6/FBMAEj9hcy2sgKMNjMgV8GrlkEPWkFJmouM P5zEXFrs/5XdVxiGw4PkF0CyPaMUPov4czlB74gDuqU3uZjkE6HvBRqCfcHTqkvyyKWI FUuw== 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; bh=iJEyhM9dgTZsa703QKXInFy8lDDV31vGLzbmWi0E48Y=; b=yyPqkqMIJCAs/EST3PuvkpD7CqYtdpSLrzaWCrDmaL9ywZJKoCNVSzN3C0OvZEBkb3 AyPSHWFaEYm9pZaUNjw2JQPwEarrwgftkszLl6OcYq5vSug2ycvYC16egzfziSemBnnl KmtZHg4dab5bqv3Gxa8pw2ckMsudyv+4xG3pGNp+8lO5caDQa5Eve5zZXQC80rKKjnZM QZlCdDvjgD8+bhBwU0z+rHp4xCz4rehqDwyf+TNZbrLZg4UVeYi6swAtm0KxN2cdetxF cfmP6N+ezBARSAaRqTnwBGeIC4M/5xYg8EvdpitXOCZRynq51kQBrY/XC0Dz/Y0mKFTz LmdQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n13si2998587plh.1.2021.10.20.03.35.58; Wed, 20 Oct 2021 03:36:41 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230061AbhJTKiD (ORCPT + 99 others); Wed, 20 Oct 2021 06:38:03 -0400 Received: from mga09.intel.com ([134.134.136.24]:7388 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229952AbhJTKiB (ORCPT ); Wed, 20 Oct 2021 06:38:01 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10142"; a="228622895" X-IronPort-AV: E=Sophos;i="5.87,166,1631602800"; d="scan'208";a="228622895" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2021 03:35:47 -0700 X-IronPort-AV: E=Sophos;i="5.87,166,1631602800"; d="scan'208";a="527005550" Received: from dhicke3x-mobl1.ger.corp.intel.com (HELO dalessan-mobl1.ir.intel.com) ([10.252.29.200]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2021 03:35:44 -0700 From: Daniele Alessandrelli To: linux-crypto@vger.kernel.org, Herbert Xu , "David S. Miller" Cc: devicetree@vger.kernel.org, Rob Herring , Daniele Alessandrelli , Mark Gross , Prabhjot Khurana , Elena Reshetova Subject: [PATCH 1/5] crypto: engine - Add KPP Support to Crypto Engine Date: Wed, 20 Oct 2021 11:35:34 +0100 Message-Id: <20211020103538.360614-2-daniele.alessandrelli@linux.intel.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211020103538.360614-1-daniele.alessandrelli@linux.intel.com> References: <20211020103538.360614-1-daniele.alessandrelli@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Prabhjot Khurana Add KPP support to the crypto engine queue manager, so that it can be used to simplify the logic of KPP device drivers as done for other crypto drivers. Signed-off-by: Prabhjot Khurana Signed-off-by: Daniele Alessandrelli --- Documentation/crypto/crypto_engine.rst | 4 ++++ crypto/crypto_engine.c | 26 ++++++++++++++++++++++++++ include/crypto/engine.h | 5 +++++ 3 files changed, 35 insertions(+) diff --git a/Documentation/crypto/crypto_engine.rst b/Documentation/crypto/crypto_engine.rst index 25cf9836c336..d562ea17d994 100644 --- a/Documentation/crypto/crypto_engine.rst +++ b/Documentation/crypto/crypto_engine.rst @@ -69,6 +69,8 @@ the crypto engine via one of: * crypto_transfer_hash_request_to_engine() +* crypto_transfer_kpp_request_to_engine() + * crypto_transfer_skcipher_request_to_engine() At the end of the request process, a call to one of the following functions is needed: @@ -79,4 +81,6 @@ At the end of the request process, a call to one of the following functions is n * crypto_finalize_hash_request() +* crypto_finalize_kpp_request() + * crypto_finalize_skcipher_request() diff --git a/crypto/crypto_engine.c b/crypto/crypto_engine.c index cff21f4e03e3..fb07da9920ee 100644 --- a/crypto/crypto_engine.c +++ b/crypto/crypto_engine.c @@ -327,6 +327,19 @@ int crypto_transfer_hash_request_to_engine(struct crypto_engine *engine, } EXPORT_SYMBOL_GPL(crypto_transfer_hash_request_to_engine); +/** + * crypto_transfer_kpp_request_to_engine - transfer one kpp_request to list + * into the engine queue + * @engine: the hardware engine + * @req: the request need to be listed into the engine queue + */ +int crypto_transfer_kpp_request_to_engine(struct crypto_engine *engine, + struct kpp_request *req) +{ + return crypto_transfer_request_to_engine(engine, &req->base); +} +EXPORT_SYMBOL_GPL(crypto_transfer_kpp_request_to_engine); + /** * crypto_transfer_skcipher_request_to_engine - transfer one skcipher_request * to list into the engine queue @@ -382,6 +395,19 @@ void crypto_finalize_hash_request(struct crypto_engine *engine, } EXPORT_SYMBOL_GPL(crypto_finalize_hash_request); +/** + * crypto_finalize_kpp_request - finalize one kpp_request if the request is done + * @engine: the hardware engine + * @req: the request need to be finalized + * @err: error number + */ +void crypto_finalize_kpp_request(struct crypto_engine *engine, + struct kpp_request *req, int err) +{ + return crypto_finalize_request(engine, &req->base, err); +} +EXPORT_SYMBOL_GPL(crypto_finalize_kpp_request); + /** * crypto_finalize_skcipher_request - finalize one skcipher_request if * the request is done diff --git a/include/crypto/engine.h b/include/crypto/engine.h index 26cac19b0f46..fd4f2fa23f51 100644 --- a/include/crypto/engine.h +++ b/include/crypto/engine.h @@ -16,6 +16,7 @@ #include #include #include +#include #define ENGINE_NAME_LEN 30 /* @@ -96,6 +97,8 @@ int crypto_transfer_akcipher_request_to_engine(struct crypto_engine *engine, struct akcipher_request *req); int crypto_transfer_hash_request_to_engine(struct crypto_engine *engine, struct ahash_request *req); +int crypto_transfer_kpp_request_to_engine(struct crypto_engine *engine, + struct kpp_request *req); int crypto_transfer_skcipher_request_to_engine(struct crypto_engine *engine, struct skcipher_request *req); void crypto_finalize_aead_request(struct crypto_engine *engine, @@ -104,6 +107,8 @@ void crypto_finalize_akcipher_request(struct crypto_engine *engine, struct akcipher_request *req, int err); void crypto_finalize_hash_request(struct crypto_engine *engine, struct ahash_request *req, int err); +void crypto_finalize_kpp_request(struct crypto_engine *engine, + struct kpp_request *req, int err); void crypto_finalize_skcipher_request(struct crypto_engine *engine, struct skcipher_request *req, int err); int crypto_engine_start(struct crypto_engine *engine); -- 2.31.1