From: Mike Snitzer <snitzer@redhat.com>
To: Xiongfeng Wang <wangxiongfeng2@huawei.com>,
Milan Broz <gmazyland@gmail.com>
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
Date: Wed, 18 Jul 2018 09:11:52 -0400 [thread overview]
Message-ID: <20180718131152.GA25685@redhat.com> (raw)
In-Reply-To: <b6eaf471-7279-ca4f-bb7c-d25df8db2419@gmail.com>
On Wed, Jul 18 2018 at 4:16am -0400,
Milan Broz <gmazyland@gmail.com> 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 <binoy.jayan@linaro.org>
> > ( crypto: Add IV generation algorithms
> > https://patchwork.kernel.org/patch/9803469/ )
> >
> > Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org>
> > Signed-off-by: Xiongfeng Wang <wangxiongfeng2@linaro.org>
> > ---
> > 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 <linux/completion.h>
> > +#include <linux/err.h>
> > +#include <linux/module.h>
> > +#include <linux/init.h>
> > +#include <linux/kernel.h>
> > +#include <linux/key.h>
> > +#include <linux/bio.h>
> > +#include <linux/blkdev.h>
> > +#include <linux/mempool.h>
> > +#include <linux/slab.h>
> > +#include <linux/crypto.h>
> > +#include <linux/atomic.h>
> > +#include <linux/scatterlist.h>
> > +#include <linux/ctype.h>
> > +#include <asm/page.h>
> > +#include <asm/unaligned.h>
> > +#include <crypto/hash.h>
> > +#include <crypto/md5.h>
> > +#include <crypto/algapi.h>
> > +#include <crypto/skcipher.h>
> > +#include <crypto/aead.h>
> > +#include <crypto/authenc.h>
> > +#include <crypto/geniv.h>
> > +#include <crypto/internal/aead.h>
> > +#include <crypto/internal/skcipher.h>
> > +#include <linux/rtnetlink.h> /* for struct rtattr and RTA macros only */
> > +#include <keys/user-type.h>
> > +#include <linux/backing-dev.h>
> > +#include <linux/device-mapper.h>
> > +#include <linux/log2.h>
> > +
> > +#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
next prev parent reply other threads:[~2018-07-18 13:11 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-18 7:30 [PATCH 0/5] crypto: add IV generation templates Xiongfeng Wang
2018-07-18 7:30 ` Xiongfeng Wang
2018-07-18 7:30 ` [PATCH 1/5] crypto: api - introduce API to (un)register a array of templates Xiongfeng Wang
2018-07-18 7:30 ` Xiongfeng Wang
2018-07-18 7:30 ` [PATCH 2/5] crypto: ccm - use template array registering API to simplify the code Xiongfeng Wang
2018-07-18 7:30 ` Xiongfeng Wang
2018-07-18 7:30 ` [PATCH 3/5] crypto: gcm " Xiongfeng Wang
2018-07-18 7:30 ` Xiongfeng Wang
2018-07-18 7:30 ` [PATCH 4/5] crypto: Add IV generation templates Xiongfeng Wang
2018-07-18 7:30 ` Xiongfeng Wang
2018-07-18 8:16 ` Milan Broz
2018-07-18 8:48 ` Xiongfeng Wang
2018-07-18 8:48 ` Xiongfeng Wang
2018-07-18 13:11 ` Mike Snitzer [this message]
2018-07-18 16:46 ` Mark Brown
2018-07-18 17:17 ` Milan Broz
2018-07-18 17:47 ` Mark Brown
2018-07-19 1:46 ` Xiongfeng Wang
2018-07-19 1:46 ` Xiongfeng Wang
2018-07-19 8:50 ` Arnd Bergmann
2018-07-19 8:54 ` Herbert Xu
2018-07-19 13:30 ` Mark Brown
2018-07-19 18:14 ` kbuild test robot
2018-07-19 18:14 ` kbuild test robot
2018-07-18 7:30 ` [PATCH 5/5] dm-crypt: modify dm-crypt to rely on " Xiongfeng Wang
2018-07-18 7:30 ` Xiongfeng Wang
2018-07-18 10:59 ` [PATCH 0/5] crypto: add " Arnd Bergmann
2018-07-18 15:34 ` Ard Biesheuvel
2018-07-19 10:55 ` Xiongfeng Wang
2018-07-19 10:55 ` Xiongfeng Wang
2018-07-19 14:08 ` Ard Biesheuvel
2018-07-19 15:50 ` Mark Brown
2018-07-20 1:02 ` Ard Biesheuvel
2018-07-20 1:02 ` Ard Biesheuvel
2018-07-20 11:45 ` Mark Brown
2018-07-20 12:23 ` Ard Biesheuvel
2018-07-20 12:32 ` Mark Brown
2018-07-22 13:39 ` Gilad Ben-Yossef
2018-07-23 0:13 ` Ard Biesheuvel
2018-07-23 0:13 ` Ard Biesheuvel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180718131152.GA25685@redhat.com \
--to=snitzer@redhat.com \
--cc=agk@redhat.com \
--cc=arnd@arndb.de \
--cc=broonie@kernel.org \
--cc=dm-devel@redhat.com \
--cc=gmazyland@gmail.com \
--cc=herbert@gondor.apana.org.au \
--cc=jonathan.cameron@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=wangxiongfeng2@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.