32 Commits

Author SHA1 Message Date
Milan Broz
8364178b38 Update copyright year. 2025-01-15 23:09:36 +01:00
Milan Broz
7b5ac650e5 Allow specific integrity key size.
This patch add support for setting of integrity key size
for LUKS2 devices.

It adds new (optional) JSON "key_size" attribute in segment.integrity JSON object.
If not set, the code use hash length size (backward compatible).

For LUKS2, we do not allow smaller keys than 128 bits.

Mostly based on code from Ingo Franzki <ifranzki@linux.ibm.com>
2024-12-03 20:25:54 +01:00
Milan Broz
8b21b4b2ee Fix "allocated buffer size is not a multiple of the pointee's size" warning
No need to play games with void pointers, two separate functions are
much more readable.
2024-07-10 09:47:56 +02:00
Milan Broz
661f57def4 Use SPDX license identifiers.
This patch switches code to SPDX one-line license identifiers according to
https://spdx.dev/learn/handling-license-info/
and replacing long license text headers.

I used C++ format on the first line in style
// SPDX-License-Identifier: <id>
except exported libcryptsetup.h, when only C comments are used.

The only additional changes are:
- switch backend utf8.c from LGPL2+ to LGPL2.1+ (as in systemd)
- add some additional formatting lines.
2024-06-03 16:38:15 +00:00
Milan Broz
bd0ef58b3a Update copyright notice to include 2024 year. 2024-01-23 16:10:44 +01:00
Ondrej Kozina
ad3013dfe4 Simplify crypt_get_hw_encryption_type internals.
Do not take into account cipher specification and rely
solely on segment type in LUKS2 metadata.
2023-07-18 16:29:19 +02:00
Milan Broz
928061f1f0 Print better metadata dump and status info for OPAL segment. 2023-07-17 22:39:26 +01:00
Ondrej Kozina
4d487d5dcf Properly handle authenticated encryption on OPAL device. 2023-07-17 22:39:26 +01:00
Luca Boccassi
b9cc0129c9 libcryptsetup: add OPAL type and params
Signed-off-by: Luca Boccassi <bluca@debian.org>
Co-authored-by: Ondrej Kozina <okozina@redhat.com>
2023-07-17 13:14:52 +02:00
Ondrej Kozina
2712882aa3 Add helper function to change segment size. 2023-06-06 13:44:44 +00:00
Ondrej Kozina
d6107bf241 Refactor json_segment_create_crypt helper.
Refactor crypt segment json helper body into
separate routine so that it can be reused later
in future hw-opal-crypt segment helper.
2023-05-29 11:09:04 +02:00
Ondrej Kozina
fd91de82ad Move integrity fields in json_segment_create_crypt segment helper.
The integrity is optional parameter of dm-crypt segment definition.
Move the low level json code in appropriate json helper.

It will make adding new segment easier. The future hw-opal-crypt
segment will inherit all crypt fields.
2023-05-29 11:09:04 +02:00
Milan Broz
72f799b393 Update Copyright year. 2023-02-09 17:11:18 +01:00
Ondrej Kozina
75e429b8d1 Simplify LUKS2 sector_size helpers. 2022-06-14 15:31:52 +02:00
Ondrej Kozina
e23992d531 Fix bug in json_segment_get_sector_size.
Upper layers always expected 0 on error.
Due to this bug this function could cause
sector_size overflow when segment definition
did not contain 'sector_size' field ('linear').
2022-06-14 15:31:52 +02:00
Ondrej Kozina
1ac6a58475 Simplify LUKS2_segment_first_unused_id(). 2022-04-27 11:50:48 +02:00
Milan Broz
ab975bc1c4 Update copyright year.
And unify format in several places.
2022-01-29 10:43:02 +01:00
Ondrej Kozina
b61ec23e48 Add segments validation for reencryption.
Effective segments during LUKS2 reencryption must
match key characteristics of backup segment
(cipher, sector_size, segment type).
2022-01-12 18:37:52 +01:00
Ondrej Kozina
7de8ff5ccf Expose json_segment_contains_flag to internal library. 2022-01-12 14:01:04 +01:00
Milan Broz
d1d9dd8e20 Update Copyright year. 2021-01-25 22:00:25 +01:00
Ondrej Kozina
e6a3569743 Avoid name clash with newer json-c library.
This is partial revert of previous commit and also
fixes wrong decision to name our internal helpers with
json_object prefix.
2020-04-14 17:24:57 +02:00
Milan Broz
080566a1fd Update copyright year. 2020-01-03 13:04:55 +01:00
Ondrej Kozina
a23e1cf729 LUKS2 code cleanup.
- drop unused code
- drop unused function declarations
- remove local routines from internal api
2019-08-05 18:29:37 +02:00
Ondrej Kozina
b551bdb0ce Make json_segments_count fn return unsigned value. 2019-07-31 14:58:55 +02:00
Milan Broz
1f91fe7a2c Use JSON-debug wrappers. 2019-05-03 14:02:43 +02:00
Ondrej Kozina
a7f80a2770 Add resilient LUKS2 reencryption library code. 2019-05-02 16:44:23 +02:00
Ondrej Kozina
8dc1a74df8 Adapt existing code to future reencryption changes. 2019-03-13 14:56:31 +01:00
Ondrej Kozina
e295d01505 Adding new functions later used in reencryption. 2019-03-13 14:56:31 +01:00
Ondrej Kozina
46bf3c9e9c Add segment create helpers. 2019-03-08 08:44:51 +01:00
Ondrej Kozina
361fb22954 Remove helper get_first_data_offset completely. 2019-03-08 08:43:19 +01:00
Ondrej Kozina
203fe0f4bf Move get_first_data_offset to luks2_segment.c 2019-03-08 08:42:23 +01:00
Ondrej Kozina
8c168cc337 Introduce file for luks2 segments handling. 2019-03-05 17:08:02 +01:00