From patchwork Wed Jan 3 20:11:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 123334 Delivered-To: patch@linaro.org Received: by 10.80.135.92 with SMTP id 28csp5916124edv; Wed, 3 Jan 2018 12:13:31 -0800 (PST) X-Google-Smtp-Source: ACJfBotodblFXax67iw+WfkAJ09vnJXPOvOXgcKEnh/6Yutpx8bAKpjxvK7OcKR4cN13tf+uUINR X-Received: by 10.159.196.151 with SMTP id c23mr2358576plo.171.1515010411468; Wed, 03 Jan 2018 12:13:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515010411; cv=none; d=google.com; s=arc-20160816; b=zmvqN5Kn/W4Ti+lRmyQxjs+xNeTExwzIxNWgZIuCUIBYhcfng3ivoBDMZLgKIKrWEZ RTprJtNDz32TDOEm6g/4drs7hJ2/NphC46l9T1r39WT6Jr8x/OgX8/+vf/xksmltUMOn feAseBZe2A0c2AJ/IocvfCTZ9QM8aTFEXMc5bDEmIeK47crCn8rSUICcc9pdQS3rsR0J GhqyJW7+ncUU3j86KthYz3CU5kBFZhDSHCFvF+tqB+ob1ws+6mzLK9aQfCrijj7VGi5E 56gTzXIhKO8FpK8GCJkR4AHdfZN2Olu2jNbeSBNef3NttIV3khZD7U22jTECiw0DtpPW HeTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=YsFD0E9z85YLE/LpE3Ec6XM8BE7m1eijVk+2JTRihO8=; b=fhNuW3ESbWlF5qZOqn3wsqWALSsytvvQJ37wpKxJZtP+3wOek/MfqcRFS4P1d5zSjo nb+7SFJXH764n/yaIc56WzLZh8uGvGGW6XmqBVmxHKx1b+FvemmQWCZt1I5JdDBVj1AJ /XNTipjJCYC+DF8EBQyYldoYWBvC3EnqXMeLeCVG8feDPLxbpk5+zBJE+LRUmfrGGfJ9 kzQ/x5apx4vWPcxpo8M5VtlykRPeFuRv9o+yQeFJwaT1t6IdmNdCuDEr787qQaNHMz/g BWMphBi6euc7K7pDHFxpahScfp2OPvoMNOr5YYbK3cF0fmvvcHaxyUg9E11Za4MXc2Dp MUiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JP0Qb7Rh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w31si1134595pla.517.2018.01.03.12.13.31; Wed, 03 Jan 2018 12:13:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JP0Qb7Rh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752213AbeACUN2 (ORCPT + 28 others); Wed, 3 Jan 2018 15:13:28 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:43553 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752143AbeACUNV (ORCPT ); Wed, 3 Jan 2018 15:13:21 -0500 Received: by mail-wm0-f66.google.com with SMTP id n138so4665328wmg.2; Wed, 03 Jan 2018 12:13:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=YsFD0E9z85YLE/LpE3Ec6XM8BE7m1eijVk+2JTRihO8=; b=JP0Qb7Rhy42XRN231RcU9FhN6rCpIaWdQ1/llHAXNyKc88CZng5IT5/1MUuXEagmj9 8TWii6PRCAzdGHhfKD4sucNT2z8J1Ju8FvQPx0v2Nt1tj+OJ3u6jDhVqxv8LTGIhpP4R IW6GFjBVsqO6wvtT8lCjKugqA+B+B1wOjfQdTm+ShQjEKb6eAgxb2kvr0GJ0AB68ydzQ 8otQMAUZdiNsdqCY0FXJHxgoieS/NIqHOSu30deI3T09cBJoT1fKYOE0bjX9USR/RiRb hEaS/51DViB5CPngaVMw7r5n3G8ZhFHnXB6Cs8okcmbPydEkloqrfSaESVt8bxbMlDvE cRqg== 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; bh=YsFD0E9z85YLE/LpE3Ec6XM8BE7m1eijVk+2JTRihO8=; b=PjvUexkVQSq/wtDlQEgIIL32RXbd16rcao/LSJ44hdjvUF2p8VYMGy19q1SMlGW6BH 4AX6hVay9yXMkfUDqLhjTKvSMhT7AX3s3j1wqu0oH86FYxPRKczWp5PsXJwEUzpaDa+z Y+P4zS+Ki+lGREYhkypljusOcekW0oERzxVp3RaVHw3DGM/TO8xBQH4lScihX5J65wxJ XroeOCEhdq6BYNz0FgjInwnTYhSC0jWQQ180wUSaMrnwAYVjZlssWvgD5lcFlnzAq5FM +xi6kAcq8k+c57ZB2PqJfWNdVh89gdroDerQw5p5VhX8XJcA+vGZuC01coeA6myDuPV6 2FDw== X-Gm-Message-State: AKGB3mKHlktGErhN/DdShMRj4Q6yzWndQsJ50BZsmgTW5LiwXbQORdtU hVbWifc/Nh6duGYVfWJJOhk= X-Received: by 10.28.74.3 with SMTP id x3mr2418472wma.78.1515010399525; Wed, 03 Jan 2018 12:13:19 -0800 (PST) Received: from Red.local (LFbn-1-6953-20.w90-116.abo.wanadoo.fr. [90.116.134.20]) by smtp.googlemail.com with ESMTPSA id p90sm1800627wmf.3.2018.01.03.12.13.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Jan 2018 12:13:18 -0800 (PST) From: Corentin Labbe To: alexandre.torgue@st.com, arei.gonglei@huawei.com, corbet@lwn.net, davem@davemloft.net, herbert@gondor.apana.org.au, jasowang@redhat.com, mcoquelin.stm32@gmail.com, mst@redhat.com Cc: linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, fabien.dessenne@st.com, Corentin Labbe Subject: [PATCH 0/6] crypto: engine - Permit to enqueue all async requests Date: Wed, 3 Jan 2018 21:11:03 +0100 Message-Id: <20180103201109.16077-1-clabbe.montjoie@gmail.com> X-Mailer: git-send-email 2.13.6 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello The current crypto_engine support only ahash and ablkcipher request. My first patch which try to add skcipher was Nacked, it will add too many functions and adding other algs(aead, asymetric_key) will make the situation worst. This patchset remove all algs specific stuff and now only process generic crypto_async_request. The requests handler function pointer are now moved out of struct engine and are now stored directly in a crypto_engine_reqctx. The original proposal of Herbert [1] cannot be done completly since the crypto_engine could only dequeue crypto_async_request and it is impossible to access any request_ctx without knowing the underlying request type. So I do something near that was requested: adding crypto_engine_reqctx in TFM context. Note that the current implementation expect that crypto_engine_reqctx is the first member of the context. The first patch is a try to document the crypto engine API. The second patch convert the crypto engine with the new way, while the following patchs convert the 4 existing users of crypto_engine. Note that this split break bisection, so probably the final commit will be all merged. Appart from virtio, all 4 latest patch were compile tested only. But the crypto engine is tested with my new sun8i-ce driver. Regards [1] https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1474434.html Changes since RFC: - Added a documentation patch - Added patch for stm32-cryp - Changed parameter of all crypto_engine_op functions from crypto_async_request to void* - Reintroduced crypto_transfer_xxx_request_to_engine functions Corentin Labbe (6): Documentation: crypto: document crypto engine API crypto: engine - Permit to enqueue all async requests crypto: omap: convert to new crypto engine API crypto: virtio: convert to new crypto engine API crypto: stm32-hash: convert to the new crypto engine API crypto: stm32-cryp: convert to the new crypto engine API Documentation/crypto/crypto_engine.rst | 46 ++++++ crypto/crypto_engine.c | 230 +++++++++++++-------------- drivers/crypto/omap-aes.c | 17 +- drivers/crypto/omap-aes.h | 3 + drivers/crypto/omap-des.c | 20 ++- drivers/crypto/stm32/stm32-cryp.c | 21 ++- drivers/crypto/stm32/stm32-hash.c | 18 ++- drivers/crypto/virtio/virtio_crypto_algs.c | 10 +- drivers/crypto/virtio/virtio_crypto_common.h | 3 +- drivers/crypto/virtio/virtio_crypto_core.c | 3 - include/crypto/engine.h | 59 ++++--- 11 files changed, 263 insertions(+), 167 deletions(-) create mode 100644 Documentation/crypto/crypto_engine.rst -- 2.13.6