Skip to content

Commit

Permalink
Make get_policy show the data unit size
Browse files Browse the repository at this point in the history
Display the data unit size based on the field
fscrypt_policy_v2::log2_data_unit_size, new in Linux v6.7.
  • Loading branch information
ebiggers committed Oct 2, 2023
1 parent 2327468 commit cc4d85b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions fscryptctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,11 @@ static void show_v2_encryption_policy(const struct fscrypt_policy_v2 *policy) {
show_encryption_mode(policy->contents_encryption_mode, "Contents");
show_encryption_mode(policy->filenames_encryption_mode, "Filenames");
show_policy_flags(policy->flags);
if (policy->log2_data_unit_size) {
printf("\tData unit size: %u\n", 1U << policy->log2_data_unit_size);
} else {
printf("\tData unit size: default\n");
}
}

// For a specified file or directory with encryption enabled, print the
Expand Down
3 changes: 2 additions & 1 deletion test.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ def describe_policy(path=TEST_DIR, key=TEST_KEY, contents="AES-256-XTS",
out += "\tMaster key identifier: {}\n".format(key["identifier"])
out += "\tContents encryption mode: {}\n".format(contents)
out += "\tFilenames encryption mode: {}\n".format(filenames)
out += "\tFlags: {}".format(flags)
out += "\tFlags: {}\n".format(flags)
out += "\tData unit size: default"
return out


Expand Down

0 comments on commit cc4d85b

Please sign in to comment.