-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fail to extract volume key for capi:authenc(hmac(sha256),xts(aes))-plain64 #10
Comments
Adding support for keys with integrity sounds reasonable. There are a few places in Would you be able to provide a patch for the changes you mentioned? And I can add an integration test for this change. |
I've identified only two places which are harmful. Line 219 in d8c59ab
and Line 379 in d8c59ab
For the patch I tried modifying these, but it was giving checksum error. The 2nd part is also crucial. I tried taking only first 64bytes of the volume key. It didnt work. Tried looking over internet to see if any algorithm or pseudocode is present for this. Unfortunately I couldn’t find any good resource. I'm planning to go through the latest cryptsetup luksOpen codebase. (Too challenging, since its a c code with low readability) If you know any good documentation please let me know. |
There is no good documentation about the implementation algorithm, unfortunately. I've been using I think I was able to figure out what was wrong with the function. Please try |
@anatol Anyway, it would be nice if we can somehow pass on the information to the Somewhere near here: Line 57 in ada2562
|
The volume key of luks2 with integrity is slightly different from regular luks2 volume key.
It is normally 96bytes. The first 64 bytes are the two parts of aes-xts key. The next 32bytes are the integrity key which is used for validation.
There are primarily two problems I've identified:
Reading the anti-forensic key
Here this code is reading equivalent size of
keyslot.KeySize
but it should read the anti forensic area size (keyslot.Area.KeySize
) only.luks.go/luks2.go
Line 219 in d8c59ab
When using
aes-xts-plain64
without integrity, both the values are 64bytes.Separation of aes-xts key and integrity key. As I've mentioned above, the 96 bytes need to be split into 64bytes and 32bytes. This should be done near
luks.go/luks2.go
Line 225 in d8c59ab
Command to prepare the test data:
dd if=/dev/random of=/tmp/partitionKey.txt bs=1 count=32 cryptsetup luksFormat -q --type luks2 /tmp/exp1/test_disk.img --cipher aes-xts-plain64 --key-file /tmp/partitionKey.txt \ --integrity hmac-sha256 --integrity-no-wipe --sector-size 4096 # Extract volume key and verify with our code's output cryptsetup luksDump /tmp/exp1/test_disk.img -q -v --key-file /tmp/partitionKey.txt --dump-volume-key --volume-key-file /tmp/exp1/vk.key
The text was updated successfully, but these errors were encountered: