Commit Graph

4644 Commits

Author SHA1 Message Date
Milan Broz
36809e1fa2 ci: Try to build fuzzers without Docker image 2025-11-30 20:08:56 +01:00
Kristina Hanicova
f1ba606c28 ci: Add debian unstable (sid) 2025-11-28 20:46:56 +01:00
Ondrej Kozina
5d69c34f59 Reinstate pbkdf serialization flag in device activation.
crypt_activate_by_keyslot_context never respected pbkdf serialation
flag (CRYPT_ACTIVATE_SERIALIZE_MEMORY_HARD_PBKDF).

In fact it worked only when device was activated via passphrase or via
passphrase file. It was never respected when device was activated
by a token for example.

When the internal code was fully switched to activation via keyslot
context the legacy code for passphrase based activation was dropped
and we lost track of serialization flag completely.

This fixes all of the issues so now the serialization flag will be
respected also with tokens (and all other activation methods unlocking
LUKS2 keyslot with memory hard pbkdf).

Fixes: 58385d68d8 (Allow activation via keyslot context)
Fixes: #968.
2025-11-27 14:51:44 +01:00
Ondrej Kozina
e1cbd4ecba tests: add simple verification test for --serialize-memory-hard-pbkdf 2025-11-27 14:51:32 +01:00
Kfir Kahanov
9ea9af1bcd tests: Add Bitlocker images for clearkey 2025-11-21 22:07:01 +02:00
Kfir Kahanov
4fe1601d9c bitlocker: Open bitlocker devices with clearkey
Always trying to open with clearkey when available
2025-11-21 22:07:01 +02:00
Kfir Kahanov
72173b2777 bitlocker: Handle getting NULL passwords 2025-11-21 22:07:01 +02:00
Kfir Kahanov
f304132b2b bitlocker: Support clearkey
Clearkey does not mean partially encrypted, and may be on fully
encrypted volumes.
2025-11-21 22:07:01 +02:00
Milan Broz
0779c8ceed Explicitly mention units (bytes) for volume key in header. 2025-11-21 16:34:47 +01:00
Milan Broz
153aed3d16 Fix key-size descriptions
For compatibility reasons, cryptsetup uses key size in BITS
while integritysetup in BYTES.

The help is confusing here, this patch fixes it.

Thanks Daniel Tang for notification.
2025-11-21 16:34:47 +01:00
Milan Broz
8a3e16fa25 tests: Avoid verity concurrent test failure on device node check
This regularly crashes on Alpine Linux that use some strange
configuration.
Udev settle seems to help, despite it should be noop on recent systems...
2025-11-21 14:29:38 +01:00
Milan Broz
8da66c3066 verity: Support status info about FEC repaired events
Kernel 6.19 will support additional info on dm-verity status
line that contains number of FEC successful repair events.

This patch adds support to libcryptsetup and veritysetup status command.

Ref. https://lore.kernel.org/dm-devel/074e1ecc-6690-1c22-0dba-454e191e1b6f@redhat.com/T/#m1af31c9c4263fe2b1fb58dee2fd7f0bdf045c463
2025-11-20 17:18:37 +01:00
Milan Broz
11a4fc6790 tests: use utility to detect FIPS mode
Also try to use crypto lib/kernel check where appropriate.

