Luca Boccassi
3062a9ba91
libcrypsetup: add CRYPT_DEACTIVATE_DEFERRED_CANCEL for crypt_deactivate_by_name
...
Allows to cancel a previously set deferred deactivation flag
for a specific device.
[mbroz: slight changes]
2020-09-26 13:03:16 +02:00
Milan Broz
6ed739d9ca
Print a visible error if requesting resize on unsupported format.
...
Fixes : #571 .
2020-09-19 22:05:42 +02:00
Milan Broz
5d07b0730c
Allow to use backup header for tcrypt format.
...
TrueCrypt/VeraCrypt supports backup header, it seems to have
the same format as normal header.
Let's use --header option here, it can be used to unlock data partition
with header backup (open and dump commands).
Fixes : #587 .
2020-09-19 21:42:08 +02:00
Milan Broz
2ce8573f04
Add PIN processing to tokens.
2020-08-15 10:10:40 +02:00
Milan Broz
31ebf3dc2c
libdevmapper: always return EEXIST if a task fails because the device already exists
...
Allows concurrent opens to return a usable error instead of EINVAL
2020-08-12 16:50:57 +01:00
Ondrej Kozina
c867f2e8a0
Unload all external tokens on exit.
2020-08-11 17:36:30 +02:00
Milan Broz
7d475266b6
Simplify internal tokens handling.
2020-08-09 13:17:40 +02:00
Milan Broz
4451df15b4
Rename luks2_reenc_context to luks2_reecrypt.
2020-07-07 14:20:39 +02:00
Milan Broz
f50062517e
Rename crypt_get/set reenc_context to luks2_reencrypt.
2020-07-07 14:20:39 +02:00
Milan Broz
967e3de552
Rename LUKS2_reenc_status to LUKS2_reencrypt_status.
2020-07-07 14:20:39 +02:00
Milan Broz
d95472e757
Rename LUKS2_reencrypt_status to LUKS2_reencrypt_get_params to avoid confusion.
2020-07-07 14:20:39 +02:00
Milan Broz
3e0e5bac2a
Use LUKS2_reencrypt prefix for function defined in luks2.h.
...
This should clean up prefixes a little bit.
2020-07-07 14:20:39 +02:00
Milan Broz
281dd51f5a
Remove json_object argument from area size checks.
...
These functions are internal to LUKS2 implementation.
2020-07-07 14:20:39 +02:00
Ondrej Kozina
d177af8842
Do not create excessively large headers.
...
When creating LUKS2 header with specified --offset much larger
then LUKS2 header size we needlessly also wipe (allocate up to
--offset) much larger file than needed.
2020-07-07 14:20:19 +02:00
Ondrej Kozina
1e94425279
Remove unused parameter from crypto_backend_init.
2020-03-20 11:32:57 +01:00
Milan Broz
0cf5e309a0
Print warning if running without O_CLOEXEC.
2020-02-21 10:23:07 +01:00
Milan Broz
b5fbd682f2
Move fcntl.h to internal defines and check for O_CLOEXEC.
2020-02-21 10:10:11 +01:00
Vojtěch Trefný
61f5dcb11e
Return correct data offset for BITLK in crypt_get_data_offset
...
First part of the encrypted data will be always directly after
the header.
Fixes : #518
2020-01-17 14:02:12 +01:00
Milan Broz
165e6c234c
Fix some error and debug messages.
...
Use BITLK as format name.
Avoid using doesn't -> does not.
2020-01-11 22:10:59 +01:00
Milan Broz
1be631f43f
Add status flag for verity device with signature.
...
This patch adds CRYPT_VERITY_ROOT_HASH_SIGNATURE flag to verity info.
Veritysetup status now display "with signature" if an active
device was activated with root hash signature.
2020-01-11 19:57:39 +01:00
Milan Broz
080566a1fd
Update copyright year.
2020-01-03 13:04:55 +01:00
Milan Broz
02821adc47
Fix a signed/unsigned comparison compiler warning.
2020-01-03 11:26:44 +01:00
Milan Broz
0505c70be2
Implement BITLK status info.
...
Cryptsetup status <device> should print info about active device.
Also fix mistake in BITLK volume key size (should return bytes, not bits).
2020-01-03 10:14:47 +01:00
Jaskaran Khurana
f247038e65
Add --root-hash-signature parameter to veritysetup
...
Optional parameter root hash signature is added that can be added to
veritysetup.
The signature file is opened and the signature is added to the keyring.
The kernel will use the signature to validate the roothash.
Usage: veritysetup open <data_device> name <hash_device> <root_hash> --root-hash-signature=<roothash_p7_sig_file>
Signed-off-by: Jaskaran Khurana <jaskarankhurana@linux.microsoft.com >
Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com >
[Original patch rewritten by Milan Broz]
2020-01-02 13:08:21 +01:00
Luca Boccassi
188cb114af
Add support for verity in crypt_volume_key_get and use it in status
...
Other APIs use the root hash in place of keys when using verity
devices, so do the same for crypt_volume_key_get to allow users
to retrieve the root hash of an active verity device.
Use it in veritysetup status to print the root hash.
[Patch slightly modified by Milan Broz]
2019-12-31 21:44:50 +01:00
Ondrej Kozina
faafe09bd0
Use crypt_volume_key_next where appropriate.
2019-12-31 17:37:33 +01:00
Milan Broz
a0e87c9420
Calculate hash integrity size instead of requiring an explicit tag size.
...
When integritysetup formats a device with hash or HMAC integrity checksums,
it requires explicitly tag size entry from a user (or default value).
This leads to confusion and shortened tags.
This patch calculates tag size according to real hash output, and
if tag size is specified, it warns if these values differ.
Fixes : #492 .
2019-12-31 17:37:33 +01:00
Vojtěch Trefný
62c872eb49
Add support for parsing BitLocker metadata
...
Currently only support for metadata version 2 is implemented.
2019-12-30 21:53:06 +01:00
Milan Broz
434fee2e13
Add empty template for BITLK device type.
...
Also add DM_ZERO type for multi-segment mapping.
2019-12-30 21:53:06 +01:00
Ondrej Kozina
7eb47f3db1
Split reencryption locking in two variants.
2019-11-28 16:38:52 +01:00
Milan Broz
ddd15b63b2
Add backward compatibility flags API.
...
We need to have some way hot to configure old integrity devices
with legacy padding.
For now, also use in tests to not fail checksum with new kernel.
2019-11-25 23:14:58 +01:00
Milan Broz
e91b35a53d
Print info and warning if dm-integrity fix_padding is set.
...
The dump operation prints the fix_padding flag if set.
Also try to print warning if an old kernel is used and th edevice
cannot be activated because of missing fix padding support.
2019-11-25 19:48:54 +01:00
Milan Broz
48b203a134
Add crypt_resume_by_volume_key() function.
...
If user has volume key available, LUKS device can be resumed
directly using provided volume key.
No keyslot derivation is needed, only key digest is checked.
Fixes : #502 .
2019-11-24 18:04:41 +01:00
Milan Broz
b03cb3f3d8
Export memory safe functions.
...
Make crypt_safe_alloc/realloc/free and memzero part of API.
2019-11-16 21:28:54 +01:00
Ondrej Kozina
630e336ea0
Do not allocate data device when identical with metadata device.
...
we do not need to allocate separate data device if it's equal
to metadata device during initialization.
2019-10-04 12:19:14 +02:00
Ondrej Kozina
430852736d
Cleanup crypt_init_data_device.
...
data_device can not be NULL
2019-10-04 12:19:09 +02:00
Ondrej Kozina
bb1ce4a069
Check plain crypt device is properly aligned on activation.
2019-10-02 13:40:10 +02:00
Ondrej Kozina
5e3e4a225e
Check resize operation is aligned to device logical size.
...
Fixes #486 .
2019-10-01 12:41:43 +02:00
Ondrej Kozina
54d757a4c7
Fix illegal access to deallocated memory.
...
When deallocating context with LUKS2 reencryption handle
we access data device structure after being free'd.
2019-08-09 12:43:23 +02:00
Ondrej Kozina
91879960e6
Move most of crypt_reencrypt_status to reencryption file.
2019-08-05 18:29:37 +02:00
Ondrej Kozina
270e6959b8
Make crypt_reencrypt_status return 'none' value for non-LUKS2 devices.
2019-08-05 18:29:37 +02:00
Ondrej Kozina
71f7385fcb
Add support for linear segment in device comparison.
2019-08-01 10:43:57 +02:00
Ondrej Kozina
fbedf0ba6b
Improve dm-crypt segments comparison function.
...
Check key descriptions are identical if both targets
were constructed using keys in kernel keyring service.
2019-08-01 10:40:37 +02:00
Ondrej Kozina
cf710eab13
Add internal crypt_compare_dm_devices.
2019-08-01 10:40:37 +02:00
Ondrej Kozina
b216a6a30e
Introduce crypt_strcmp function (allows NULL).
2019-07-31 14:58:55 +02:00
Milan Broz
1d59ae9aa9
Remove FIPS mode restriction for crypt_volume_key_get.
...
It is an application responsibility to use this API in the proper
context.
2019-07-30 14:12:50 +02:00
Ondrej Kozina
0e994265c6
Report data segment is moved in crypt_reencrypt_status.
2019-07-26 16:09:38 +02:00
Ondrej Kozina
607e2248c8
Simplify LUKS2_reencrypt_direction function.
2019-07-26 16:06:03 +02:00
Ondrej Kozina
7460d1a446
Fix backward reencryption with data shift.
...
The device has to be shrunk the data shift size during activation.
Otherwise the online reencryption would fail with incorrect device
size.
2019-07-26 16:04:27 +02:00
Ondrej Kozina
dd0e073159
Fill direction field in crypt_reencrypt_status.
2019-07-23 17:28:26 +02:00