Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1644069 > unrolled thread
| Started by | Gilad Ben-Yossef <gilad@benyossef.com> |
|---|---|
| First post | 2017-05-18 12:50 +0200 |
| Last post | 2017-05-18 13:10 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] dm verity: fix no salt used use case Gilad Ben-Yossef <gilad@benyossef.com> - 2017-05-18 12:50 +0200
Re: [PATCH] dm verity: fix no salt used use case Milan Broz <gmazyland@gmail.com> - 2017-05-18 13:10 +0200
| From | Gilad Ben-Yossef <gilad@benyossef.com> |
|---|---|
| Date | 2017-05-18 12:50 +0200 |
| Subject | [PATCH] dm verity: fix no salt used use case |
| Message-ID | <tIrai-18m-1@gated-at.bofh.it> |
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>
---
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) {
--
2.1.4
[toc] | [next] | [standalone]
| From | Milan Broz <gmazyland@gmail.com> |
|---|---|
| Date | 2017-05-18 13:10 +0200 |
| Message-ID | <tIrtG-1zL-79@gated-at.bofh.it> |
| In reply to | #1644069 |
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) {
>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web