Allow linking multiple VKs (also in reencryption).

If the device is in reencryption, it has two active volume keys. Linking
the VK to keyring is not supported for such devices, because the API
only counts with one key. This commit modifies the API
crypt_set_keyring_to_link to allow passing multiple keyring key names.
This commit is contained in:
Daniel Zatovic
2023-11-22 17:41:11 +01:00
committed by Daniel Zaťovič
parent e0eb4dad95
commit 5814b39cdd
5 changed files with 237 additions and 60 deletions

View File

@@ -382,6 +382,7 @@ bool LUKS2_segments_dynamic_size(struct luks2_hdr *hdr);
int LUKS2_reencrypt_digest_new(struct luks2_hdr *hdr);
int LUKS2_reencrypt_digest_old(struct luks2_hdr *hdr);
unsigned LUKS2_reencrypt_vks_count(struct luks2_hdr *hdr);
int LUKS2_reencrypt_data_offset(struct luks2_hdr *hdr, bool blockwise);
/*

View File

@@ -183,6 +183,21 @@ int LUKS2_reencrypt_digest_old(struct luks2_hdr *hdr)
return reencrypt_digest(hdr, 0);
}
unsigned LUKS2_reencrypt_vks_count(struct luks2_hdr *hdr)
{
int digest_old, digest_new;
unsigned vks_count = 0;
if ((digest_new = LUKS2_reencrypt_digest_new(hdr)) >= 0)
vks_count++;
if ((digest_old = LUKS2_reencrypt_digest_old(hdr)) >= 0) {
if (digest_old != digest_new)
vks_count++;
}
return vks_count;
}
/* none, checksums, journal or shift */
static const char *reencrypt_resilience_type(struct luks2_hdr *hdr)
{