Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 350038 - sys-fs/cryptsetup-1.1.3-r1: cannot mount partitions encrypted with cryptsetup 1.0.6
Summary: sys-fs/cryptsetup-1.1.3-r1: cannot mount partitions encrypted with cryptsetup...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-29 12:46 UTC by Peter Miller
Modified: 2011-01-10 13:44 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Miller 2010-12-29 12:46:35 UTC
When I try
cryptsetup -c twofish-xts-plain -s 512 luksOpen /dev/sdb1 data --key-file /mnt/my.key
I get: No key available with this passphrase.

If I try with Version 1.0.6 everythings fine.




Reproducible: Always

Steps to Reproduce:
1. cryptsetup -c twofish-xts-plain -s 512 luksFormat /dev/sdb1 /mnt/my.key (version 1.0.6)
2. update to cryptsetup-1.1.3
3. cryptsetup -c twofish-xts-plain -s 512 luksOpen /dev/sdb1 data --key-file /mnt/my.key

Actual Results:  
No key available with this passphrase.
Partition is not decrypted.

Expected Results:  
Decrypt partition.
Comment 1 SpanKY gentoo-dev 2010-12-29 15:46:11 UTC
perhaps cryptsetup 1.0.6 just did it wrong.  i'm not sure 512 is a valid bit size for twofish.  try your options again but with -s 256.
Comment 2 Peter Miller 2010-12-30 12:51:22 UTC
(In reply to comment #1)
> perhaps cryptsetup 1.0.6 just did it wrong.  i'm not sure 512 is a valid bit
> size for twofish.  try your options again but with -s 256.
> 
same error with -s 256...
Comment 3 SpanKY gentoo-dev 2010-12-30 17:09:49 UTC
have you tried the -h option too like the documentation states ?

http://code.google.com/p/cryptsetup/wiki/FrequentlyAskedQuestions#7._Issues_with_Specific_Versions_of_cryptsetup
Comment 4 Peter Miller 2010-12-30 19:24:23 UTC
(In reply to comment #3)
> have you tried the -h option too like the documentation states ?
> 
> http://code.google.com/p/cryptsetup/wiki/FrequentlyAskedQuestions#7._Issues_with_Specific_Versions_of_cryptsetup
> 
I've tryed -h ripemd160 with both -s 256 and -s 512. Still the same error...
Comment 5 SpanKY gentoo-dev 2010-12-30 19:38:07 UTC
well feel free to ask on the mailing list:
http://code.google.com/p/cryptsetup/

if cryptsetup-1.1.3 can create & mount its own stuff, that's good enough for me.  and my partitions that i created long ago with 1.0.6 still work fine.
Comment 6 Milan Broz 2011-01-03 15:23:32 UTC
I think the problem is that "-s" option is overloaded in 1.1.3.

For luksFormat it means encryption key size (so in XTS mode it will use 2x256bit keys). Key size is stored in LUKS header, so you do not need to specify it during luksOpen.

So, in luksOpen it is ignored (in 1.0.6) but in 1.1.3 it restricts passphrase size (size in bits, not in bytes!) (it was design mistake to implement it this way).
So if you have key file longer than 64 (512/8) bytes, system will trim it to 64 bytes.

So simple solution here is to NOT use "-s" in luksOpen command. Does it help for you?

FYI this is fixed in cryptsetup 1.2.0 by definition of special paramater and not overloading "-s / --key-size). It will even warn user in luksOpen:

cryptsetup: Option --key-size is allowed only for luksFormat and create.
To limit read from keyfile use --keyfile-size=(bytes).
Comment 7 Peter Miller 2011-01-03 21:49:21 UTC
(In reply to comment #6)
> I think the problem is that "-s" option is overloaded in 1.1.3.
> 
> For luksFormat it means encryption key size (so in XTS mode it will use
> 2x256bit keys). Key size is stored in LUKS header, so you do not need to
> specify it during luksOpen.
> 
> So, in luksOpen it is ignored (in 1.0.6) but in 1.1.3 it restricts passphrase
> size (size in bits, not in bytes!) (it was design mistake to implement it this
> way).
> So if you have key file longer than 64 (512/8) bytes, system will trim it to 64
> bytes.
> 
> So simple solution here is to NOT use "-s" in luksOpen command. Does it help
> for you?
> 
> FYI this is fixed in cryptsetup 1.2.0 by definition of special paramater and
> not overloading "-s / --key-size). It will even warn user in luksOpen:
> 
> cryptsetup: Option --key-size is allowed only for luksFormat and create.
> To limit read from keyfile use --keyfile-size=(bytes).
> 
yes! this does the trick: just delete the -s / --key-size option in the luksOpen command. 


Comment 8 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2011-01-04 23:10:02 UTC
Peter: You closed this yourself. Was it just in your custom settings, or do some of the init scripts need changing for it?
Comment 9 David Sardari 2011-01-10 13:44:52 UTC
I use the file /etc/conf.d/dmcrypt to decrypt additional partitions (/opt, /tmp etc.) with a key file which is on my root partition. The root partition is decrypted during the boot process with a passphrase.
In order to use cryptsetup-1.1.3-r2 with these partitions, I upgraded to cryptsetup-1.1.3-r2, created a new key file and added it with "cryptsetup luksAddKey..." using the new version of cryptsetup.
Now everything works again.