[RFC PATCH 1/9] KEYS: keycrypt: Add a key type for keys user space never reads
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Wed Nov 18 14:33:10 UTC 2026
> Programs that encrypt, decrypt or authenticate data with a symmetric
> key today hold that key: in a file, in a "user" or "logon" key handed
> to AF_ALG, or in memory a compromised process can read. On a device
> with a TEE or a crypto engine able to keep keys, nothing lets an
> ordinary program use such a key through a kernel interface, with the
> key fixed to one algorithm and purpose and never released.
>
> Add the "keycrypt" key type. A key is created by a backend ("new"),
> sealed from a key given in clear by CAP_SYS_ADMIN ("import", behind
> CONFIG_KEYCRYPT_IMPORT), or re-created from the blob its backend
> sealed ("load"); its algorithm (aes256-cbc, hmac-sha256), purpose and
> protection tier (kernel, tee, hsm) are fixed at creation and
> authenticated in the blob. User space reads only the blob.
>
> This adds a user API: KEYCTL_CRYPT_OPEN opens an operation context on
> a key, a file descriptor whose ioctls run the operation in the key's
> backend, as the documentation describes. Two system policies come as
> sysctls and boot parameters, both one-way: the system tier, a floor on
> the use of keys whose starting value is chosen at build time
> (CONFIG_KEYCRYPT_SYSTEM_TIER_*), and an import switch.
>
> Backends register through keycrypt_register_backend(); none is added
> here, so a well-formed add_key() fails with ENODEV until one is.
>
> Signed-off-by: Rodolfo Giometti <giometti at enneenne.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261118140421.584086-1-giometti@enneenne.com?part=1
More information about the Linux-security-module-archive
mailing list