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
Ondrej Kozina
193b477086
Report reencryption data shift value in sectors.
2019-07-23 17:28:26 +02:00
Ondrej Kozina
bda28bbf38
Fix bug in crypt_keyslot_add_by_key.
2019-07-12 15:37:18 +02:00
Ondrej Kozina
f4da3c7f1b
Add warning when changing explicitly requested LUKS2 metadata size.
2019-07-12 15:37:18 +02:00
Ondrej Kozina
431bc87f85
Add LUKS2 error message hint when device too small.
...
If we format LUKS2 device with parameters unsuitable
for current metadata device size we usually fail during header areas
wipe. It was not clear what the reason actually was.
2019-07-12 15:12:46 +02:00
Ondrej Kozina
e3e6e75d40
Improvements to LUKS2 reencryption error messages.
...
- make error messages propagated to users more comprehensible
- drop some error messages completely
- replace many error messages with debug logs only
Fixes #458 .
2019-07-01 10:18:55 +02:00
Ondrej Kozina
6425e1c52f
Fix data device lookup among dm dependecies in crypt_init_by_name.
...
Also remove overlooked temporary debug message.
2019-07-01 10:18:49 +02:00
Ondrej Kozina
d4682b3b38
Cleanup translated messages id.
...
- minimize count of almost identical message ids
- unify style for some messages
- remove some useless messages
2019-06-27 10:23:42 +02:00
Ondrej Kozina
292a5f50b2
Allow offline reencryption on files without root privileges.
...
If userspace block ciphers are not available try kcapi first.
2019-06-27 10:19:23 +02:00
Ondrej Kozina
767bb952a5
Enable crypt_init_by_name() for LUKS2 device on top of reencryption stack.
2019-06-27 10:19:12 +02:00
Ondrej Kozina
32e7178bbb
Allow crypt_get_active_device for multi-segment devices.
2019-06-27 10:19:05 +02:00
Ondrej Kozina
249e6af3a6
Add LUKS2 uuid component in underlying dm-integrity device.
2019-06-27 10:18:56 +02:00
Ondrej Kozina
59bed375d0
Add type parameter to INTEGRITY_activate_dmd.
2019-06-27 10:18:54 +02:00
Ondrej Kozina
0106c64369
Fix issues reported by valgrind.
...
keyslot_cipher member leaked after existing LUKS2 context reload.
crypt_keyslot_set_encryption may access freed memory if
crypt_keyslot_get_encryption was previously called with
CRYPT_ANY_SLOT parameter.
2019-06-14 13:50:09 +02:00
Ondrej Kozina
bbdf9b2745
Read and compare metadata sequence id after taking write lock.
2019-06-12 12:36:46 +02:00