DM-Crypt Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Nagie <promike1987@gmail.com>
To: dm-crypt@saout.de
Subject: Re: [dm-crypt] Basics
Date: Fri, 25 Sep 2015 23:48:34 +0200	[thread overview]
Message-ID: <20150925214834.GA5103@manjaro.chello.hu> (raw)
In-Reply-To: <20150925194446.GZ14230@yeono.kjorling.se>

Thank you very much for your detailed explanation. The whole thing is 
much clearer.

You and Arno convinced me. I might have taken it too seriously, but I 
really wanted to understand.

I'll probably use this command:
cryptsetup -v --cipher aes-xts-plain64 --key-size 512 --hash sha512 (or 
an other one I haven't decided yet) --iter-time (about) 2000 (I'm 
generous, about 2 secs seems fine) --use-random

Thank you again
Mike

On 15-09-25 19:44:46, Michael Kjörling wrote:
> On 25 Sep 2015 19:33 +0200, from promike1987@gmail.com (Mike Nagie):
> > So first thing; this is a 1TiB HDD. Do I need plain64? Or is there any 
> > drawbacks?
> 
> For optimal security you _must_ use the "plain64" variant for any
> container _larger than 2 TiB_. You _can_ use the "plain" variant for
> containers smaller than 2 TiB with no ill effects, but using "plain64"
> will not have any ill effects on a smaller container either.
> 
> I would recommend using "plain64" as a future-proofing measure.
> 
> 
> > Second: Everybody talks about the aes. It seems the twofish is faster 
> > here. Does this really matters? I mean this is a HDD, I guess it never 
> > does anything at that pace. (207MiB/s)
> 
> You can expect a theoretical maximum of about 100 MiB/s (+/- 20% or
> so) throughput from a 7200 rpm rotational HDD, which is most likely
> what you have (unless it's a laptop; then it might be slower).
> 
> I/O patterns are _very_ rarely limited by the maximum achievable
> sequential I/O throughput. In practice, you are much more likely to be
> limited by other software or by factors not related to sequential I/O
> throughput, such as the attainable I/O Operations Per Second (IOPS) of
> the hard drive (which is, theoretically, 120 IOPS for a 7200 rpm
> drive; in practice probably slightly less). IOPS is a function of the
> average seek time of the drive.
> 
> In other words: _any_ choice that gives you about 100 MiB/s or more
> will not be the part that bottlenecks your system when using a HDD to
> hold the LUKS container.
> 
> AES is a very widely studied cipher which so far has stood up well to
> analysis. If you don't have a _very specific_ reason to pick another,
> I would recommend that you just go with the flow.
> 
> 
> > Third: Since xts is supposed to be safer I think it's justified.
> 
> XTS should not be any less secure than CBC-ESSIV, and may be more
> secure.
> 
> Summarizing for your first three questions: The default is
> aes-xts-plain64 for a good reason.
> 
> 
> > Fourth: Key size I'm totally lost. Why 512b (even though it's splitted 
> > to 256) faster than the others? I'm sure something is not right with my theory 
> > else who would use 256b?! Do encrypted files bigger with 512b or 
> > what is the point here?
> 
> It might be that AES is hardware accellerated.
> 
> The key size has no impact on the size of the output of the cipher, so
> storage capacity is not affected by the choice of key length.
> 
> For a given cipher, I suggest using the longest key length that has
> sufficient performance for your scenario. Given that even 512-bit
> aes-xts gives you about 110 MiB/s throughput on your particular
> system, I see little reason to not go with that when using a
> HDD-backed container. Even when using a SSD for storage I would
> probably strongly consider it.
> 
> 
> > Fifth: Hash: I'm thinking about sha256.
> 
> I may be wrong here, but I think the hash is only used during
> passphrase to key derivation, and for the LUKS header (which is small
> enough that the speed of the cipher should be a non-issue). LUKS
> itself does not validate your "payload" data using a hash. SHA-256
> should be fine, SHA-512 might well be better, but neither is a poor
> choice IMO given what we know at this time. (Cryptography is an
> evolving field, but, pardon the pun, quantum leaps are rare.)
> 
> 
> > Sixth: iteration time. I misunderstood the benchmark. I thought 
> > sha256     391259 iterations per second
> > means 391259 iterations per second. However I set the iteration time to 
> > 391259 and well... it needless to say, it didn't open the encrypted 
> > partition in a second, more like in 10 minutes. So I have no idea how 
> > should I interpret this one.
> 
> No, the iteration time parameter to cryptsetup takes the _time in
> milliseconds_ to iterate the hash function. 391259 ms = 391 seconds or
> about 6.5 minutes. The exact time necessary each time you open the
> container may vary slightly depending on system load at the time.
> 
> If you want the luksOpen to take about a second, set the iteration
> time to 1000. If you check the resultant container using luksDump,
> that should show an iteration count in the neighborhood of 400,000
> iterations.
> 
> 
> > And lastly: --use-random or --use-urandom. I didn't get this one at all.
> 
> Use --use-random. It's really as simple as that.
> 
> The reasons why you might use --use-urandom do not apply to a regular
> desktop system.
> 
> -- 
> Michael Kjörling • https://michael.kjorling.se • michael@kjorling.se
> OpenPGP B501AC6429EF4514 https://michael.kjorling.se/public-keys/pgp
>                  “People who think they know everything really annoy
>                  those of us who know we don’t.” (Bjarne Stroustrup)
> _______________________________________________
> dm-crypt mailing list
> dm-crypt@saout.de
> http://www.saout.de/mailman/listinfo/dm-crypt

-- 
You are so lucky!

  parent reply	other threads:[~2015-09-25 21:48 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-25 17:33 [dm-crypt] Basics Mike Nagie
2015-09-25 17:55 ` Mistave
2015-09-25 19:44 ` Michael Kjörling
2015-09-25 19:48   ` Michael Kjörling
2015-09-25 21:48   ` Mike Nagie [this message]
2015-09-25 22:24     ` Michael Kjörling
2015-09-25 23:03       ` Arno Wagner
2015-09-26  7:14       ` Mike Nagie
2015-09-26  7:32         ` Mistave
2015-09-26  8:27           ` Mike Nagie
2015-09-26 10:24             ` Mistave
2015-09-26 13:12         ` Robert Nichols
2015-09-26 15:38         ` Michael Kjörling
2015-09-27 11:08           ` Mike Nagie
2015-09-27 13:47             ` Michael Kjörling
2015-09-27 14:08             ` Arno Wagner
2015-09-27 14:15               ` Michael Kjörling
2015-09-27 14:34                 ` Arno Wagner
2015-09-27 16:12                 ` Mike Nagie
2015-09-27 16:51                   ` Michael Kjörling
2015-09-27 18:20                     ` Mike Nagie
2015-09-27 18:55                   ` Heinz Diehl
2015-09-27 18:57                     ` Heinz Diehl
2015-09-27 21:50                     ` Mike Nagie
2015-09-27 22:08                       ` Michael Kjörling
2015-09-28 20:11                       ` Heinz Diehl
2015-09-29 10:52                         ` Mike Nagie
2015-09-30 12:16                         ` Mike Nagie
2015-09-30 15:00                           ` Arno Wagner
2015-09-30 17:49                             ` Mike Nagie
2015-09-30 19:27                               ` Arno Wagner
2015-09-30 15:40                           ` Heinz Diehl
2015-09-25 20:12 ` Arno Wagner

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=20150925214834.GA5103@manjaro.chello.hu \
    --to=promike1987@gmail.com \
    --cc=dm-crypt@saout.de \
    /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