Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp512887imm; Wed, 18 Jul 2018 06:13:05 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcy9bsTrSGOZWomu6DG8QwJEprVMShiABvs+fDHnzD829QcsTMg53xqzQj2Mss4PRT5LUGk X-Received: by 2002:a63:4a07:: with SMTP id x7-v6mr5849041pga.34.1531919584998; Wed, 18 Jul 2018 06:13:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531919584; cv=none; d=google.com; s=arc-20160816; b=ObMGbxNRJR220twudqEVtjmLKMOzHvVhe8QCu5SIFokP9hxVmdLMtl+sGzCnNRv+O0 klUaaKx4FTpjiLvEUkkKBgDdVX1/WHd04pSol9hbtQaKHx8B1I3m0Q8tBbD8MGOE1AcB 7vtyCcUmc0HbmLTAdwoyveXf7hSQReQuGn8lAsxti88FJAiU3vjwHygXDdePWTcd4gzn TfoFWPbUrS6yCFpB6bi+J1TFS1omhx2ZpeSf58D559MiyyhPqnXlxMYTo4Z0hahCaXx3 m3e3/2Ben5TVAukz1WZrGjOZxz1Z7NknJiPnhlEtFvV7If0dssJE++tfTfKvHxUPOieh ue6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=73aU3sbwCUpzwbd4KzZU45Gu5uPm8cCXqfPh6VqSNTs=; b=LBym/jt0hvqY8VI7tDNDaYtwH2gBfkoybsef+IT4H12CQf4bAZa8Gtj43q0MYxBvqP U8SOWqx3t6WlQMBbR0MRsOFu0geQU5zd0+72y98B1nyNaOA5qovHBQjLS2wPs88URdNT jj7c0/RD1eE3n7zUB1d/uz5LbNkXiqFGlrrTiH2EFemCYntJ/XvgHwpj8xk5WQZGJA7W KsFWRwcCte5cZPMLcuV/vT2otrA5uLWG4zFzRISZupGjvEW8GfZQqOtLkye+8rBUZrwk MvffJhlwccPCn09XQzorjK0WZnrzImyVquhIGuqcL/DrJoRX13NCM+bY5mPX16VAdpIg KLGQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d192-v6si3226811pgc.504.2018.07.18.06.12.50; Wed, 18 Jul 2018 06:13:04 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730470AbeGRNtq (ORCPT + 99 others); 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