All of lore.kernel.org
 help / color / mirror / Atom feed
* [dm-crypt] MK Digest Size
@ 2011-07-10 16:29 Jorge Fábregas
  2011-07-10 16:59 ` Jorge Fábregas
  2011-07-10 18:17 ` Milan Broz
  0 siblings, 2 replies; 4+ messages in thread
From: Jorge Fábregas @ 2011-07-10 16:29 UTC (permalink / raw)
  To: dm-crypt

Hello everyone,

I'm new to DM-Crypt/LUKS and I'm wondering why is it that, when I format
a partition (luksFormat) using --hash sha256, I still get to see 20 HEX
characters (160 bits) for the MK digest?  Shouldn't I see 32 HEX chars
(256 bits)?   Or is that sha256 is used in the PBKDF2 process but the
function is instructed to deliver just 160 bits?

One final thing just to make sure:  is the algorithm that appears under
"Hash spec" in the header..is this the same hash-algorithm used (along
with PBKDF2) for the user-keys? as well as the one used with PBKDF2 for
the MK digest?

The man page says for the hash option:   ...used in LUKS key setup
scheme and volume key digest.  So it appears that "Hash spec" is used
for both...but then, I don't understand why I get just 160 bits when I
specify sha256 :(

Thanks!

Regards,
Jorge

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dm-crypt] MK Digest Size
  2011-07-10 16:29 [dm-crypt] MK Digest Size Jorge Fábregas
@ 2011-07-10 16:59 ` Jorge Fábregas
  2011-07-10 18:17 ` Milan Broz
  1 sibling, 0 replies; 4+ messages in thread
From: Jorge Fábregas @ 2011-07-10 16:59 UTC (permalink / raw)
  To: dm-crypt

On 07/10/2011 12:29 PM, Jorge Fábregas wrote:
> I still get to see 20 HEX characters (160 bits) for the MK digest?  

I'm sorry.  I meant 20 pairs of HEX characters (40 chars) as they appear
nicely formatted in the luksDump output.

> Shouldn't I see 32 HEX chars (256 bits)?   

Same here (64 hex characters ).

> Or is that sha256 is used in the PBKDF2 process but the function is 
> instructed to deliver just 160 bits?

Ok, I'm going to try to answer myself as I just read again the latest
specification.  It appears this is the case (just 160 bits even if you
use sha256) because there are just 20 bytes available for "mk-digest" in
the header.

I'm just curious:  is having just 20 bytes for the digest a limitation
here?  Are there any plans to expand this field in the future?


> One final thing just to make sure:  is the algorithm that appears under
> "Hash spec" in the header..is this the same hash-algorithm used (along
> with PBKDF2) for the user-keys? as well as the one used with PBKDF2 for
> the MK digest?

Apparently yes.

Sorry for the noise!

Regards,
Jorge

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dm-crypt] MK Digest Size
  2011-07-10 16:29 [dm-crypt] MK Digest Size Jorge Fábregas
  2011-07-10 16:59 ` Jorge Fábregas
@ 2011-07-10 18:17 ` Milan Broz
  2011-07-10 18:26   ` Jorge Fábregas
  1 sibling, 1 reply; 4+ messages in thread
From: Milan Broz @ 2011-07-10 18:17 UTC (permalink / raw)
  To: Jorge Fábregas; +Cc: dm-crypt


On 07/10/2011 06:29 PM, Jorge Fábregas wrote:
> I'm new to DM-Crypt/LUKS and I'm wondering why is it that, when I format
> a partition (luksFormat) using --hash sha256, I still get to see 20 HEX
> characters (160 bits) for the MK digest?  Shouldn't I see 32 HEX chars
> (256 bits)?   Or is that sha256 is used in the PBKDF2 process but the
> function is instructed to deliver just 160 bits?

Yes, it uses sha256 but only first 20 bytes is stored. This is limitation
of the current LUKS on-disk header (20 bytes was fixed length of SHA1).

MK digest is just for verification that decrypted key is correct,
20 bytes is enough for that.

> One final thing just to make sure:  is the algorithm that appears under
> "Hash spec" in the header..is this the same hash-algorithm used (along
> with PBKDF2) for the user-keys? as well as the one used with PBKDF2 for
> the MK digest?

Yes, hash algorithm in LUKS header is used in PBKDF2 and AF splitter.

> The man page says for the hash option:   ...used in LUKS key setup
> scheme and volume key digest.  So it appears that "Hash spec" is used
> for both...but then, I don't understand why I get just 160 bits when I
> specify sha256 :(

See above, header structure is fixed, change would mean binary incompatibility.
Only MK digest is limited here, in all other cases it uses real length of
hash.

Milan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dm-crypt] MK Digest Size
  2011-07-10 18:17 ` Milan Broz
@ 2011-07-10 18:26   ` Jorge Fábregas
  0 siblings, 0 replies; 4+ messages in thread
From: Jorge Fábregas @ 2011-07-10 18:26 UTC (permalink / raw)
  To: dm-crypt

Thanks Milan for confirming and for all the details.  I'm all clear now.

All the best,
Jorge

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-07-10 18:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-10 16:29 [dm-crypt] MK Digest Size Jorge Fábregas
2011-07-10 16:59 ` Jorge Fábregas
2011-07-10 18:17 ` Milan Broz
2011-07-10 18:26   ` Jorge Fábregas

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.