Linux RAID subsystem development
 help / color / mirror / Atom feed
From: Milan Broz <gmazyland@gmail.com>
To: Gilad Ben-Yossef <gilad@benyossef.com>,
	Alasdair Kergon <agk@redhat.com>,
	Mike Snitzer <snitzer@redhat.com>,
	dm-devel@redhat.com, Shaohua Li <shli@kernel.org>
Cc: linux-raid@vger.kernel.org, Marian Csontos <mcsontos@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dm verity: fix no salt used use case
Date: Thu, 18 May 2017 13:03:06 +0200	[thread overview]
Message-ID: <9b872fad-6ae3-4709-d744-1f4686f070b9@gmail.com> (raw)
In-Reply-To: <1495104445-29753-1-git-send-email-gilad@benyossef.com>


On 05/18/2017 12:47 PM, Gilad Ben-Yossef wrote:
> DM-Verity has an (undocumented) mode where no salt is used.
> This was never handled directly by the DM-Verity code, instead working due
> to the fact that calling crypto_shash_update() with a zero length data is
> an implicit noop.
> 
> This is no longer the case now that we have switched to
> crypto_ahash_update(). Fix the issue by introducing an explicit handling
> of the no salt use case to DM-Verity.
> 
> Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
> Reported-by: Marian Csontos <mcsontos@redhat.com>
> Fixes: d1ac3ff ("dm verity: switch to using asynchronous hash crypto API")
> CC: Milan Broz <gmazyland@gmail.com>

Tested-by: Milan Broz <gmazyland@gmail.com>

Thanks for quick fix!

Mike: this must go to 4.12rc (only).

m.


> ---
>  drivers/md/dm-verity-target.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c
> index 97de961..1ec9b2c 100644
> --- a/drivers/md/dm-verity-target.c
> +++ b/drivers/md/dm-verity-target.c
> @@ -166,7 +166,7 @@ static int verity_hash_init(struct dm_verity *v, struct ahash_request *req,
>  		return r;
>  	}
>  
> -	if (likely(v->version >= 1))
> +	if (likely(v->salt_size && (v->version >= 1)))
>  		r = verity_hash_update(v, req, v->salt, v->salt_size, res);
>  
>  	return r;
> @@ -177,7 +177,7 @@ static int verity_hash_final(struct dm_verity *v, struct ahash_request *req,
>  {
>  	int r;
>  
> -	if (unlikely(!v->version)) {
> +	if (unlikely(v->salt_size && (!v->version))) {
>  		r = verity_hash_update(v, req, v->salt, v->salt_size, res);
>  
>  		if (r < 0) {
> 

      reply	other threads:[~2017-05-18 11:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-18 10:47 [PATCH] dm verity: fix no salt used use case Gilad Ben-Yossef
2017-05-18 11:03 ` Milan Broz [this message]

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=9b872fad-6ae3-4709-d744-1f4686f070b9@gmail.com \
    --to=gmazyland@gmail.com \
    --cc=agk@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=gilad@benyossef.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=mcsontos@redhat.com \
    --cc=shli@kernel.org \
    --cc=snitzer@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox