Re: [RFC PATCH 9/9] KEYS: keycrypt: Add the aes256-gcm-stream algorithm

From: Jarkko Sakkinen

Date: Wed Nov 18 2026 - 19:55:29 EST


On Wed, Nov 18, 2026 at 07:25:09PM -0500, Demi Marie Obenour wrote:
> On 11/18/26 9:12 AM, Rodolfo Giometti wrote:
> > This patch is a proposal on its own: nothing before it needs it, so it
> > can be discussed, or left out, apart from the rest.

If there is no one who needs this, this is literally throwing a dice
with Claude.

> >
> > aes256-cbc does not authenticate what it decrypts, and a file or a
> > transfer longer than one call cannot be sealed with a single AES-GCM
> > invocation without buffering all of it, nor decrypted without
> > releasing plaintext before its tag is checked.
> >
> > Add aes256-gcm-stream: the STREAM construction (Hoang, Reyhanitabar,
> > Rogaway, Vizar) over AES-256-GCM. A message is split into segments
> > of up to 64 KiB, each sealed with its own tag under a subkey derived
> > with HKDF-SHA256 from the key and a 16-byte salt drawn at
> > KEYCTL_CRYPT_OPEN; the nonce carries the segment's position and a
> > last-segment flag, and the counter lives in the kernel, so segments
> > can be neither reordered nor dropped from the end unnoticed. The
> > segments go through a new ioctl, KEYCRYPT_IOC_SEGMENT, and
> > KEYCRYPT_IOC_FINAL reports a stream whose last segment never came.
> > A tee or hsm backend draws the salt and keeps the counter in its
> > secure side; the sw and optee backends implement it.
>
> Please use Cobblestone-128 or Cobblestone-256 instead.
> https://c2sp.org/chunked-encryption has the spec, and you can check
> against the implementation in pyca/cryptography or (for Cobblestone-128)
> the Go package filippo.io/cobblestone. This assumes your CPU has AES
> and GCM instructions; if not, you should see about using one that does
> or work with a cryptographer to standardize an alternative that doesn't
> need them.
>
> Nonstandard constructions like this one are to be avoided.

The wider problem in crypto without a use case there is nothing
to protect.

> --
> Sincerely,
> Demi Marie Obenour (she/her/hers)


Br, Jarkko