From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 203A4C3A59D for ; Thu, 22 Aug 2019 08:37:46 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E95B62339F for ; Thu, 22 Aug 2019 08:37:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="t8IphnJR"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="jhs218aN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E95B62339F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5XqJFPcj3aYF/QYCS21bMih+qDxXvMEvq11jMLM08qU=; b=t8IphnJRKradBl Kw4Cq5nDm23gETxRv1UywLLi1no3M1R/ppvGswYIdFZqHbn5EKIahlhQN/S5ZlXCH5cs35ulsbOnA HmdxrSu/c1V2BxyLSCEK233wzWRXv/KIhEG8kDIcJXHJWbXLoVCv6vXST4/mdoBthpdbmBACubNBc XJgN+QQa5kpmzJG/FybLOd5TeVNOZEKI/f5VyO/dCv4vp0lD40YAivt1EhMkn0M4MAEuDGOGO3gNg DZUF8PPX41qiiwwQ8fWj6ADGRGl41ZRgR3u8F1cOJvTKgIxgeFvqgvcTUavk7KrrvUO/Mac6zRR75 gFbc8iPoim5V5vIVzF/A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i0ibJ-0004Du-Ay; Thu, 22 Aug 2019 08:37:45 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i0ibE-0004Ct-0R for linux-arm-kernel@lists.infradead.org; Thu, 22 Aug 2019 08:37:43 +0000 Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 424762342E for ; Thu, 22 Aug 2019 08:37:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566463059; bh=XE3xK9iG8Wy7wo/kPx8rxFjUegSzi/UaDRIOdgmeG7Q=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=jhs218aNaLA4Bq8OPujJ/oKGM90+zjHunggojHGSt42VmXqMKgeNTPazw8Mmev1Je JwhDX50NdqNblLusEM/+477jQps0EsJvAhuJqHOEuGRyDPBMUO588mLhb49EyqUQu8 uON7wCWTLLCkC28QdqMP+2McwTT40RKkfLdU2OOE= Received: by mail-lj1-f177.google.com with SMTP id z17so4785906ljz.0 for ; Thu, 22 Aug 2019 01:37:39 -0700 (PDT) X-Gm-Message-State: APjAAAVknxzJT2ReQvzmb5H4hZfu+63Nwsxv5Xrbe1fm5dQul2a2UDkV xD8BK7iktgVf/2saMDU4AaB4/TVSSfBiAySvsOs= X-Google-Smtp-Source: APXvYqxXD3xVQJzrJLwcWiHpcv+TEgK10V+ZrGUMTV7We6eP5yS2aPqV9SO+VlhvYHW+opZdR7L81464kePe1T4gEFc= X-Received: by 2002:a2e:b4d4:: with SMTP id r20mr21412900ljm.5.1566463057314; Thu, 22 Aug 2019 01:37:37 -0700 (PDT) MIME-Version: 1.0 References: <003d01d557eb$8f6ca210$ae45e630$@samsung.com> In-Reply-To: <003d01d557eb$8f6ca210$ae45e630$@samsung.com> From: Krzysztof Kozlowski Date: Thu, 22 Aug 2019 10:37:26 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/9] crypt: Add diskcipher To: "boojin.kim" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190822_013740_091901_990CF61E X-CRM114-Status: GOOD ( 28.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , Mike Snitzer , dm-devel@redhat.com, Andreas Dilger , Alasdair Kergon , Eric Biggers , "linux-samsung-soc@vger.kernel.org" , Herbert Xu , Jaehoon Chung , Kukjin Kim , linux-ext4@vger.kernel.org, Chao Yu , linux-block@vger.kernel.org, linux-fscrypt@vger.kernel.org, Jaegeuk Kim , linux-arm-kernel@lists.infradead.org, Jens Axboe , "Theodore Y. Ts'o" , linux-mmc@vger.kernel.org, "linux-kernel@vger.kernel.org" , linux-f2fs-devel@lists.sourceforge.net, linux-crypto@vger.kernel.org, linux-fsdevel@vger.kernel.org, "David S. Miller" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, 21 Aug 2019 at 08:42, boojin.kim wrote: > > Diskcipher supports cryptographic operations of inline crypto engines like > FMP. Inline crypto engine refers to hardware and solutions implemented > to encrypt data stored in storage device. > > When encrypting using the FMP, Additional control is required > to carry and maintain the crypto information between > the encryption user(fscrypt, DM-crypt) and FMP driver. > Diskcipher provides this control. > > Diskcipher is a symmetric key cipher in linux crypto API to support FMP. > FMP are registered with the cihper algorithm that uses diskcipher. > > Diskcipher has three major steps. > The first step is to assign a cipher and set the key. > The second step is to pass the cipher through the BIO to the storage > driver. > The third step is to get the cipher from BIO and request a crypt > to FMP algorithm. > > In the first step, encryption users such as fscrypt or dm-crypt > allocate/release a diskcipher and set key into the diskcipher. > Diskcipher provides allocate(), free(), and setkey() that are similar > to existing ciphers. > > In the second step, BIO is used to pass the diskcipher to the storage > driver. > The BIO submitters such as ext4, f2fs and DM-crypt set diskcipher to BIO. > Diskcipher provides the set () API for this. > > In the third step, the storage driver extracts the diskcipher from the BIO > and requests the actual encryption behavior to inline crypto engine driver. > Diskcipher provides get() and crypt() APIs for this. > > Cc: Herbert Xu > Cc: David S. Miller > Signed-off-by: Boojin Kim > --- > crypto/Kconfig | 9 ++ > crypto/Makefile | 1 + > crypto/diskcipher.c | 349 > ++++++++++++++++++++++++++++++++++++++++++++ > crypto/testmgr.c | 157 ++++++++++++++++++++ > include/crypto/diskcipher.h | 245 +++++++++++++++++++++++++++++++ > include/linux/crypto.h | 1 + > 6 files changed, 762 insertions(+) > create mode 100644 crypto/diskcipher.c > create mode 100644 include/crypto/diskcipher.h > > diff --git a/crypto/Kconfig b/crypto/Kconfig > index 455a335..382d43a 100644 > --- a/crypto/Kconfig > +++ b/crypto/Kconfig > @@ -1636,6 +1636,15 @@ config CRYPTO_TWOFISH_AVX_X86_64 > See also: > > > +config CRYPTO_DISKCIPHER > + bool "Diskcipher support" > + default n > + help > + Disk cipher algorithm > + > + This cipher supports the crypt operation of the block host device > + that has inline crypto engine. > + > comment "Compression" > > config CRYPTO_DEFLATE > diff --git a/crypto/Makefile b/crypto/Makefile > index 0d2cdd5..71df76a 100644 > --- a/crypto/Makefile > +++ b/crypto/Makefile > @@ -165,6 +165,7 @@ obj-$(CONFIG_CRYPTO_USER_API_AEAD) += algif_aead.o > obj-$(CONFIG_CRYPTO_ZSTD) += zstd.o > obj-$(CONFIG_CRYPTO_OFB) += ofb.o > obj-$(CONFIG_CRYPTO_ECC) += ecc.o > +obj-$(CONFIG_CRYPTO_DISKCIPHER) += diskcipher.o > > ecdh_generic-y += ecdh.o > ecdh_generic-y += ecdh_helper.o > diff --git a/crypto/diskcipher.c b/crypto/diskcipher.c > new file mode 100644 > index 0000000..ffe95a5 > --- /dev/null > +++ b/crypto/diskcipher.c > @@ -0,0 +1,349 @@ > +// SPDX-License-Identifier: GPL-2.0-or-later > +/* > + * Copyright (C) 2017 Samsung Electronics Co., Ltd. > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation; either version 2 of the License, or > + * (at your option) any later version. > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "internal.h" > + > +static int crypto_diskcipher_check(struct bio *bio) > +{ > + struct crypto_diskcipher *ci = NULL; > + struct inode *inode = NULL; > + struct page *page = NULL; > + > + if (!bio) { > + pr_err("%s: doesn't exist bio\n", __func__); > + return 0; > + } > + > + /* enc without fscrypt */ > + ci = bio->bi_aux_private; > + if (!ci->inode) > + return 0; > + if (ci->algo == 0) > + return 0; > + > + page = bio->bi_io_vec[0].bv_page; > + if (!page || PageAnon(page) || !page->mapping || > !page->mapping->host) Your patch looks corrupted - wrapped by mailer. The easiest way usually is to use git format-patch and git send-email - then you do not have to worry about formatting etc. Best regards, Krzysztof _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel