From: Milan Broz <gmazyland@gmail.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>, linux-crypto@vger.kernel.org
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
Eric Biggers <ebiggers@google.com>,
dm-devel@redhat.com, linux-fscrypt@vger.kernel.org,
Gilad Ben-Yossef <gilad@benyossef.com>
Subject: Re: [PATCH v6 4/7] md: dm-crypt: switch to ESSIV crypto API template
Date: Mon, 1 Jul 2019 10:59:51 +0200 [thread overview]
Message-ID: <f068888f-1a13-babf-0144-07939a79d9d9@gmail.com> (raw)
In-Reply-To: <20190628152112.914-5-ard.biesheuvel@linaro.org>
On 28/06/2019 17:21, Ard Biesheuvel wrote:
> Replace the explicit ESSIV handling in the dm-crypt driver with calls
> into the crypto API, which now possesses the capability to perform
> this processing within the crypto subsystem.
>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> drivers/md/dm-crypt.c | 200 ++++----------------
...
> -/* Wipe salt and reset key derived from volume key */
> -static int crypt_iv_essiv_wipe(struct crypt_config *cc)
Do I understand it correctly, that this is now called inside the whole cipher
set key in wipe command (in crypt_wipe_key())?
(Wipe message is meant to suspend the device and wipe all key material
from memory without actually destroying the device.)
> -{
> - struct iv_essiv_private *essiv = &cc->iv_gen_private.essiv;
> - unsigned salt_size = crypto_shash_digestsize(essiv->hash_tfm);
> - struct crypto_cipher *essiv_tfm;
> - int r, err = 0;
> -
> - memset(essiv->salt, 0, salt_size);
> -
> - essiv_tfm = cc->iv_private;
> - r = crypto_cipher_setkey(essiv_tfm, essiv->salt, salt_size);
> - if (r)
> - err = r;
> -
> - return err;
> -}
...
> @@ -2435,9 +2281,19 @@ static int crypt_ctr_cipher_new(struct dm_target *ti, char *cipher_in, char *key
> }
>
> ret = crypt_ctr_blkdev_cipher(cc, cipher_api);
> - if (ret < 0) {
> - ti->error = "Cannot allocate cipher string";
> - return -ENOMEM;
> + if (ret < 0)
> + goto bad_mem;
> +
> + if (*ivmode && !strcmp(*ivmode, "essiv")) {
> + if (!*ivopts) {
> + ti->error = "Digest algorithm missing for ESSIV mode";
> + return -EINVAL;
> + }
> + ret = snprintf(buf, CRYPTO_MAX_ALG_NAME, "essiv(%s,%s,%s)",
> + cipher_api, cc->cipher, *ivopts);
> + if (ret < 0 || ret >= CRYPTO_MAX_ALG_NAME)
> + goto bad_mem;
Hm, nitpicking, but goto from only one place while we have another -ENOMEM above...
Just place this here without goto?
> + ti->error = "Cannot allocate cipher string";
> + return -ENOMEM;
Otherwise
Reviewed-by: Milan Broz <gmazyland@gmail.com>
Thanks,
Milan
next prev parent reply other threads:[~2019-07-01 8:59 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-28 15:21 [PATCH v6 0/7] crypto: switch to crypto API for ESSIV generation Ard Biesheuvel
2019-06-28 15:21 ` [PATCH v6 1/7] crypto: essiv - create wrapper template " Ard Biesheuvel
2019-06-29 4:23 ` Eric Biggers
2019-06-28 15:21 ` [PATCH v6 2/7] fs: crypto: invoke crypto API for ESSIV handling Ard Biesheuvel
2019-06-28 18:00 ` Eric Biggers
2019-06-28 18:09 ` Ard Biesheuvel
2019-06-28 15:21 ` [PATCH v6 3/7] md: dm-crypt: infer ESSIV block cipher from cipher string directly Ard Biesheuvel
2019-07-01 8:58 ` Milan Broz
2019-06-28 15:21 ` [PATCH v6 4/7] md: dm-crypt: switch to ESSIV crypto API template Ard Biesheuvel
2019-07-01 8:59 ` Milan Broz [this message]
2019-07-02 8:07 ` [dm-devel] " Ard Biesheuvel
2019-07-02 16:30 ` Ard Biesheuvel
2019-06-28 15:21 ` [PATCH v6 5/7] crypto: essiv - add test vector for essiv(cbc(aes),aes,sha256) Ard Biesheuvel
2019-06-28 15:21 ` [PATCH v6 6/7] crypto: arm64/aes-cts-cbc - factor out CBC en/decryption of a walk Ard Biesheuvel
2019-06-28 15:21 ` [PATCH v6 7/7] crypto: arm64/aes - implement accelerated ESSIV/CBC mode 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=f068888f-1a13-babf-0144-07939a79d9d9@gmail.com \
--to=gmazyland@gmail.com \
--cc=ard.biesheuvel@linaro.org \
--cc=dm-devel@redhat.com \
--cc=ebiggers@google.com \
--cc=gilad@benyossef.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox