From: Jean-Luc Cooke <jlcooke@certainkey.com>
To: Christophe Saout <christophe@saout.de>
Cc: Andrew Morton <akpm@osdl.org>,
jmorris@intercode.com.au, linux-kernel@vger.kernel.org
Subject: Re: cryptoapi highmem bug
Date: Wed, 25 Feb 2004 16:52:39 -0500 [thread overview]
Message-ID: <20040225215239.GB7731@certainkey.com> (raw)
In-Reply-To: <20040225213647.GB6587@leto.cs.pocnet.net>
On Wed, Feb 25, 2004 at 10:36:48PM +0100, Christophe Saout wrote:
> On Wed, Feb 25, 2004 at 03:46:51PM -0500, Jean-Luc Cooke wrote:
>
> > > > Can we do this?
> > >
> > > It's very non-trivial. Think about journalling filesystems, write
> > > ordering and atomicity. If the system crashes between two write
> > > operations we must be able to still correctly read the data. And
> > > write to these "crypto info blocks" should be done in a ways that
> > > doesn't kill performance. Do you have a proposal?
> >
> > I see. From a security point of view, no. OMACs need to be updated after
> > the data is updated to keep integrity checks passing.
>
> Yes. But if the machine doesn't get to update the OMAC but the data has
> already been written you must be able to still read the data somehow.
Agreed. Some magic is needed here.
> > IVs need to be updated before the data is updated or plaintext is leaked.
>
> Hmm? What could be done: The IV "sequence number" is incremented by one
> every time a sector gets written. The IV sequence numbers get written
> to the info block later (after a timeout, memory pressure and we to
> free some space in the cache or if the sequence has gone too far). When
> we read and the OMAC doesn't match we can try to increase the IV
> several times until it matches. Still the problem with the OMAC
> atomicity...
At mkfs, each block is given IV=HMAC(Key,blockNum). Every time data is written
to the block, encrypt with IV'=IV+1 and store IV'.
Donno if I like the "if at first we don't succeed, try try again" approach.
But you know better then I do how difficult caching info blocks will be.
> > (IV + data + OMAC can be written to device at once).
>
> You can't guarantee that anything gets written at once. You can only
> make sure that something has been written. Or that something gets
> written before something else (using barriers, but I don't know if that
> is stable, it has never been used on bio level yet).
Caching sounds like a good way out. Always consult the cache struct with a
lock for each N-blocks in the FS to reduce bottleneck-ing and let the cache
update at a sensible interval. ...or am I talking black (block?) magic of the
worst kind here?
How about we set a goal for ourselves saying "we're prepared to accept X
performance degradation for encrypted file systems"?
> > I assume then that IVs and OMACs will not be stored in the same read-chunk as
> > the data then? Bummer if this is the case.
>
> Well, we can't store it in the same sector because all 512 bytes are
> already used data.
>
> We could store less than 512 bytes in a sector but that would mean
> splitting up data on a sub-sector level. That means we have to read
> some sectors with untouched data (the first and the last), update
> the data and write several sectors. But then we can't even guarantee
> that sectors are atomicically written as seen by the filesystem.
> This is... yuck.
The "try try again" approach maybe our only way. Yet, if someone reads data
from the FS and the IV wasn't written to disk yet (or ever in the case of a
crash) then incrementing will not solve anything. Screwed again.
JLC - will think about this on the bus ride home.
--
http://www.certainkey.com
Suite 4560 CTTC
1125 Colonel By Dr.
Ottawa ON, K1S 5B6
prev parent reply other threads:[~2004-02-25 22:05 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-24 20:49 cryptoapi highmem bug Christophe Saout
2004-02-24 22:34 ` Jean-Luc Cooke
2004-02-24 23:01 ` Christophe Saout
2004-02-25 4:32 ` Jean-Luc Cooke
2004-02-25 6:00 ` Andrew Morton
2004-02-25 13:27 ` James Morris
2004-02-25 15:17 ` Jean-Luc Cooke
2004-02-25 19:50 ` Andrew Morton
2004-02-25 21:27 ` Christophe Saout
2004-02-25 21:41 ` Jean-Luc Cooke
2004-02-25 22:55 ` [PATCH 1/2] move scatterwalk functions to own file Christophe Saout
2004-02-25 22:55 ` [PATCH 2/2] fix in-place de/encryption bug with highmem Christophe Saout
2004-02-26 4:13 ` James Morris
2004-02-26 11:03 ` Christophe Saout
2004-02-25 15:31 ` cryptoapi highmem bug Christophe Saout
2004-02-25 15:51 ` Christophe Saout
2004-02-25 15:44 ` Jean-Luc Cooke
2004-02-25 16:13 ` Christophe Saout
2004-02-25 16:09 ` Jean-Luc Cooke
2004-02-25 18:11 ` cryptoapi OMAC (was: cryptoapi highmem bug) Christophe Saout
2004-02-25 20:59 ` Jean-Luc Cooke
2004-02-25 21:44 ` Christophe Saout
2004-02-25 18:15 ` cryptoapi highmem bug Christophe Saout
2004-02-25 20:12 ` Jean-Luc Cooke
2004-02-25 20:39 ` Christophe Saout
2004-02-25 20:46 ` Jean-Luc Cooke
2004-02-25 21:36 ` Christophe Saout
2004-02-25 21:52 ` Jean-Luc Cooke [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=20040225215239.GB7731@certainkey.com \
--to=jlcooke@certainkey.com \
--cc=akpm@osdl.org \
--cc=christophe@saout.de \
--cc=jmorris@intercode.com.au \
--cc=linux-kernel@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