Commit Graph

5 Commits

Author SHA1 Message Date
Simon Glass
c8b4ede816 luks: Support a pre-derived key with LUKSv2
In some cases we may wish to provide a pre-derived key, e.g. obtained
from a TKey. Provide an option for this with LUKSv2. For now it is not
exported.

Improve the error-return documentation while we are here.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-17 06:59:47 -07:00
Simon Glass
19354111d0 luks: Update unlock_luks2() to take binary passphrase
Update unlock_luks2() and related functions to accept a binary
passphrase instead of a string passphrase. This will allow unlocking
using hashed data.

For now this is internal to the luks implementation.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-17 06:59:47 -07:00
Simon Glass
21c8e23ac7 luks: Make essiv_decrypt() a shared function
Both luks.c and luks2.c have similar implementations of essiv_decrypt().
Drop the version in the later to reduce code duplication.

Drop the duplicate function comments while we are here, since exported
functions should have the information in the header file.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-17 06:59:47 -07:00
Simon Glass
f0d3a7d5f9 luks: Provide an implementation of luks2
Add supports for luks v2 which is a more common version used on modern
systems.

This makes use of Argon2 and also the JSON->FDT parser.

Enable this feature for sandbox, tidying up the defconfig while we are
here.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-11 04:35:08 -07:00
Simon Glass
cc31300b5c luks: Export the af_merge() function
Provide this function through an internal header, so that luks2 will be
able to use it.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-11-11 04:16:43 -07:00