This can be useful for local testing (non-FIPS kernel) byt
should not break real FIPS systems.
2025-11-19 22:09:27 +01:00
Milan Broz
e4c498d15b Remove fips argument from crypt_backend_init()
It is really not needed, as it is detected automagically.
2025-11-19 22:09:27 +01:00
Milan Broz
e609c47916 tests: Add fips mode detection to crypt check tool 2025-11-19 22:09:27 +01:00
Milan Broz
ccc0c69cd7 Add fips_mode check for kernel.
Akso add a separate function so we can detect that kernel and crypto
lib is in different FIPS state (only for testing).
2025-11-19 22:09:27 +01:00
Milan Broz
7fba92260a ci: Fix Alpine runner dependences
gettext-dev install asli gettext.
argp-standalone is needed for with musl
This ensures that we can later use simplified package mappings.
2025-11-19 18:16:17 +01:00
Milan Broz
76ea8f13cf tests: Fix coding style (tabs) 2025-11-18 19:39:18 +01:00
Ondrej Kozina
bbc053682a Do not read test hotzone device repeatadly.
While allocating internal data structure for a device
overlaying reencryption hotzone we accidentally read
tested the device in each reencryption step. This
was suboptimal so now the device is read only once
while initializing the reencryption device-mapper stack.
2025-11-17 13:56:39 +01:00
Milan Broz
c9fd8b5ed4 Set devel version. 2025-11-17 13:55:40 +01:00
Kristina Hanicova
fbd295259c ci: remove ubuntu 2025-11-14 15:47:28 +01:00
Ondrej Kozina
5490d28aa4 Drop never used code in storage wrapper utils.
It was never used...
2025-11-13 15:24:12 +01:00
Ingo Franzki
296eb39c60 Changes to support PHMAC with integritysetup and cryptsetup
Make the PHMAC integrity algorithm know to libcryptsetup.

The size of a key for PHMAC is not known, because PHMAC gets an opaque
blob as key, who's physical size has nothing to do with the cryptographic
size. Thus, let INTEGRITY_key_size() and crypt_parse_integrity_mode()
return the required_key_size as key size for PHMAC, or -EINVAL if
required_key_size is zero, to indicate that the size is unknown.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
2025-11-13 09:21:40 +01:00
Ondrej Kozina
917b6836a9 Always use json-c types in internal code.
Sometimes we used "struct json_foo_bar" and sometimes "json_foo_bar"
json-c defined type. Stick with one notation in internal code.
2025-11-12 13:13:02 +01:00
Ondrej Kozina
b36d4be8fa opal: supress confusing debug messages.
Do not print sed-opal spefic debug messages with confusing
error codes if ioctl() call failed with -1. Usually that means
the kernel does not support sed-opal interface or the requested
ioctl number is not implemented.
2025-11-06 11:14:56 +01:00
Ondrej Kozina
0a8e7da7ae opal: fix debug message on failed sed-opal ioctl.
ioctl syscall always returns -1 on error (see ioctl(2)).
On error the actual reason is reported via errno varible.
Let's store the original errno code in the variable
so that it can be printed out in debug mode.

Before this fix the debug message always reported "Operation not
permited" (the translation of errno EPERM (1)).
2025-11-06 11:09:43 +01:00
Ondrej Kozina
83a7310ca2 opal: do not initialize LRs array in activation.
The lr member in opal_lr_act kernel structure is
ingnored unless the device is being activated in SUM
mode.

See kernel implementation of IOC_OPAL_ACTIVATE_LSP
in block/sed-opal.c
2025-11-03 16:05:08 +01:00
Ondrej Kozina
441802773f opal: simplify User setup routine.
Reduce memory copying by reusing nested structure in opal_lock.
2025-11-03 16:05:08 +01:00
Ondrej Kozina
cc66b1fa52 opal: pull User setup in separate function. 2025-11-03 16:05:08 +01:00
Ondrej Kozina
a0d5d2bf5e opal: pull individual range setup in separate function. 2025-11-03 16:05:08 +01:00
Ondrej Kozina
61dbb69319 opal: pull reuse of active device in separate function. 2025-11-03 16:05:08 +01:00
Ondrej Kozina
32b33541a8 opal: pull LSP activation in separate function. 2025-11-03 16:05:08 +01:00
Ondrej Kozina
346db2e42a opal: add a named constant for TCG FAIL status.
Will be checked upon later when we add support
for OPAL2 SUM Reactivate method.
2025-11-03 16:05:08 +01:00
Milan Broz
0d07e80077 Fix typo in volume-key-file help.
Fixes: #966
2025-11-03 10:58:15 +01:00
Milan Broz
dc2251b88d man: Fix typo in integritysetup man page. 2025-10-31 08:31:21 +01:00
Ondrej Kozina
a8e8e39007 Fix possible use of uninitialized variable.
device_tag_size variable was not initialized and used
when device_is_nop_dif returned negative error code.
2025-10-30 13:59:54 +01:00
Kristina Hanicova
bcef385346 ci: Add Centos Stream 10 runner 2025-10-19 22:20:47 +02:00
Ondrej Kozina
9810c6fb2f Read integrity profile info from top level device.
When formating device with --integrity-inline option
there's a check if underlying device properly advertise
integrity profile support. The check did not work
properly for partition device nodes. We have to read
integrity profile info from top level block device.

