All of lore.kernel.org
 help / color / mirror / Atom feed
From: Will Drewry <redpig@dataspill.org>
To: "Kasatkin, Dmitry" <dmitry.kasatkin@intel.com>
Cc: device-mapper development <dm-devel@redhat.com>,
	alan.cox@intel.com, linux-fsdevel@vger.kernel.org,
	akpm@linux-foundation.org, "Alasdair G. Kergon" <agk@redhat.com>,
	Milan Broz <mbroz@redhat.com>
Subject: Re: [dm-devel] dm-integrity: integrity protection device-mapper target
Date: Sun, 27 Jan 2013 19:43:21 -0600	[thread overview]
Message-ID: <CABmXcB8-kByR6GOT-q+qn_-8dARKWS9vqOdZjmwnn_RZ+ynpHQ@mail.gmail.com> (raw)
In-Reply-To: <CALLzPKb1niHhUXP=Pn7_2JLWtkkJxGrnEz17Da=9OHiA8SQiCg@mail.gmail.com>

On Wed, Jan 23, 2013 at 4:20 AM, Kasatkin, Dmitry
<dmitry.kasatkin@intel.com> wrote:
> On Wed, Jan 23, 2013 at 8:09 AM, Will Drewry <redpig@dataspill.org> wrote:
>> On Tue, Jan 22, 2013 at 5:29 PM, Mikulas Patocka <mpatocka@redhat.com> wrote:
>>> On Fri, 18 Jan 2013, Kasatkin, Dmitry wrote:
>>>> Hi Mikulas,
>>>>
>>>> Thanks for looking into it.
>>>>
>>>> On Thu, Jan 17, 2013 at 6:54 AM, Mikulas Patocka <mpatocka@redhat.com> wrote:
[snip]
>>> Can the attacker modify the partition with hashes? - or do you store it in
>>> another place that is supposed to be secure?
>>
>> Given that HMACs are being used to authenticate blocks, I'd assume,
>> until corrected, that the HMACs aren't required to be on secure
>> storage.  To that end, it seems like there is a distinct risk that an
>> attacker could use old data blocks and old HMACs to construct an
>> "authentic" dm-integrity target that doesn't match anything the
>> user/TPM ever saw in aggregate before.  Perhaps I missed something
>> when I skimmed the code, but it doesn't seem trivial to version the
>> data or bind them to a large enough group of adjacent blocks without
>> paying more computational costs (like using a Merkle tree with an
>> HMAC'd root node). Technically, all the blocks would still be
>> authentic, but the ordering in time and space wouldn't be. I'd love to
>> know what ideas you have for that, or if that sort of attack is out of
>> scope?  For ordering in space, inclusion of the sector index in the
>> HMAC might help.
>>
>
> Hello,
>
> Yes. You are right. All is about computational and IO costs.
> "In time" is really hard to manage. The key is the same and there is a
> possibility to
> replace the blocks with older block.
>
> But this is a case with encryption as well. right?

I'm not a crypto-expert, but it all depends on if blocks are
interrelated in any way (and thus the algorithm and configuration).
Of course, encryption and integrity are often separate for a reason :)

The 'in time' problem is tricky, but I guess this is a good reason to
extend dm-verity to also have a kernel-supported write mode.  It could
be used as an alternative to the hmac'd block approach (with a
TPM/whatever-signed root hash) to achieve both in-time and in-space
resilience.  Of course, the user would need to decide on the cost then
-- more I/O+CPU versus their risk tolerance.

> "in space" - it is easier. As you said sector index might be used like
> with encryption.
> Please have a look to dm_int_calc_hmac(). It uses already offset in
> calculations..
>
>         err = crypto_shash_init(&desc.shash);
>         if (!err)
>                 err = crypto_shash_update(&desc.shash, digest, size);
>         if (!err)
>                 err = crypto_shash_finup(&desc.shash, (u8 *)&offset,
>                                           sizeof(offset), hmac);

Nice - I misread that!  At least that keeps replays pinned to the same
block index for direct replays.

cheers!
will

  reply	other threads:[~2013-01-28  1:43 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-17  4:54 dm-integrity: integrity protection device-mapper target Mikulas Patocka
2013-01-18 21:43 ` Kasatkin, Dmitry
2013-01-18 23:16   ` Alasdair G Kergon
2013-01-18 23:58     ` Kasatkin, Dmitry
2013-01-21 13:51       ` Alan Cox
2013-01-21 13:51         ` Alan Cox
2013-01-21 10:37     ` Kasatkin, Dmitry
2013-01-21 10:38     ` Kasatkin, Dmitry
2013-01-23  1:29   ` Mikulas Patocka
2013-01-23  6:09     ` [dm-devel] " Will Drewry
2013-01-23 10:20       ` Kasatkin, Dmitry
2013-01-28  1:43         ` Will Drewry [this message]
2013-01-23  9:15     ` Spelic
2013-01-23 10:19     ` Kasatkin, Dmitry
2013-01-23 10:19       ` Kasatkin, Dmitry

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=CABmXcB8-kByR6GOT-q+qn_-8dARKWS9vqOdZjmwnn_RZ+ynpHQ@mail.gmail.com \
    --to=redpig@dataspill.org \
    --cc=agk@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=alan.cox@intel.com \
    --cc=dm-devel@redhat.com \
    --cc=dmitry.kasatkin@intel.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=mbroz@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 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.