92 Commits

Author SHA1 Message Date
Milan Broz
307a7ad077 Add keyslot encryption params.
This patch makes available LUKS2 per-keyslot encryption settings to user.

In LUKS2, keyslot can use different encryption that data.

We can use new crypt_keyslot_get_encryption and crypt_keyslot_set_encryption
API calls to set/get this encryption.

For cryptsetup new --keyslot-cipher and --keyslot-key-size options are added.

The default keyslot encryption algorithm (if cannot be derived from data encryption)
is now available as configure options (default is aes-xts-plain64 with 512-bits key).
NOTE: default was increased from 256-bits.
2019-01-07 13:07:46 +01:00
Milan Broz
267bf01259 Add crypt_get_pbkdf_type_params() API.
This function allows get default (compiled-in) PBKDF parameters
per every algorithm.

Fixes #397.
2019-01-03 14:13:01 +01:00
Milan Broz
fd02dca60e Add crypt_set_metadata_size / crypt_get_metadata_size API. 2018-12-11 21:59:59 +01:00
Milan Broz
03edcd2bfd Add crypt_set_data_offset API function.
The crypt_set_data_offset sets the data offset for LUKS and LUKS2 devices
to specified value in 512-byte sectors.

This value should replace alignment calculation in LUKS param structures.
2018-12-06 11:10:21 +01:00
Milan Broz
0fed68dd16 Introduce crypt_init_data_device and crypt_get_metadata_device_name.
For some formats we need to separate metadata and data device before
format is called.
2018-12-05 12:33:16 +01:00
Milan Broz
a387557970 Introduce crypt_keyslot_get_key_size()
This function allows to get key size even for unboud keyslots.
2018-04-26 14:24:10 +02:00
Milan Broz
30754473fc Add API to get integrity current failure count for dm-integrity. 2018-04-24 08:51:32 +02:00
Milan Broz
f8a7ab1752 Add crypt_get_pbkdf_default() function to get per-type PBKDF default. 2018-04-16 15:26:43 +02:00
Ondrej Kozina
f3a9e95dd8 Add simple API for token assignment reporting. 2018-02-22 15:21:37 +01:00
Milan Broz
f34ce81f25 Introduce new 64bit *keyfile_device_offset functions.
The keyfile interface was designed, well, for keyfiles.

Unfortunately, a keyfile can be placed on a device and the size_t offset
can overflow.

We have to introduce new set of fucntions that allows 64bit offsets even on 32bit systems:
 - crypt_resume_by_keyfile_device_offset
 - crypt_keyslot_add_by_keyfile_device_offset
 - crypt_activate_by_keyfile_device_offset
 - crypt_keyfile_device_read

The new functions have added _device_ in name.

Old functions are just internall wrappers around these.

Also cryptsetup --keyfile-offset and --new-keyfile-offset must now
process 64bit offsets.

For more info see issue 359.
2018-01-17 22:07:23 +01:00
Milan Broz
9f2727bb77 Add libLUKS2. 2017-09-24 19:50:12 +02:00
Milan Broz
5536b3a58d Add implementation of device/file locking for metadata.
To be used later.
2017-09-24 19:49:46 +02:00
Milan Broz
c56bdee177 Add backend support for new device-mapper kernel options.
This patch adds support for using keyring for volume key
and support for new integrity fields for dm-crypt.

Also helpers for searching disk by id.

To be used later.
2017-09-24 19:49:35 +02:00
Milan Broz
3435f9cb2c Use only crypt_get_integrity_info in API.
Some other functions remain internal only.

Signed-off-by: Milan Broz <gmazyland@gmail.com>
2017-08-06 21:34:01 +02:00
Milan Broz
0abf57be5d Change PBKDF interface API.
Prepare API for PBKDF that can set three costs
  - time (similar to iterations in PBKDF2)
  - memory (required memory for memory-hard function)
  - threads (required number of threads/CPUs).

This patch also removes wrongly designed API call
crypt_benchmark_kdf and replaces it with the new call
crypt_benchmark_pbkdf.

Two functions for PBKDF per context setting
are introduced: crypt_set_pbkdf_type and crypt_get_pbkdf_type.

The patch should be backward compatible when using
crypt_set_iteration_time function (works only for PBKDF2).

Signed-off-by: Milan Broz <gmazyland@gmail.com>
2017-08-06 21:24:05 +02:00
Milan Broz
01598028c4 Aff info function for integrity device and print info ion status. 2017-07-31 16:48:29 +02:00
Milan Broz
32d5e59ab6 Implement deferred removal of device.
This can be used in some automated systems and allows device
to be removed after the last user mapping closes it.
2017-06-23 14:41:54 +02:00
Milan Broz
3a27c84d98 Rewrite and export crypt_wipe function.
The crypt_wipe can be used to wipe any part of the device,
and also to initialize integrity based device (to reset checksum).
2017-06-07 15:31:13 +02:00
Milan Broz
2a50be152e Increase library and symbols version. 2017-05-29 10:23:24 +02:00
Milan Broz
0bb7098fd8 Add integritysetup command line tool for the dm-integrity standalone setting.
The dm-integrity target is intended to be used for authenticated
encryption through LUKS and dm-crypt.

