From: Eric Biggers <ebiggers@kernel.org>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
linux-fscrypt@vger.kernel.org,
Gilad Ben-Yossef <gilad@benyossef.com>,
dm-devel@redhat.com, linux-crypto@vger.kernel.org,
Milan Broz <gmazyland@gmail.com>
Subject: Re: [PATCH v10 1/7] crypto: essiv - create wrapper template for ESSIV generation
Date: Mon, 12 Aug 2019 12:38:50 -0700 [thread overview]
Message-ID: <20190812193849.GA131059@gmail.com> (raw)
In-Reply-To: <20190812145324.27090-2-ard.biesheuvel@linaro.org>
On Mon, Aug 12, 2019 at 05:53:18PM +0300, Ard Biesheuvel wrote:
> + switch (type) {
> + case CRYPTO_ALG_TYPE_BLKCIPHER:
> + skcipher_inst = kzalloc(sizeof(*skcipher_inst) +
> + sizeof(*ictx), GFP_KERNEL);
> + if (!skcipher_inst)
> + return -ENOMEM;
> + inst = skcipher_crypto_instance(skcipher_inst);
> + base = &skcipher_inst->alg.base;
> + ictx = crypto_instance_ctx(inst);
> +
> + /* Block cipher, e.g. "cbc(aes)" */
> + crypto_set_skcipher_spawn(&ictx->u.skcipher_spawn, inst);
> + err = crypto_grab_skcipher(&ictx->u.skcipher_spawn,
> + inner_cipher_name, 0,
> + crypto_requires_sync(algt->type,
> + algt->mask));
> + if (err)
> + goto out_free_inst;
This should say "Symmetric cipher", not "Block cipher".
> +
> + if (!parse_cipher_name(essiv_cipher_name, block_base->cra_name)) {
> + pr_warn("Failed to parse ESSIV cipher name from skcipher cra_name\n");
> + goto out_drop_skcipher;
> + }
This is missing:
err = -EINVAL;
> + if (type == CRYPTO_ALG_TYPE_BLKCIPHER) {
> + skcipher_inst->alg.setkey = essiv_skcipher_setkey;
> + skcipher_inst->alg.encrypt = essiv_skcipher_encrypt;
> + skcipher_inst->alg.decrypt = essiv_skcipher_decrypt;
> + skcipher_inst->alg.init = essiv_skcipher_init_tfm;
> + skcipher_inst->alg.exit = essiv_skcipher_exit_tfm;
> +
> + skcipher_inst->alg.min_keysize = crypto_skcipher_alg_min_keysize(skcipher_alg);
> + skcipher_inst->alg.max_keysize = crypto_skcipher_alg_max_keysize(skcipher_alg);
> + skcipher_inst->alg.ivsize = crypto_skcipher_alg_ivsize(skcipher_alg);
> + skcipher_inst->alg.chunksize = crypto_skcipher_alg_chunksize(skcipher_alg);
> + skcipher_inst->alg.walksize = crypto_skcipher_alg_walksize(skcipher_alg);
> +
> + skcipher_inst->free = essiv_skcipher_free_instance;
> +
> + err = skcipher_register_instance(tmpl, skcipher_inst);
> + } else {
> + aead_inst->alg.setkey = essiv_aead_setkey;
> + aead_inst->alg.setauthsize = essiv_aead_setauthsize;
> + aead_inst->alg.encrypt = essiv_aead_encrypt;
> + aead_inst->alg.decrypt = essiv_aead_decrypt;
> + aead_inst->alg.init = essiv_aead_init_tfm;
> + aead_inst->alg.exit = essiv_aead_exit_tfm;
> +
> + aead_inst->alg.ivsize = crypto_aead_alg_ivsize(aead_alg);
> + aead_inst->alg.maxauthsize = crypto_aead_alg_maxauthsize(aead_alg);
> + aead_inst->alg.chunksize = crypto_aead_alg_chunksize(aead_alg);
> +
> + aead_inst->free = essiv_aead_free_instance;
> +
> + err = aead_register_instance(tmpl, aead_inst);
> + }
'ivsize' is already in a variable, so could use
skcipher_inst->alg.ivsize = ivsize;
and
aead_inst->alg.ivsize = ivsize;
- Eric
WARNING: multiple messages have this Message-ID (diff)
From: Eric Biggers <ebiggers@kernel.org>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: linux-crypto@vger.kernel.org,
Herbert Xu <herbert@gondor.apana.org.au>,
dm-devel@redhat.com, linux-fscrypt@vger.kernel.org,
Gilad Ben-Yossef <gilad@benyossef.com>,
Milan Broz <gmazyland@gmail.com>
Subject: Re: [PATCH v10 1/7] crypto: essiv - create wrapper template for ESSIV generation
Date: Mon, 12 Aug 2019 12:38:50 -0700 [thread overview]
Message-ID: <20190812193849.GA131059@gmail.com> (raw)
In-Reply-To: <20190812145324.27090-2-ard.biesheuvel@linaro.org>
On Mon, Aug 12, 2019 at 05:53:18PM +0300, Ard Biesheuvel wrote:
> + switch (type) {
> + case CRYPTO_ALG_TYPE_BLKCIPHER:
> + skcipher_inst = kzalloc(sizeof(*skcipher_inst) +
> + sizeof(*ictx), GFP_KERNEL);
> + if (!skcipher_inst)
> + return -ENOMEM;
> + inst = skcipher_crypto_instance(skcipher_inst);
> + base = &skcipher_inst->alg.base;
> + ictx = crypto_instance_ctx(inst);
> +
> + /* Block cipher, e.g. "cbc(aes)" */
> + crypto_set_skcipher_spawn(&ictx->u.skcipher_spawn, inst);
> + err = crypto_grab_skcipher(&ictx->u.skcipher_spawn,
> + inner_cipher_name, 0,
> + crypto_requires_sync(algt->type,
> + algt->mask));
> + if (err)
> + goto out_free_inst;
This should say "Symmetric cipher", not "Block cipher".
> +
> + if (!parse_cipher_name(essiv_cipher_name, block_base->cra_name)) {
> + pr_warn("Failed to parse ESSIV cipher name from skcipher cra_name\n");
> + goto out_drop_skcipher;
> + }
This is missing:
err = -EINVAL;
> + if (type == CRYPTO_ALG_TYPE_BLKCIPHER) {
> + skcipher_inst->alg.setkey = essiv_skcipher_setkey;
> + skcipher_inst->alg.encrypt = essiv_skcipher_encrypt;
> + skcipher_inst->alg.decrypt = essiv_skcipher_decrypt;
> + skcipher_inst->alg.init = essiv_skcipher_init_tfm;
> + skcipher_inst->alg.exit = essiv_skcipher_exit_tfm;
> +
> + skcipher_inst->alg.min_keysize = crypto_skcipher_alg_min_keysize(skcipher_alg);
> + skcipher_inst->alg.max_keysize = crypto_skcipher_alg_max_keysize(skcipher_alg);
> + skcipher_inst->alg.ivsize = crypto_skcipher_alg_ivsize(skcipher_alg);
> + skcipher_inst->alg.chunksize = crypto_skcipher_alg_chunksize(skcipher_alg);
> + skcipher_inst->alg.walksize = crypto_skcipher_alg_walksize(skcipher_alg);
> +
> + skcipher_inst->free = essiv_skcipher_free_instance;
> +
> + err = skcipher_register_instance(tmpl, skcipher_inst);
> + } else {
> + aead_inst->alg.setkey = essiv_aead_setkey;
> + aead_inst->alg.setauthsize = essiv_aead_setauthsize;
> + aead_inst->alg.encrypt = essiv_aead_encrypt;
> + aead_inst->alg.decrypt = essiv_aead_decrypt;
> + aead_inst->alg.init = essiv_aead_init_tfm;
> + aead_inst->alg.exit = essiv_aead_exit_tfm;
> +
> + aead_inst->alg.ivsize = crypto_aead_alg_ivsize(aead_alg);
> + aead_inst->alg.maxauthsize = crypto_aead_alg_maxauthsize(aead_alg);
> + aead_inst->alg.chunksize = crypto_aead_alg_chunksize(aead_alg);
> +
> + aead_inst->free = essiv_aead_free_instance;
> +
> + err = aead_register_instance(tmpl, aead_inst);
> + }
'ivsize' is already in a variable, so could use
skcipher_inst->alg.ivsize = ivsize;
and
aead_inst->alg.ivsize = ivsize;
- Eric
WARNING: multiple messages have this Message-ID (diff)
From: Eric Biggers <ebiggers@kernel.org>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
linux-fscrypt@vger.kernel.org,
Gilad Ben-Yossef <gilad@benyossef.com>,
dm-devel@redhat.com, linux-crypto@vger.kernel.org,
Milan Broz <gmazyland@gmail.com>
Subject: Re: [dm-devel] [PATCH v10 1/7] crypto: essiv - create wrapper template for ESSIV generation
Date: Mon, 12 Aug 2019 12:38:50 -0700 [thread overview]
Message-ID: <20190812193849.GA131059@gmail.com> (raw)
In-Reply-To: <20190812145324.27090-2-ard.biesheuvel@linaro.org>
On Mon, Aug 12, 2019 at 05:53:18PM +0300, Ard Biesheuvel wrote:
> + switch (type) {
> + case CRYPTO_ALG_TYPE_BLKCIPHER:
> + skcipher_inst = kzalloc(sizeof(*skcipher_inst) +
> + sizeof(*ictx), GFP_KERNEL);
> + if (!skcipher_inst)
> + return -ENOMEM;
> + inst = skcipher_crypto_instance(skcipher_inst);
> + base = &skcipher_inst->alg.base;
> + ictx = crypto_instance_ctx(inst);
> +
> + /* Block cipher, e.g. "cbc(aes)" */
> + crypto_set_skcipher_spawn(&ictx->u.skcipher_spawn, inst);
> + err = crypto_grab_skcipher(&ictx->u.skcipher_spawn,
> + inner_cipher_name, 0,
> + crypto_requires_sync(algt->type,
> + algt->mask));
> + if (err)
> + goto out_free_inst;
This should say "Symmetric cipher", not "Block cipher".
> +
> + if (!parse_cipher_name(essiv_cipher_name, block_base->cra_name)) {
> + pr_warn("Failed to parse ESSIV cipher name from skcipher cra_name\n");
> + goto out_drop_skcipher;
> + }
This is missing:
err = -EINVAL;
> + if (type == CRYPTO_ALG_TYPE_BLKCIPHER) {
> + skcipher_inst->alg.setkey = essiv_skcipher_setkey;
> + skcipher_inst->alg.encrypt = essiv_skcipher_encrypt;
> + skcipher_inst->alg.decrypt = essiv_skcipher_decrypt;
> + skcipher_inst->alg.init = essiv_skcipher_init_tfm;
> + skcipher_inst->alg.exit = essiv_skcipher_exit_tfm;
> +
> + skcipher_inst->alg.min_keysize = crypto_skcipher_alg_min_keysize(skcipher_alg);
> + skcipher_inst->alg.max_keysize = crypto_skcipher_alg_max_keysize(skcipher_alg);
> + skcipher_inst->alg.ivsize = crypto_skcipher_alg_ivsize(skcipher_alg);
> + skcipher_inst->alg.chunksize = crypto_skcipher_alg_chunksize(skcipher_alg);
> + skcipher_inst->alg.walksize = crypto_skcipher_alg_walksize(skcipher_alg);
> +
> + skcipher_inst->free = essiv_skcipher_free_instance;
> +
> + err = skcipher_register_instance(tmpl, skcipher_inst);
> + } else {
> + aead_inst->alg.setkey = essiv_aead_setkey;
> + aead_inst->alg.setauthsize = essiv_aead_setauthsize;
> + aead_inst->alg.encrypt = essiv_aead_encrypt;
> + aead_inst->alg.decrypt = essiv_aead_decrypt;
> + aead_inst->alg.init = essiv_aead_init_tfm;
> + aead_inst->alg.exit = essiv_aead_exit_tfm;
> +
> + aead_inst->alg.ivsize = crypto_aead_alg_ivsize(aead_alg);
> + aead_inst->alg.maxauthsize = crypto_aead_alg_maxauthsize(aead_alg);
> + aead_inst->alg.chunksize = crypto_aead_alg_chunksize(aead_alg);
> +
> + aead_inst->free = essiv_aead_free_instance;
> +
> + err = aead_register_instance(tmpl, aead_inst);
> + }
'ivsize' is already in a variable, so could use
skcipher_inst->alg.ivsize = ivsize;
and
aead_inst->alg.ivsize = ivsize;
- Eric
--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
next prev parent reply other threads:[~2019-08-12 19:38 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-12 14:53 [PATCH v10 0/7] crypto: switch to crypto API for ESSIV generation Ard Biesheuvel
2019-08-12 14:53 ` Ard Biesheuvel
2019-08-12 14:53 ` [PATCH v10 1/7] crypto: essiv - create wrapper template " Ard Biesheuvel
2019-08-12 14:53 ` Ard Biesheuvel
2019-08-12 19:38 ` Eric Biggers [this message]
2019-08-12 19:38 ` [dm-devel] " Eric Biggers
2019-08-12 19:38 ` Eric Biggers
2019-08-13 5:17 ` Ard Biesheuvel
2019-08-12 14:53 ` [PATCH v10 2/7] fs: crypto: invoke crypto API for ESSIV handling Ard Biesheuvel
2019-08-12 14:53 ` Ard Biesheuvel
2019-08-12 19:47 ` Eric Biggers
2019-08-12 19:47 ` [dm-devel] " Eric Biggers
2019-08-12 19:47 ` Eric Biggers
2019-08-13 5:09 ` Ard Biesheuvel
2019-08-13 5:09 ` [dm-devel] " Ard Biesheuvel
2019-08-13 18:00 ` Eric Biggers
2019-08-13 18:00 ` [dm-devel] " Eric Biggers
2019-08-13 18:16 ` Ard Biesheuvel
2019-08-13 18:16 ` [dm-devel] " Ard Biesheuvel
2019-08-13 18:16 ` Ard Biesheuvel
2019-08-12 14:53 ` [PATCH v10 3/7] md: dm-crypt: switch to ESSIV crypto API template Ard Biesheuvel
2019-08-12 14:53 ` Ard Biesheuvel
2019-08-12 14:53 ` [PATCH v10 4/7] crypto: essiv - add tests for essiv in cbc(aes)+sha256 mode Ard Biesheuvel
2019-08-12 14:53 ` Ard Biesheuvel
2019-08-12 14:53 ` [PATCH v10 5/7] crypto: arm64/aes-cts-cbc - factor out CBC en/decryption of a walk Ard Biesheuvel
2019-08-12 14:53 ` Ard Biesheuvel
2019-08-12 14:53 ` [PATCH v10 6/7] crypto: arm64/aes - implement accelerated ESSIV/CBC mode Ard Biesheuvel
2019-08-12 14:53 ` [dm-devel] " Ard Biesheuvel
2019-08-12 14:53 ` Ard Biesheuvel
2019-08-12 14:53 ` [PATCH v10 7/7] md: dm-crypt: omit parsing of the encapsulated cipher Ard Biesheuvel
2019-08-12 14:53 ` [dm-devel] " Ard Biesheuvel
2019-08-12 14:53 ` 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=20190812193849.GA131059@gmail.com \
--to=ebiggers@kernel.org \
--cc=ard.biesheuvel@linaro.org \
--cc=dm-devel@redhat.com \
--cc=gilad@benyossef.com \
--cc=gmazyland@gmail.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-fscrypt@vger.kernel.org \
/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.