From patchwork Mon Oct 26 13:04:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 318970 Delivered-To: patch@linaro.org Received: by 2002:a92:7b12:0:0:0:0:0 with SMTP id w18csp651040ilc; Mon, 26 Oct 2020 06:05:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9c2zsh+rCmNxJNGTIBeqMKk204ev1r/NrAQe/f3kmZa0Z+9AgU40GttVHuU/P9LKE6wOA X-Received: by 2002:aa7:c6d9:: with SMTP id b25mr15099537eds.27.1603717505308; Mon, 26 Oct 2020 06:05:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603717505; cv=none; d=google.com; s=arc-20160816; b=FCEq8/eSSja8CzbojlvqAzD34yYJnkeiNGaxMDodNO3V74pYSvjAIO+FW+YkdNb48+ zl9mbGAdz5aZB1k3pgYCQpYypk3z+1NioNGIhJCpTlONIOsqpEMbBQCBTkYC5DDmB3Xo mAZF9itdy1VMy2CtYFqwOJasFdJsEJ648vfZAiCypcg8DpBNiWGeKSKeE9qPhP4qBnB2 cWNAjqGxeA2WbkDJIGsO0uwkT9m/y84yuj6B+S2le2AxwgdcZ6cnXJK8VwvDxkUutJSd vDeJ36ftwD0dBocSAo0ABIfARPBkv4eRMLN/5AaIpl9ByHNM/bbWTkmbdpspTOm5p5di h0Rg== 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; bh=FKZR/fFWx2ugkzMxQvsx6Xoq+hapt8bFKLVQ7nKSGs4=; b=VwvZX2lsjGF33hbNuO3R6FIchBqyQbJ9f6HHaZw7mV9K4U6+/jf6bN3fLsQvXQyPMU jIlnpp2xNPaa5DRVQ9dQ8JmOPCq9D5JYwCxbbH2DMQLfigVxrmEA5wWwOzLpovcWrb3T KAYgFHN4tWw6rRwKdTJdE8Ai97h7q57i9RmFEmcxIU4vVa/unWNC51mcz60IEOemZLap jEM23QhjghAG1Sy8AgXiBZMXnGRJga/VA9hvveGHyB6Z9PaE6BwOf40caI/vHqqavxgy Uirq45T4PpA8oeE0mZZKf5Yc26+2Z3u0u4LEzz/xzus0zcR3X/P/eBBPgP6hheBEst/s ikIg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e2si7086675ejq.58.2020.10.26.06.05.05; Mon, 26 Oct 2020 06:05:05 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1737201AbgJZNFE (ORCPT + 2 others); Mon, 26 Oct 2020 09:05:04 -0400 Received: from foss.arm.com ([217.140.110.172]:38288 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1737199AbgJZNFE (ORCPT ); Mon, 26 Oct 2020 09:05:04 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 57E461477; Mon, 26 Oct 2020 06:05:03 -0700 (PDT) Received: from e110176-lin.arm.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DD6DE3F68F; Mon, 26 Oct 2020 06:05:00 -0700 (PDT) From: Gilad Ben-Yossef To: Herbert Xu , "David S. Miller" , Song Liu , Alasdair Kergon , Mike Snitzer , dm-devel@redhat.com Cc: Ofir Drang , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org Subject: [PATCH 0/4] crypto: switch to crypto API for EBOIV generation Date: Mon, 26 Oct 2020 15:04:43 +0200 Message-Id: <20201026130450.6947-1-gilad@benyossef.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org This series creates an EBOIV template that produces a skcipher transform which passes through all operations to the skcipher, while using the same skcipher and key to encrypt the input IV, which is assumed to be a sector offset, although this is not enforced. This matches dm-crypt use of EBOIV to provide BitLocker support, and so it is proposed as a replacement in patch #3. Replacing the dm-crypt specific EBOIV implementation to a Crypto API based one allows us to save a memory allocation per each request, as well as opening the way for use of compatible alternative transform providers, one of which, based on the Arm TrustZone CryptoCell hardware, is proposed as patch #4. Future potential work to allow encapsulating the handling of multiple subsequent blocks by the Crypto API may also benefit from this work. The code has been tested on both x86_64 virtual machine with the dm-crypt test suite and on an arm 32 bit board with the CryptoCell hardware. Since no offical source for eboiv test vectors is known, the test vectors supplied as patch #2 are derived from sectors which are part of the dm-crypt test suite. Gilad Ben-Yossef (4): crypto: add eboiv as a crypto API template crypto: add eboiv(cbc(aes)) test vectors dm crypt: switch to EBOIV crypto API template crypto: ccree: re-introduce ccree eboiv support crypto/Kconfig | 21 ++ crypto/Makefile | 1 + crypto/eboiv.c | 295 +++++++++++++++++++++++++++ crypto/tcrypt.c | 9 + crypto/testmgr.c | 6 + crypto/testmgr.h | 279 +++++++++++++++++++++++++ drivers/crypto/ccree/cc_cipher.c | 130 ++++++++---- drivers/crypto/ccree/cc_crypto_ctx.h | 1 + drivers/md/Kconfig | 1 + drivers/md/dm-crypt.c | 61 ++---- 10 files changed, 725 insertions(+), 79 deletions(-) create mode 100644 crypto/eboiv.c -- 2.28.0