It can be used in standalone as well; for this use case there
is a simple configuration utility called integritysetup
(similar to veritysetup to dm-verity).
2017-05-28 09:22:17 +02:00
Milan Broz
9cbe74c2db Remove last error handling (error is logged). 2015-11-20 09:18:58 +01:00
Milan Broz
4aea3b81ee Remove password callback interface.
This was a design mistake and should not be handled inside libcryptsetup code.
2015-11-20 09:18:31 +01:00
Milan Broz
f0986be2e3 Export crypt_keyfile_read(). 2015-11-20 09:18:31 +01:00
Milan Broz
05af3a3383 Move change key into library (add crypt_keyslot_change_by_passphrase).
This change is useful mainly in FIPS mode, where we cannot
extract volume key directly from libcryptsetup.
2012-12-07 15:33:47 +01:00
Milan Broz
bd494d23c5 Add PBKDF2 benchmark. 2012-12-05 20:35:42 +01:00
Milan Broz
db97d3d8c8 Add simple cipher benchmarking. 2012-11-19 21:22:43 +01:00
Milan Broz
f45d4d0755 Add crypt_keyslot_area() API call.
Useful if you want to analyze/wipe area of disk used for keyslot
from external tool.
2012-09-11 11:59:06 +02:00
Milan Broz
6d07be898d Enhance status of active device. 2012-06-09 18:28:00 +02:00
Milan Broz
bd047d03ef Add repair command and API for repairing known LUKS header problems. 2012-04-02 21:18:22 +02:00
Milan Broz
9511c91a79 Add --keyfile-offset and --new-keyfile-offset to cryptsetup.
Add resume_by_keyfile_offset, add_kesylot_by_keyfile_offset and
activate_by_keyfile_offset to API.

Thanks to Matthew Monaco <matthew.monaco@0x01b.net>
2012-03-29 18:35:07 +02:00
Milan Broz
1b982af46f Fix typo in iteration time api call.
(To not break API keep old set_iterarion_time alias...)

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@675 36d66b0a-2a48-0410-832c-cd162a569da5
2011-11-06 22:44:52 +00:00
Milan Broz
8c54d938ac Add crypt_last_error() API call (using crypt context).
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@623 36d66b0a-2a48-0410-832c-cd162a569da5
2011-10-09 13:45:53 +00:00
Milan Broz
f7f9e291f4 * Add --header option for detached metadata (on-disk LUKS header) device.
* Add crypt_init_by_name_and_header() and crypt_set_data_device() to API.

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@575 36d66b0a-2a48-0410-832c-cd162a569da5
2011-07-20 17:39:26 +00:00
Milan Broz
261d0d05a5 Add crypt_get_iv_offset() function to API.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@573 36d66b0a-2a48-0410-832c-cd162a569da5
2011-07-18 13:03:15 +00:00
Milan Broz
a1306ed01c Remove old API functions (all functions using crypt_options).
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@561 36d66b0a-2a48-0410-832c-cd162a569da5
2011-07-07 14:32:42 +00:00
Milan Broz
c9881f8c33 * Add crypt_get_type(), crypt_resize(), crypt_keyslot_max()
and crypt_get_active_device() to API.
* Rewrite all implementations in cryptsetup to new API.
* Fix luksRemoveKey to behave as documented (do not ask
for remaining keyslot passphrase).
* Add more regression tests for commands.

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@360 36d66b0a-2a48-0410-832c-cd162a569da5
2010-11-05 11:27:47 +00:00
Milan Broz
a38cb2375f * Add crypt_set_uuid() to API.
* Allow UUID setting in luksFormat and luksUUID (--uuid parameter).

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@355 36d66b0a-2a48-0410-832c-cd162a569da5
2010-10-29 13:54:14 +00:00
Milan Broz
dfe77be748 * Implement --use-random and --use-urandom for luksFormat to allow setting of RNG for volume key generator.
* Add crypt_set_rng_type() and crypt_get_rng_type() to API.

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@354 36d66b0a-2a48-0410-832c-cd162a569da5
2010-10-27 15:35:23 +00:00
Milan Broz
9679fb7f25 Add crypt_get_device_name() to API (get underlying device name).
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@342 36d66b0a-2a48-0410-832c-cd162a569da5
2010-10-18 14:47:06 +00:00
Milan Broz
8bec41ab34 Properly apply versioned symbols in library and fix problems uncovered
by doing that:-)

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@124 36d66b0a-2a48-0410-832c-cd162a569da5
2009-09-30 15:07:41 +00:00
Milan Broz
5ca9cfde59 Export header backup and restore functions.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@120 36d66b0a-2a48-0410-832c-cd162a569da5
2009-09-29 12:31:49 +00:00
Milan Broz
1cc33f943e patch 1.patch
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@109 36d66b0a-2a48-0410-832c-cd162a569da5
2009-09-10 12:41:18 +00:00