4 Device-Mapper's "crypt" target provides transparent encryption of block devices
5 using the kernel crypto API.
7 For a more detailed description of supported parameters see:
8 https://gitlab.com/cryptsetup/cryptsetup/wikis/DMCrypt
10 Parameters: <cipher> <key> <iv_offset> <device path> \
11 <offset> [<#opt_params> <opt_params>]
14 Encryption cipher and an optional IV generation mode.
15 (In format cipher[:keycount]-chainmode-ivmode[:ivopts]).
21 /proc/crypto contains supported crypto modes
24 Key used for encryption. It is encoded either as a hexadecimal number
25 or it can be passed as <key_string> prefixed with single colon
26 character (':') for keys residing in kernel keyring service.
27 You can only use key sizes that are valid for the selected cipher
28 in combination with the selected iv mode.
29 Note that for some iv modes the key string can contain additional
30 keys (for example IV seed) so the key contains more parts concatenated
34 The kernel keyring key is identified by string in following format:
35 <key_size>:<key_type>:<key_description>.
38 The encryption key size in bytes. The kernel key payload size must match
39 the value passed in <key_size>.
42 Either 'logon' or 'user' kernel key type.
45 The kernel keyring key description crypt target should look for
46 when loading key of <key_type>.
49 Multi-key compatibility mode. You can define <keycount> keys and
50 then sectors are encrypted according to their offsets (sector 0 uses key0;
51 sector 1 uses key1 etc.). <keycount> must be a power of two.
54 The IV offset is a sector count that is added to the sector number
55 before creating the IV.
58 This is the device that is going to be used as backend and contains the
59 encrypted data. You can specify it as a path like /dev/xxx or a device
60 number <major>:<minor>.
63 Starting sector within the device where the encrypted data begins.
66 Number of optional parameters. If there are no optional parameters,
67 the optional paramaters section can be skipped or #opt_params can be zero.
68 Otherwise #opt_params is the number of following arguments.
70 Example of optional parameters section:
71 3 allow_discards same_cpu_crypt submit_from_crypt_cpus
74 Block discard requests (a.k.a. TRIM) are passed through the crypt device.
75 The default is to ignore discard requests.
77 WARNING: Assess the specific security risks carefully before enabling this
78 option. For example, allowing discards on encrypted devices may lead to
79 the leak of information about the ciphertext device (filesystem type,
80 used space etc.) if the discarded blocks can be located easily on the
84 Perform encryption using the same cpu that IO was submitted on.
85 The default is to use an unbound workqueue so that encryption work
86 is automatically balanced between available CPUs.
88 submit_from_crypt_cpus
89 Disable offloading writes to a separate thread after encryption.
90 There are some situations where offloading write bios from the
91 encryption threads to a single thread degrades performance
92 significantly. The default is to offload write bios to the same
93 thread because it benefits CFQ to have writes submitted using the
98 LUKS (Linux Unified Key Setup) is now the preferred way to set up disk
99 encryption with dm-crypt using the 'cryptsetup' utility, see
100 https://gitlab.com/cryptsetup/cryptsetup
104 # Create a crypt device using dmsetup
105 dmsetup create crypt1 --table "0 `blockdev --getsz $1` crypt aes-cbc-essiv:sha256 babebabebabebabebabebabebabebabe 0 $1 0"
110 # Create a crypt device using dmsetup when encryption key is stored in keyring service
111 dmsetup create crypt2 --table "0 `blockdev --getsize $1` crypt aes-cbc-essiv:sha256 :32:logon:my_prefix:my_key 0 $1 0"
116 # Create a crypt device using cryptsetup and LUKS header with default cipher
117 cryptsetup luksFormat $1
118 cryptsetup luksOpen $1 crypt1