Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fscryptctl: add support for adding key by serial (ID) #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

a3f
Copy link

@a3f a3f commented Jul 27, 2021

Since Linux commit torvalds/linux@93edd392ca ("fscrypt: support passing a keyring key
to FS_IOC_ADD_ENCRYPTION_KEY"), it's possible to pass the key ID of
a "fscrypt-provisioning" key that Linux should retrieve the raw key
material from instead of passing it directly from userspace.

This is useful to add fscrypt keys after unmounting and re-mounting.
It would also prove useful should additional key types like trusted keys
be allowed in future.

Thus add a new --serial parameter to add_key to facilitate this.
--serial was chosen over --id to avoid confusion with the KEY_IDENTIFIER
used in the remove_key, key_status and set_policy documentation, which
it is not interchangeable with.


This is PR is applicable regardless of my patch for adding fscrypt support for
trusted keys
.

Should a revised version of that patch be applied, I'll create a new pull request to adjust the documentation here appropriately. There is no code change necessary however, because the API used for fscrypt-provisioning keys is reused.

@google-cla
Copy link

google-cla bot commented Jul 27, 2021

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

fengguang pushed a commit to 0day-ci/linux that referenced this pull request Jul 27, 2021
For both v1 and v2 key setup mechanisms, userspace supplies the raw key
material to the kernel after which it is never again disclosed to
userspace.

Use of encrypted and trusted keys offers stronger guarantees:
The key material is generated within the kernel and is never disclosed to
userspace in clear text and, in the case of trusted keys, can be
directly rooted to a trust source like a TPM chip.

Add support for trusted and encrypted keys by repurposing
fscrypt_add_key_arg::raw to hold the key description when the new
FSCRYPT_KEY_ARG_TYPE_DESC flag is supplied. The location of the flag
was previously reserved and enforced by ioctl code to be zero, so this
change won't break backwards compatibility.

Corresponding userspace patches are available for fscryptctl:
google/fscryptctl#23

Signed-off-by: Ahmad Fatoum <[email protected]>
@a3f
Copy link
Author

a3f commented Aug 6, 2021

@googlebot I signed it!

Since Linux commit 93edd392ca ("fscrypt: support passing a keyring key
to FS_IOC_ADD_ENCRYPTION_KEY"), it's possible to pass the key ID of
a "fscrypt-provisioning" key that Linux should retrieve the raw key
material from instead of passing it directly from userspace.

This is useful to add fscrypt keys after unmounting and re-mounting.
It would also prove useful should additional key types like trusted keys
be allowed in future.

Thus add a new --serial parameter to add_key to facilitate this.
--serial was chosen over --id to avoid confusion with the KEY_IDENTIFIER
used in the remove_key, key_status and set_policy documentation, which
it is not interchangeable with.

Signed-off-by: Ahmad Fatoum <[email protected]>
@a3f a3f force-pushed the trusted-encrypted branch from bace9a0 to 64ffd59 Compare August 6, 2021 14:55
@a3f a3f changed the title fscryptctl: add support for encrypted and trusted keys fscryptctl: add support for adding key by serial (ID) Aug 6, 2021
@a3f a3f marked this pull request as ready for review August 6, 2021 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant