From: Demi Marie Obenour <demiobenour@gmail.com>
To: Rodolfo Giometti <giometti@enneenne.com>,
David Howells <dhowells@redhat.com>,
Jarkko Sakkinen <jarkko@kernel.org>,
keyrings@vger.kernel.org
Cc: "Herbert Xu" <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
"Jens Wiklander" <jenswi@kernel.org>,
"Sumit Garg" <sumit.garg@kernel.org>,
op-tee@lists.trustedfirmware.org,
"Horia Geantă" <horia.geanta@nxp.com>,
"Pankaj Gupta" <pankaj.gupta@nxp.com>,
"Sahil Malhotra" <sahil.malhotra@nxp.com>,
"Ahmad Fatoum" <a.fatoum@pengutronix.de>,
"Richard Weinberger" <richard@nod.at>,
"Christophe Leroy (CS GROUP)" <chleroy@kernel.org>,
"Eric Biggers" <ebiggers@kernel.org>,
"Arnd Bergmann" <arnd@arndb.de>,
"Paul Moore" <paul@paul-moore.com>,
"James Morris" <jmorris@namei.org>,
"Serge E. Hallyn" <serge@hallyn.com>,
"Jonathan Corbet" <corbet@lwn.net>,
"Shuah Khan" <skhan@linuxfoundation.org>,
"Randy Dunlap" <rdunlap@infradead.org>,
linux-crypto@vger.kernel.org, linux-integrity@vger.kernel.org,
linux-security-module@vger.kernel.org,
linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org,
linux-api@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 0/9] KEYS: keycrypt: keys that user space can use but never read
Date: Wed, 18 Nov 2026 18:42:15 -0500 [thread overview]
Message-ID: <650f89ef-9745-4f75-b254-80fa5ac4773d@gmail.com> (raw)
In-Reply-To: <20261118140421.584086-1-giometti@enneenne.com>
[-- Attachment #1.1: Type: text/plain, Size: 1640 bytes --]
On 11/18/26 9:04 AM, Rodolfo Giometti wrote:
> This RFC proposes a key type, "keycrypt", whose material user space can
> use for symmetric operations but never read: AES-256-CBC, HMAC-SHA256
> and an authenticated AES-256-GCM stream, through a file descriptor that
> KEYCTL_CRYPT_OPEN returns for one key and one operation.
I haven't looked at the API, but from a cryptographic perspective,
this encourages very poor practices. AES-GCM even allows userspace
to extract the secret authentication key.
AES-256-CBC isn't a suitable mode on its own, unless it's combined
with a MAC in encrypt-then-MAC. Even then, it has a 2^64 birthday
bound, so it should only be used 2^48 times with a single key unless
the key is ephemeral.
AES-GCM is not a suitable algorithm either. If you allow encrypting
with a key loaded from persistent storage, there is no way for the API
to ensure it is only used with a unique nonce. Nonce reuse leaks the
authentication key and allows forgeries. Using random nonces isn't
good enough either: NIST only allows 2^32 encryptions in this case,
and the API can't enforce that limit.
For long-term keys, all of the following are much safer choices.
They have 192-bit nonces, which means that one can generate them
at random for each encryption without any problems.
- XAES-256-GCM
- XChaCha20-Poly1305
- AEGIS-256
AES-GCM-SIV is also okay, provided that you are fine with occasionally
leaking if two plaintexts are equal. This happens whenever there is
a nonce collision, so with probability 2^-32 after 2^32 encryptions.
--
Sincerely,
Demi Marie Obenour (she/her/hers)
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Demi Marie Obenour <demiobenour@gmail.com>
To: Rodolfo Giometti <giometti@enneenne.com>,
David Howells <dhowells@redhat.com>,
Jarkko Sakkinen <jarkko@kernel.org>,
keyrings@vger.kernel.org
Cc: "Herbert Xu" <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
"Jens Wiklander" <jenswi@kernel.org>,
"Sumit Garg" <sumit.garg@kernel.org>,
op-tee@lists.trustedfirmware.org,
"Horia Geantă" <horia.geanta@nxp.com>,
"Pankaj Gupta" <pankaj.gupta@nxp.com>,
"Ahmad Fatoum" <a.fatoum@pengutronix.de>,
"Richard Weinberger" <richard@nod.at>,
"Christophe Leroy (CS GROUP)" <chleroy@kernel.org>,
"Eric Biggers" <ebiggers@kernel.org>,
"Arnd Bergmann" <arnd@arndb.de>,
"Paul Moore" <paul@paul-moore.com>,
"James Morris" <jmorris@namei.org>,
"Serge E. Hallyn" <serge@hallyn.com>,
"Jonathan Corbet" <corbet@lwn.net>,
"Shuah Khan" <skhan@linuxfoundation.org>,
"Randy Dunlap" <rdunlap@infradead.org>,
linux-crypto@vger.kernel.org, linux-integrity@vger.kernel.org,
linux-security-module@vger.kernel.org,
linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org,
linux-api@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 0/9] KEYS: keycrypt: keys that user space can use but never read
Date: Wed, 18 Nov 2026 18:42:15 -0500 [thread overview]
Message-ID: <650f89ef-9745-4f75-b254-80fa5ac4773d@gmail.com> (raw)
In-Reply-To: <20261118140421.584086-1-giometti@enneenne.com>
[-- Attachment #1.1: Type: text/plain, Size: 1640 bytes --]
On 11/18/26 9:04 AM, Rodolfo Giometti wrote:
> This RFC proposes a key type, "keycrypt", whose material user space can
> use for symmetric operations but never read: AES-256-CBC, HMAC-SHA256
> and an authenticated AES-256-GCM stream, through a file descriptor that
> KEYCTL_CRYPT_OPEN returns for one key and one operation.
I haven't looked at the API, but from a cryptographic perspective,
this encourages very poor practices. AES-GCM even allows userspace
to extract the secret authentication key.
AES-256-CBC isn't a suitable mode on its own, unless it's combined
with a MAC in encrypt-then-MAC. Even then, it has a 2^64 birthday
bound, so it should only be used 2^48 times with a single key unless
the key is ephemeral.
AES-GCM is not a suitable algorithm either. If you allow encrypting
with a key loaded from persistent storage, there is no way for the API
to ensure it is only used with a unique nonce. Nonce reuse leaks the
authentication key and allows forgeries. Using random nonces isn't
good enough either: NIST only allows 2^32 encryptions in this case,
and the API can't enforce that limit.
For long-term keys, all of the following are much safer choices.
They have 192-bit nonces, which means that one can generate them
at random for each encryption without any problems.
- XAES-256-GCM
- XChaCha20-Poly1305
- AEGIS-256
AES-GCM-SIV is also okay, provided that you are fine with occasionally
leaking if two plaintexts are equal. This happens whenever there is
a nonce collision, so with probability 2^-32 after 2^32 encryptions.
--
Sincerely,
Demi Marie Obenour (she/her/hers)
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2026-11-18 23:42 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 14:04 [RFC PATCH 0/9] KEYS: keycrypt: keys that user space can use but never read Rodolfo Giometti
2026-11-18 14:04 ` Rodolfo Giometti
2026-11-18 14:04 ` [RFC PATCH 1/9] KEYS: keycrypt: Add a key type for keys user space never reads Rodolfo Giometti
2026-11-18 14:04 ` Rodolfo Giometti
2026-11-18 14:33 ` sashiko-bot
2026-11-18 14:04 ` [RFC PATCH 2/9] KEYS: keycrypt: Add the sw backend Rodolfo Giometti
2026-11-18 14:04 ` Rodolfo Giometti
2026-11-18 14:21 ` sashiko-bot
2026-11-18 14:04 ` [RFC PATCH 3/9] KEYS: keycrypt: Add the OP-TEE backend Rodolfo Giometti
2026-11-18 14:04 ` Rodolfo Giometti
2026-11-18 14:33 ` sashiko-bot
2026-11-18 14:33 ` sashiko-bot--- via OP-TEE
2026-11-18 14:07 ` [RFC PATCH 4/9] docs: keycrypt: document keycrypt keys Rodolfo Giometti
2026-11-18 14:07 ` Rodolfo Giometti
2026-11-18 14:19 ` sashiko-bot
2026-11-18 14:08 ` [RFC PATCH 5/9] MAINTAINERS: add KEYS-KEYCRYPT Rodolfo Giometti
2026-11-18 14:08 ` Rodolfo Giometti
2026-11-18 14:09 ` [RFC PATCH 6/9] KEYS: keycrypt: Add the engine tier Rodolfo Giometti
2026-11-18 14:09 ` Rodolfo Giometti
2026-11-18 14:17 ` sashiko-bot
2026-11-18 14:10 ` [RFC PATCH 7/9] crypto: caam - add an internal cbc(paes) taking the blob's key modifier Rodolfo Giometti
2026-11-18 14:10 ` Rodolfo Giometti
2026-11-18 14:24 ` sashiko-bot
2026-11-18 14:11 ` [RFC PATCH 8/9] KEYS: keycrypt: Add the CAAM backend Rodolfo Giometti
2026-11-18 14:11 ` Rodolfo Giometti
2026-11-18 14:36 ` sashiko-bot
2026-11-18 14:12 ` [RFC PATCH 9/9] KEYS: keycrypt: Add the aes256-gcm-stream algorithm Rodolfo Giometti
2026-11-18 14:12 ` Rodolfo Giometti
2026-11-18 14:30 ` sashiko-bot
2026-11-19 0:25 ` Demi Marie Obenour
2026-11-19 0:25 ` Demi Marie Obenour
2026-11-19 0:55 ` Jarkko Sakkinen
2026-11-19 0:55 ` Jarkko Sakkinen via OP-TEE
2026-11-18 14:31 ` [RFC PATCH 0/9] KEYS: keycrypt: keys that user space can use but never read Jarkko Sakkinen
2026-11-18 14:31 ` Jarkko Sakkinen via OP-TEE
2026-11-18 14:39 ` Jarkko Sakkinen
2026-11-18 14:39 ` Jarkko Sakkinen via OP-TEE
2026-11-18 14:57 ` Marco Felsch
2026-11-18 14:57 ` Marco Felsch
2026-11-18 15:07 ` Jarkko Sakkinen
2026-11-18 15:07 ` Jarkko Sakkinen via OP-TEE
2026-11-19 10:18 ` Rodolfo Giometti
2026-11-19 10:18 ` Rodolfo Giometti
2026-11-18 23:42 ` Demi Marie Obenour [this message]
2026-11-18 23:42 ` Demi Marie Obenour
2026-11-19 0:37 ` Jarkko Sakkinen
2026-11-19 0:37 ` Jarkko Sakkinen via OP-TEE
2026-11-19 0:43 ` Demi Marie Obenour
2026-11-19 0:43 ` Demi Marie Obenour
2026-11-19 1:01 ` Jarkko Sakkinen
2026-11-19 1:01 ` Jarkko Sakkinen via OP-TEE
2026-11-19 4:35 ` Demi Marie Obenour
2026-11-19 4:35 ` Demi Marie Obenour
2026-11-19 5:01 ` Jarkko Sakkinen
2026-11-19 5:01 ` Jarkko Sakkinen via OP-TEE
2026-11-19 12:17 ` Rodolfo Giometti
2026-11-19 12:17 ` Rodolfo Giometti
2026-11-19 10:19 ` Rodolfo Giometti
2026-11-19 10:19 ` Rodolfo Giometti
2026-11-19 14:33 ` Jarkko Sakkinen
2026-11-19 14:33 ` Jarkko Sakkinen via OP-TEE
2026-11-19 18:33 ` Rodolfo Giometti
2026-11-19 18:33 ` Rodolfo Giometti
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=650f89ef-9745-4f75-b254-80fa5ac4773d@gmail.com \
--to=demiobenour@gmail.com \
--cc=a.fatoum@pengutronix.de \
--cc=arnd@arndb.de \
--cc=chleroy@kernel.org \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=dhowells@redhat.com \
--cc=ebiggers@kernel.org \
--cc=giometti@enneenne.com \
--cc=herbert@gondor.apana.org.au \
--cc=horia.geanta@nxp.com \
--cc=jarkko@kernel.org \
--cc=jenswi@kernel.org \
--cc=jmorris@namei.org \
--cc=keyrings@vger.kernel.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=op-tee@lists.trustedfirmware.org \
--cc=pankaj.gupta@nxp.com \
--cc=paul@paul-moore.com \
--cc=rdunlap@infradead.org \
--cc=richard@nod.at \
--cc=sahil.malhotra@nxp.com \
--cc=serge@hallyn.com \
--cc=skhan@linuxfoundation.org \
--cc=sumit.garg@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.