Fixed the build error for riscv64 arch using gcc 13
[platform/upstream/cryptsetup.git] / man / integritysetup.8
1 .TH INTEGRITYSETUP "8" "January 2021" "integritysetup" "Maintenance Commands"
2 .SH NAME
3 integritysetup - manage dm-integrity (block level integrity) volumes
4 .SH SYNOPSIS
5 .B integritysetup <options> <action> <action args>
6 .SH DESCRIPTION
7 .PP
8 Integritysetup is used to configure dm-integrity managed device-mapper mappings.
9
10 Device-mapper integrity target provides read-write transparent integrity
11 checking of block devices. The dm-integrity target emulates additional data
12 integrity field per-sector. You can use this additional field directly
13 with integritysetup utility, or indirectly (for authenticated encryption)
14 through cryptsetup.
15
16 Integritysetup supports these operations:
17 .PP
18 \fIformat\fR <device>
19 .IP
20 Formats <device> (calculates space and dm-integrity superblock and wipes the device).
21
22 \fB<options>\fR can be [\-\-data\-device, \-\-batch\-mode, \-\-no\-wipe, \-\-journal\-size,
23 \-\-interleave\-sectors, \-\-tag\-size, \-\-integrity, \-\-integrity\-key\-size,
24 \-\-integrity\-key\-file, \-\-sector\-size, \-\-progress-frequency]
25
26 .PP
27 \fIopen\fR <device> <name>
28 .br
29 \fIcreate\fR <name> <device> (\fBOBSOLETE syntax\fR)
30 .IP
31 Open a mapping with <name> backed by device <device>.
32
33 \fB<options>\fR can be [\-\-data\-device, \-\-batch\-mode, \-\-journal\-watermark,
34 \-\-journal\-commit\-time, \-\-buffer\-sectors, \-\-integrity, \-\-integrity\-key\-size,
35 \-\-integrity\-key\-file, \-\-integrity\-no\-journal, \-\-integrity\-recalculate,
36 \-\-integrity\-recovery\-mode, \-\-allow\-discards]
37
38 .PP
39 \fIclose\fR <name>
40 .IP
41 Removes existing mapping <name>.
42
43 For backward compatibility, there is \fBremove\fR command alias
44 for the \fBclose\fR command.
45 .PP
46 \fIstatus\fR <name>
47 .IP
48 Reports status for the active integrity mapping <name>.
49 .PP
50 \fIdump\fR <device>
51 .IP
52 Reports parameters from on-disk stored superblock.
53
54 .SH OPTIONS
55 .TP
56 .B "\-\-verbose, \-v"
57 Print more information on command execution.
58 .TP
59 .B "\-\-debug"
60 Run in debug mode with full diagnostic logs. Debug output
61 lines are always prefixed by '#'.
62 .TP
63 .B "\-\-version"
64 Show the program version.
65 .TP
66 .B "\-\-batch\-mode"
67 Do not ask for confirmation.
68 .TP
69 .B "\-\-progress-frequency <seconds>"
70 Print separate line every <seconds> with wipe progress.
71 .TP
72 .B "\-\-no\-wipe"
73 Do not wipe the device after format. A device that is not initially wiped will contain invalid checksums.
74 .TP
75 .B "\-\-journal\-size, \-j BYTES"
76 Size of the journal.
77 .TP
78 .B "\-\-interleave\-sectors SECTORS"
79 The number of interleaved sectors.
80 .TP
81 .B "\-\-integrity\-recalculate"
82 Automatically recalculate integrity tags in kernel on activation.
83 The device can be used during automatic integrity recalculation but becomes fully
84 integrity protected only after the background operation is finished.
85 This option is available since the Linux kernel version 4.19.
86 .TP
87 .B "\-\-journal\-watermark PERCENT"
88 Journal watermark in percents. When the size of the journal exceeds this watermark,
89 the journal flush will be started.
90 .TP
91 .B "\-\-journal\-commit\-time MS"
92 Commit time in milliseconds. When this time passes (and no explicit flush operation was issued),
93 the journal is written.
94 .TP
95 .B "\-\-tag\-size, \-t BYTES"
96 Size of the integrity tag per-sector (here the integrity function will store authentication tag).
97
98 \fBNOTE:\fR The size can be smaller that output size of the hash function, in that case only
99 part of the hash will be stored.
100 .TP
101 .B "\-\-data\-device"
102 Specify a separate data device that contains existing data. The <device> then will contain
103 calculated integrity tags and journal for this data device.
104 .TP
105 .B "\-\-sector\-size, \-s BYTES"
106 Sector size (power of two: 512, 1024, 2048, 4096).
107 .TP
108 .B "\-\-buffer\-sectors SECTORS"
109 The number of sectors in one buffer.
110
111 The tag area is accessed using buffers, the large buffer size means that the I/O size will
112 be larger, but there could be less I/Os issued.
113 .TP
114 .B "\-\-integrity, \-I ALGORITHM"
115 Use internal integrity calculation (standalone mode).
116 The integrity algorithm can be CRC (crc32c/crc32) or hash function (sha1, sha256).
117
118 For HMAC (hmac-sha256) you have also to specify an integrity key and its size.
119 .TP
120 .B "\-\-integrity\-key\-size BYTES"
121 The size of the data integrity key. Maximum is 4096 bytes.
122 .TP
123 .B "\-\-integrity\-key\-file FILE"
124 The file with the integrity key.
125 .TP
126 .B "\-\-integrity\-no\-journal, \-D"
127 Disable journal for integrity device.
128 .TP
129 .B "\-\-integrity\-bitmap\-mode. \-B"
130 Use alternate bitmap mode (available since Linux kernel 5.2)  where dm-integrity uses bitmap
131 instead of a journal. If a bit in the bitmap is 1, the corresponding region's data and integrity tags
132 are not synchronized - if the machine crashes, the unsynchronized regions will be recalculated.
133 The bitmap mode is faster than the journal mode, because we don't have to write the data
134 twice, but it is also less reliable, because if data corruption happens
135 when the machine crashes, it may not be detected.
136 .TP
137 .B "\-\-bitmap\-sectors\-per\-bit SECTORS"
138 Number of 512-byte sectors per bitmap bit, the value must be power of two.
139 .TP
140 .B "\-\-bitmap\-flush\-time MS"
141 Bitmap flush time in milliseconds.
142 .TP
143
144 \fBWARNING:\fR
145 In case of a crash, it is possible that the data and integrity tag doesn't match
146 if the journal is disabled.
147 .TP
148 .B "\-\-integrity\-recovery\-mode. \-R"
149 Recovery mode (no journal, no tag checking).
150 .TP
151
152 \fBNOTE:\fR The following options are intended for testing purposes only.
153 Using journal encryption does not make sense without encryption the data,
154 these options are internally used in authenticated disk encryption with \fBcryptsetup(8)\fR.
155 .TP
156 .B "\-\-journal\-integrity ALGORITHM"
157 Integrity algorithm for journal area.
158 See \-\-integrity option for detailed specification.
159 .TP
160 .B "\-\-journal\-integrity\-key\-size BYTES"
161 The size of the journal integrity key. Maximum is 4096 bytes.
162 .TP
163 .B "\-\-journal\-integrity\-key\-file FILE"
164 The file with the integrity key.
165 .TP
166 .B "\-\-journal\-crypt ALGORITHM"
167 Encryption algorithm for journal data area.
168 You can use a block cipher here such as cbc-aes or
169 a stream cipher, for example, chacha20 or ctr-aes.
170 .TP
171 .B "\-\-journal\-crypt\-key\-size BYTES"
172 The size of the journal encryption key. Maximum is 4096 bytes.
173 .TP
174 .B "\-\-journal\-crypt\-key\-file FILE"
175 The file with the journal encryption key.
176 .TP
177 .B "\-\-allow\-discards\fR"
178 Allow the use of discard (TRIM) requests for the device.
179 This option is available since the Linux kernel version 5.7.
180 .TP
181 The dm-integrity target is available since Linux kernel version 4.12.
182 .TP
183 \fBNOTE:\fR
184 Format and activation of an integrity device always require superuser
185 privilege because the superblock is calculated and handled in dm-integrity kernel target.
186
187 .SH LEGACY COMPATIBILITY OPTIONS
188 .TP
189 \fBWARNING:\fR
190 Do not use these options until you need compatibility with specific old kernel.
191 .TP
192 .B "\-\-integrity\-legacy\-padding"
193 Use inefficient legacy padding.
194 .TP
195 .B "\-\-integrity\-legacy\-hmac"
196 Use old flawed HMAC calclation (also does not protect superblock).
197 .TP
198 .B "\-\-integrity\-legacy\-recalculate"
199 Allow insecure recalculating of volumes with HMAC keys (recalcualtion offset in superblock
200 is not protected).
201
202 .SH RETURN CODES
203 Integritysetup returns 0 on success and a non-zero value on error.
204
205 Error codes are:
206     1 wrong parameters
207     2 no permission
208     3 out of memory
209     4 wrong device specified
210     5 device already exists, or device is busy.
211
212 .SH EXAMPLES
213 Format the device with default standalone mode (CRC32C):
214
215 .B "integritysetup format <device>"
216
217 Open the device with default parameters:
218
219 .B "integritysetup open <device> test"
220
221 Format the device in standalone mode for use with HMAC(SHA256):
222
223 .B "integritysetup format <device> \-\-tag\-size 32 \-\-integrity hmac\-sha256 \
224 \-\-integrity\-key\-file <keyfile> \-\-integrity\-key\-size <key_bytes>"
225
226 Open (activate) the device with HMAC(SHA256) and HMAC key in file:
227
228 .B "integritysetup open <device> test \-\-integrity hmac\-sha256 \
229 \-\-integrity\-key\-file <keyfile> \-\-integrity\-key\-size <key_bytes>"
230
231 Dump dm-integrity superblock information:
232
233 .B "integritysetup dump <device>"
234
235 .SH REPORTING BUGS
236 Report bugs, including ones in the documentation, on
237 the cryptsetup mailing list at <dm-crypt@saout.de>
238 or in the 'Issues' section on LUKS website.
239 Please attach the output of the failed command with the
240 \-\-debug option added.
241 .SH AUTHORS
242 The integritysetup tool is written by Milan Broz <gmazyland@gmail.com>
243 and is part of the cryptsetup project.
244 .SH COPYRIGHT
245 Copyright \(co 2016-2021 Red Hat, Inc.
246 .br
247 Copyright \(co 2016-2021 Milan Broz
248
249 This is free software; see the source for copying conditions.  There is NO
250 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
251 .SH SEE ALSO
252 The project website at \fBhttps://gitlab.com/cryptsetup/cryptsetup\fR
253
254 The integrity on-disk format specification available at
255 \fBhttps://gitlab.com/cryptsetup/cryptsetup/wikis/DMIntegrity\fR