Ondrej Kozina
af6c321395
Set default length for reencryption with resilience 'none' only.
2019-05-21 15:54:07 +02:00
Ondrej Kozina
1923928fdc
Drop duplicate error message from reencrypt load.
2019-05-21 15:54:07 +02:00
Ondrej Kozina
8c8a68d850
Add CRYPT_REENCRYPT_RESUME_ONLY flag.
2019-05-13 18:23:20 +02:00
Ondrej Kozina
2d0079905e
Adapt device_open_excl to reusing of fds.
2019-05-10 21:05:31 +02:00
Ondrej Kozina
83c227d53c
Sync device using internal write enabled descriptor.
2019-05-10 21:05:31 +02:00
Ondrej Kozina
ee57b865b0
Reuse device file desriptors.
2019-05-10 21:05:31 +02:00
Ondrej Kozina
8545e8496b
Fix memleak in reencryption with moved segment.
2019-05-07 17:17:34 +02:00
Milan Broz
237021ec15
Fix some warnings in static analysis.
2019-05-07 13:44:43 +02:00
Milan Broz
1f91fe7a2c
Use JSON-debug wrappers.
2019-05-03 14:02:43 +02:00
Ondrej Kozina
a7f80a2770
Add resilient LUKS2 reencryption library code.
2019-05-02 16:44:23 +02:00
Ondrej Kozina
345385376a
Add missing validation check for area type specification.
2019-04-29 16:10:57 +02:00
Milan Broz
dbe9db26fc
Never serialize memory-hard KDF for small amount of memory.
2019-04-29 16:10:57 +02:00
Ondrej Kozina
86b2736480
Drop unused type parameter from LUKS2_keyslot_find_empty()
2019-04-23 10:41:56 +02:00
Milan Broz
cfe2fb66ab
Fix some untranslated error messages.
2019-04-23 10:41:06 +02:00
Milan Broz
1b49ea4061
Add global serialization lock for memory hard PBKDF.
...
This is very ugly workaround for situation when multiple
devices are being activated in parallel (systemd crypttab)
and system instead of returning ENOMEM use OOM killer
to randomly kill processes.
This flag is intended to be used only in very specific situations.
2019-03-29 11:58:12 +01:00
Ondrej Kozina
80a435f00b
Write keyslot binary data and metadata holding single lock.
2019-03-25 11:37:32 +01:00
Ondrej Kozina
fdcd5806b1
Allow to change requirements flag in-memory only.
2019-03-25 11:37:32 +01:00
Ondrej Kozina
fea2e0be4f
Add algorithm for searching largest gap in keyslots area.
2019-03-13 14:56:31 +01:00
Milan Broz
751f5dfda3
Move error message for a keyslot area search.
2019-03-13 14:56:31 +01:00
Ondrej Kozina
d5f71e66f9
Allow digest segment (un)binding for all segments at once.
2019-03-13 14:56:31 +01:00
Ondrej Kozina
03e810ec72
Split crypt_drop_keyring_key in two different routines.
...
crypt_drop_keyring_key function allow to drop all keys in keyring
assocatiated with passed volume key list.
crypt_drop_keyring_key_by_description is used to drop independent key.
2019-03-13 14:56:31 +01:00
Ondrej Kozina
6c6f4bcd45
Add signed int64 json helpers.
2019-03-13 14:56:31 +01:00
Ondrej Kozina
304942302b
Introduce CRYPT_DEFAULT_SEGMENT abstraction.
...
Default segment is no longer constant segment with id 0.
2019-03-13 14:56:31 +01:00
Ondrej Kozina
8dc1a74df8
Adapt existing code to future reencryption changes.
2019-03-13 14:56:31 +01:00
Ondrej Kozina
e295d01505
Adding new functions later used in reencryption.
2019-03-13 14:56:31 +01:00
Ondrej Kozina
56b571fcaa
Use const before vk in all digest verify functions.
2019-03-08 08:52:47 +01:00
Ondrej Kozina
46bf3c9e9c
Add segment create helpers.
2019-03-08 08:44:51 +01:00
Ondrej Kozina
361fb22954
Remove helper get_first_data_offset completely.
2019-03-08 08:43:19 +01:00
Ondrej Kozina
203fe0f4bf
Move get_first_data_offset to luks2_segment.c
2019-03-08 08:42:23 +01:00
Ondrej Kozina
36ac5fe735
Move LUKS2 segments handling in separate file.
2019-03-08 08:39:32 +01:00
Ondrej Kozina
7569519530
Allow unbound keyslots to be assigned to existing digest.
...
If passed key matches any existing digest we will not create
new digest but assign the keyslot to already existing one.
Because reencryption should be able to create more than one
keyslot assigned to new key digest.
TODO: Tests for the new feature
2019-03-08 08:37:27 +01:00
Ondrej Kozina
a848179286
Add json_object_copy wrapper.
2019-03-08 08:27:18 +01:00
Ondrej Kozina
868cc52415
Abort conversion to LUKS1 with incompatible sector size.
2019-03-05 17:08:05 +01:00
Ondrej Kozina
8c168cc337
Introduce file for luks2 segments handling.
2019-03-05 17:08:02 +01:00
Ondrej Kozina
a0540cafb3
alter crypt_storage interface
...
rename sector_start -> iv_start (it's now a iv shift for subsequent
en/decrypt operations)
rename count -> length. We accept length in bytes now and perform sanity
checks at the crypt_storage_init and crypt_storage_decrypt (or encrypt)
respectively.
rename sector -> offset. It's in bytes as well. Sanity checks inside
crypt_storage functions.
2019-03-05 17:07:45 +01:00
Ondrej Kozina
26772f8184
Return NULL explicitly if keyslot is missing.
...
json_object_object_get_ex return parameter is
undefined if function returns false.
2019-03-01 20:30:21 +01:00
Ondrej Kozina
8f8ad83861
Validate metadata before writting binary keyslot area.
2019-03-01 20:29:49 +01:00
Ondrej Kozina
d111b42cf1
Fix keyslot area gap find algorithm.
...
get_max_offset must use value calculated from LUKS2 metadata
boundaries. Data offset didn't have to match end of LUKS2 metadata
area.
2019-03-01 20:29:40 +01:00
Ondrej Kozina
821c965b45
Drop commented code block.
2019-03-01 20:28:56 +01:00
Ondrej Kozina
f26ee11913
Assert reasonable LUKS2 default header size.
2019-02-07 18:40:39 +01:00
Milan Broz
2435d76a39
Use 16MB LUKS2 header size by default.
2019-02-07 18:40:14 +01:00
Milan Broz
319fd19b5e
Add implementation of crypt_keyslot_pbkdf().
...
This function allows to get PBKDF parameters per-keyslot.
2019-02-07 12:55:12 +01:00
Milan Broz
4edd796509
Fix typo.
2019-02-06 21:48:29 +01:00
Ondrej Kozina
6ed3a7774f
Calculate keyslots size based on requested metadata size.
2019-02-06 21:42:51 +01:00
Milan Broz
1908403324
Prepare change for default LUKS2 keyslot area size.
2019-02-06 11:48:34 +01:00
Milan Broz
a6f5ce8c7b
Update copyright year.
...
And unify name copyright format.
2019-01-25 09:45:57 +01:00
Milan Broz
1def60cd2c
Do not allow conversion to LUKS1 if hash algorithms differs (digest,AF).
2019-01-22 14:19:58 +01:00
Milan Broz
cdb4816fbb
Allow setting of hash function in LUKS2 PBKDF2 digest.
...
For now, the hash was set to sha256 (except for converted LUKS1 header).
This patch adds the same logic as in LUKS1 - hash aglorithms is
loaded from PBKDF setting.
Fixes #396 .
2019-01-22 12:45:01 +01:00
Milan Broz
be46588cf0
Allow LUKS2 keyslots area to increase if data offset allows it.
...
ALso deprecate align-plauload option and add more debugging code
to understand internal calculation of metadata and keyslots area sizes.
Fixes #436 .
2019-01-22 09:23:49 +01:00
Milan Broz
51dd2762a9
Add --debug-json switch and log level.
...
The JSON structures should not be printed by default to debug log.
This flag introduces new debug level that prints JSON structures
and keeps default debug output separate.
2019-01-10 14:52:49 +01:00