From patchwork Fri Jan 26 19:15:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 126012 Delivered-To: patch@linaro.org Received: by 10.46.84.92 with SMTP id y28csp554772ljd; Fri, 26 Jan 2018 11:18:04 -0800 (PST) X-Google-Smtp-Source: AH8x227Ee7KpJmmFsPtZPrugvmaIE2VCwMfhGBlGEhI4wQKIlGEOPG4aIQV4wtXamDZB0mQYqwCK X-Received: by 10.101.71.130 with SMTP id e2mr16329807pgs.396.1516994284226; Fri, 26 Jan 2018 11:18:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516994284; cv=none; d=google.com; s=arc-20160816; b=s0psO0T69uDIyCj2AsGrwS0Vf8luX6cbetcJ6Xf5jgGFSDW6WYMOJXtqCJ6ehkxxkQ gWHfeuiF9VP+n1oqfoDpQhXvLuhGrxhDidUwu4tUpBtgof+31+6eHSd5Aq+tPx33KQi8 /ygkM09h6TIf8e6c8TzsWA2WxRuOExBUlWr/DIGG/aBWmLcJzKERCk1iAS9rpY+zYTmC ouQplgZK32SFFbB68D/i54RDVhFX92yHmWUzOrHppkFNjqf1HYw6+UyA0rOFr+91oADk CgzUtFHslO3Tj9djXDY16qDYOrQbNwNFU72rOIrpf/veTpPB0WE3WZ32a+CWTxTRYOed Y25Q== 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=SjpswPTll9ww7DOYL8WBzRg5vbdcqZRkZqd1Mj6dk+U=; b=GCYp3L3rdcUnhLuTUpRvT2E38Iu6izEHnsFU8s58biHvj/2dUot5PuO3IVc0A8RRok nMKh/NQoK2RVdYAJXhq3A0tjUG9+NhAUxBDk/VpuMvHykybGD/6TZi+04Td7kLFRgZFR pVSUATWKD74fadrBi4DbQsY62BltL8JiLUPfqTfkbIsg6X9JfzNYZbUAS6+FQJT+wWQ6 B2xcqbK9FNe2TGIhLpChrS7Oq2rP3RGP5jerZCANrYd9qCkueH0jvh7K0kbLIK25R9hG Tkxs53hQ7eks5DToDcI4oBvBoKJaQf6SjTQi+5D4md7jl4CV4yKbJZcduGgbnIp3SuXJ NSUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pMWmlYg3; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-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 a14si3360073pgd.49.2018.01.26.11.18.04; Fri, 26 Jan 2018 11:18:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-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=pMWmlYg3; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-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 S1751998AbeAZTSC (ORCPT + 1 other); Fri, 26 Jan 2018 14:18:02 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:37388 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751609AbeAZTSB (ORCPT ); Fri, 26 Jan 2018 14:18:01 -0500 Received: by mail-wr0-f194.google.com with SMTP id f11so1407716wre.4; Fri, 26 Jan 2018 11:18:00 -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=SjpswPTll9ww7DOYL8WBzRg5vbdcqZRkZqd1Mj6dk+U=; b=pMWmlYg3z4ovESGrmkKjjYv0pNgt30zfIib39Iko60OKXBSjbXfqwdlebV9HU4nbhR IDNLMeFNKf6tSHaHFGzikHgj5A4SAAqqmf1x/w353B9ueq6wAeosCrrDLH55iiTEAGnP wU8JjXcW605f/rfNgbjlzlpIisGLXbzaIwT50QI2MrkBe2yyDwmJcH+urc4iJrsGs5rE JAUWdnk0Q5T27U1LDEAMWm3VJRPIdRfesnnCwezm5hGsPjLkMKIzCbzPdBUihBEKAKfs ZO5XNurUf8RtDL5RZRmyRQRfev5oQiWrYLb5BWeAi17WeiAriXnhC10x2P/j0gdZYxdp uLfw== 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=SjpswPTll9ww7DOYL8WBzRg5vbdcqZRkZqd1Mj6dk+U=; b=G0oBBIoTxbSwWDcMUwK3Fmj43o4NvmCFixXmS4i1JP45XpLRcmJ5X/3hfLH2gSVDW7 omMy2iJv2WQJIdZl3p6ZTtAv2ZH9b14P3QmwaWIw2yNnVamK4c9drTM+7WbNaCYitDsP /qU+qI6xyOgxDAE3o+nyJO8FciE9dCMgzcCvt51znWWjyz7CDSu4/W3+KcFZWmXSs7dO 2zZnjlb5PNpDripvKipktpYoj7tCsFi2tgBONi13rk5vXaR/BW18VX59dSMsrX9csCec ik/4SIjQHjSTCx+RU3VW6uugj4Ojt0tueJLyMB+moknMcuP5He+ww0L0qj8NoWjrg4Er cb9Q== X-Gm-Message-State: AKwxyteG//VAK4pDGcEU0Dl9uKhWl5/uj944NIu6X+PqxMHlpGUOYeiG /R1SK0RLfewQhsqttciGPO3RRE5w X-Received: by 10.223.187.72 with SMTP id x8mr13868745wrg.179.1516994280266; Fri, 26 Jan 2018 11:18:00 -0800 (PST) Received: from Red.local (LFbn-MAR-1-494-174.w2-15.abo.wanadoo.fr. [2.15.82.174]) by smtp.googlemail.com with ESMTPSA id k125sm7587510wmd.48.2018.01.26.11.17.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jan 2018 11:17:58 -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, fabien.dessenne@st.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, linux-sunxi@googlegroups.com, Corentin Labbe Subject: [PATCH v2 0/6] crypto: engine - Permit to enqueue all async requests Date: Fri, 26 Jan 2018 20:15:28 +0100 Message-Id: <20180126191534.17569-1-clabbe.montjoie@gmail.com> X-Mailer: git-send-email 2.13.6 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@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 V1: - renamed crypto_engine_reqctx to crypto_engine_ctx - indentation fix in function parameter - do not export crypto_transfer_request - Add aead support - crypto_finalize_request is now static 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 | 48 +++++ crypto/crypto_engine.c | 301 +++++++++++++++------------ drivers/crypto/omap-aes.c | 21 +- drivers/crypto/omap-aes.h | 3 + drivers/crypto/omap-des.c | 24 ++- drivers/crypto/stm32/stm32-cryp.c | 29 ++- drivers/crypto/stm32/stm32-hash.c | 20 +- drivers/crypto/virtio/virtio_crypto_algs.c | 16 +- drivers/crypto/virtio/virtio_crypto_common.h | 3 +- drivers/crypto/virtio/virtio_crypto_core.c | 3 - include/crypto/engine.h | 68 +++--- 11 files changed, 332 insertions(+), 204 deletions(-) create mode 100644 Documentation/crypto/crypto_engine.rst -- 2.13.6