Fixes: #964.
2025-10-17 15:25:32 +02:00
Ondrej Kozina
4d98add260 opal: Submit PSID reset command to R/W file descriptor.
The PSID reset erases the block device it's submitted to
succesfully.

By submitting the command to read-only fd previously
there were partition device nodes still visible in
the /dev directory because kernel does not trigger rescan
after OPAL2 PSID reset. Even though all the partition were
actually erased (including the partition table).

We workaround the issue by submitting the PSID reset
to R/W fd so that it triggers rescan event on close.
2025-10-06 10:37:37 +02:00
Milan Broz
0eaaa4553e Fix handling of too long label and subsystem fields
These LUKS2 labels are stored in the binary header area that has limited size.

While we have been silently truncating strings here, it is something that
is not expected, as the final label is then different than expected.

Let's fix the code to explicitly print and return error here.

Also remove the comment about duplicate check. It is incorrect  optimization,
as some users will expect a real write on disk, we should no skip it.

Fixes: #958
2025-10-01 21:41:55 +02:00
Ondrej Kozina
3a8feb8be7 Improve check for a function attribute support.
The compiler may advertise function attribute support
with __has_attribute operator even though it does
not implement the feature on some architecture.

This fixes the issue with  GCC 11 on ppc64le with
__attribute__((zero_call_used_regs("used"))).

Fixes: #959.
2025-09-11 14:18:39 +02:00
Kristina Hanicova
2b9523a1ef ci: Remove rhel runner 2025-08-29 15:21:26 +02:00
Maxim Suhanov
68d4749d8a bitlk: implement validation of FVE metadata
This commit implements FVE metadata block validation based on:
* CRC-32 (to detect random corruption);
* AES-CCM-encrypted SHA-256 (to detect malicious manipulations).

The hash-based validation requires us to decrypt the VMK first, so
it's only performed when obtaining the volume key.

This allows us to detect corrupted/altered FVE metadata blocks and
pick the valid one (before this commit: the first FVE metadata block
is always selected).

Fixes: #953

tests: add BitLocker image with corrupted headers

The image contains 2 manually corrupted metadata blocks (out of 3),
the library should use the third one to correctly load the volume.

Signed-off-by: Maxim Suhanov <dfirblog@gmail.com>
2025-08-29 15:16:36 +02:00
Milan Broz
9cfdd6ba06 Version 2.8.1. v2.8.1 2025-08-19 10:57:12 +02:00
Marián Haburaj
4749473c39 po: update sk.po (from translationproject.org) 2025-08-18 20:02:14 +02:00
Milan Broz
4a1384452c Add release notes for 2.8.1. 2025-08-18 16:38:45 +02:00
Milan Broz
b0821b11a5 Add the same cipher_null restriction to LUKS2 keyslot as in LUKS1.
LUKS2 keyslot cannot be created with cipher_null using standard
tools, but activation of such a keyslot is allowed.

As this can be confusing and create a false sense of security,
let's apply the same restriction as in LUKS1 - such a keyslot
is used only with an empty passphrase.

This will reject activation with a real password, avoiding
possible activation of insecure LUKS containers.

Fixes: #954
2025-08-18 08:22:51 +02:00
Milan Broz
098d2122e5 Remove redundant test in LUKS2 keyslot cipher incompatible test.
The null_cipher is tested twice there.
2025-08-18 08:22:51 +02:00
Jakub Bogusz
df58aa5aee po: update pl.po (from translationproject.org) 2025-08-18 08:21:53 +02:00
Antonio Ceballos
9e9f6bcb5b po: update es.po (from translationproject.org) 2025-08-18 08:21:53 +02:00