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=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham 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 8DB9EECDFBB for ; Wed, 18 Jul 2018 13:11:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4AE542075E for ; Wed, 18 Jul 2018 13:11:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4AE542075E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730521AbeGRNtq (ORCPT ); Wed, 18 Jul 2018 09:49:46 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:46048 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726258AbeGRNtq (ORCPT ); Wed, 18 Jul 2018 09:49:46 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C0DBC400E9BA; Wed, 18 Jul 2018 13:11:52 +0000 (UTC) Received: from localhost (unknown [10.18.25.149]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 864B92026D69; Wed, 18 Jul 2018 13:11:52 +0000 (UTC) Date: Wed, 18 Jul 2018 09:11:52 -0400 From: Mike Snitzer To: Xiongfeng Wang , Milan Broz Cc: agk@redhat.com, herbert@gondor.apana.org.au, dm-devel@redhat.com, broonie@kernel.org, linux-kernel@vger.kernel.org, arnd@arndb.de, jonathan.cameron@huawei.com Subject: Re: [PATCH 4/5] crypto: Add IV generation templates Message-ID: <20180718131152.GA25685@redhat.com> References: <1531899055-29362-1-git-send-email-wangxiongfeng2@huawei.com> <1531899055-29362-5-git-send-email-wangxiongfeng2@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 18 Jul 2018 13:11:52 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 18 Jul 2018 13:11:52 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'msnitzer@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 18 2018 at 4:16am -0400, Milan Broz wrote: > On 18/07/18 09:30, Xiongfeng Wang wrote: > > Currently, the IV generation algorithms are implemented in dm-crypt.c. > > This patch implement these algorithms as template ciphers, so that > > dm-crypt layer can be simplified, and also these algorithms can be > > implemented in hardware for performance. > > > > Synchronous crypto requests to encrypt/decrypt a sector are processed > > sequentially. Asynchronous requests if processed in paralled, are freed > > in the async callback. > > So we are here again and moving INTERNAL dm-crypt functionality into > cryptoapi. > > The TCW,LMK IVs generator make sense only for dm-crypt > for compatible old disk encryption mappings. > > I strongly disagree to move this outside of dm-crypt. > > Sorry, the last discussion was that it remains inside dm-crypt > and it will be only registered through crypto API. > > And this for all files: > > > + * Copyright (C) 2018, Linaro > > It is NOT YOUR code! Please keep copyright and authors as in dm-crypt. > > Milan > > > > > Interface to the crypto layer - include/crypto/geniv.h > > > > This patch is based on the patchset originally started by > > Binoy Jayan > > ( crypto: Add IV generation algorithms > > https://patchwork.kernel.org/patch/9803469/ ) > > > > Signed-off-by: Binoy Jayan > > Signed-off-by: Xiongfeng Wang > > --- > > crypto/Kconfig | 7 + > > crypto/Makefile | 1 + > > crypto/geniv.c | 2240 ++++++++++++++++++++++++++++++++++++++++++++++++ > > include/crypto/geniv.h | 47 + > > 4 files changed, 2295 insertions(+) > > create mode 100644 crypto/geniv.c > > create mode 100644 include/crypto/geniv.h > > > > diff --git a/crypto/Kconfig b/crypto/Kconfig > > index f3e40ac..98f025a 100644 > > --- a/crypto/Kconfig > > +++ b/crypto/Kconfig > > @@ -257,6 +257,13 @@ config CRYPTO_GLUE_HELPER_X86 > > config CRYPTO_ENGINE > > tristate > > > > +config CRYPTO_GENIV > > + tristate "IV Generator Template" > > + select CRYPTO_AEAD > > + select CRYPTO_BLKCIPHER > > + help > > + Support for IV generator template, so that dm-crypt can rely on it. > > + > > comment "Authenticated Encryption with Associated Data" > > > > config CRYPTO_CCM > > diff --git a/crypto/Makefile b/crypto/Makefile > > index 6d1d40e..1077d2f 100644 > > --- a/crypto/Makefile > > +++ b/crypto/Makefile > > @@ -23,6 +23,7 @@ crypto_blkcipher-y += skcipher.o > > obj-$(CONFIG_CRYPTO_BLKCIPHER2) += crypto_blkcipher.o > > obj-$(CONFIG_CRYPTO_SEQIV) += seqiv.o > > obj-$(CONFIG_CRYPTO_ECHAINIV) += echainiv.o > > +obj-$(CONFIG_CRYPTO_GENIV) += geniv.o > > > > crypto_hash-y += ahash.o > > crypto_hash-y += shash.o > > diff --git a/crypto/geniv.c b/crypto/geniv.c > > new file mode 100644 > > index 0000000..55d1212 > > --- /dev/null > > +++ b/crypto/geniv.c > > @@ -0,0 +1,2240 @@ > > +// SPDX-License-Identifier: GPL-2.0 > > +/* > > + * geniv.c - crypto template for generating IV > > + * > > + * Copyright (C) 2018, Linaro > > + * > > + * This file adds a crypto template to generate IV, so the dm-crypt can rely > > + * on it and remove the existing generating IV code. > > + */ > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include /* for struct rtattr and RTA macros only */ > > +#include > > +#include > > +#include > > +#include > > + > > +#define DM_MSG_PREFIX "crypt" I agree with Milan, the code should remain where it currently is. If you want to plumb in generic access to it fine. But crypto/geniv.c has _no_ business defining DM_MSG_PREFIX. And I'm sure there are other things that have no place in generic crypto code. Mike