All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
Cc: linux-security-module@vger.kernel.org
Subject: Re: [PATCH 2/2] KEYS: asymmetric: Fix PKCS#1 decryption of an empty message
Date: Wed, 11 Nov 2026 16:48:29 +0000	[thread overview]
Message-ID: <sashiko-outbox-209325@kernel.org> (raw)
In-Reply-To: <20261111-keyctl-pkey-fixes-v1-2-934ebaa267a7@cispa.de>

> From: Florian Bauckholt <florian.bauckholt@cispa.de>
> 
> KEYCTL_PKEY_DECRYPT with enc=pkcs1 on a valid ciphertext of an empty
> message returns the key size instead of 0, and the output buffer is
> filled with the ciphertext.
> 
> crypto_akcipher_sync_encrypt() returns 0 on success, so
> software_key_eds_op() maps a result of 0 to crypto_akcipher_maxsize().
> The mapping is applied to decryption as well, but
> crypto_akcipher_sync_decrypt() returns the length of the plaintext,
> which is 0 for an empty message. By then crypto_akcipher_sync_post()
> has copied its scratch buffer to the output. pkcs1pad copied nothing
> into that buffer, so it still holds the ciphertext.
> 
> Only the caller's own input is returned, so nothing is disclosed, and
> messages that are not empty are decrypted correctly. An empty message
> is valid, though: RFC 8017 section 7.2 only limits the message length
> to k - 11 octets.
> 
> Apply the mapping to encryption only.
> 
> Fixes: 63ba4d67594a ("KEYS: asymmetric: Use new crypto interface without scatterlists")
> Cc: stable@vger.kernel.org # v6.5+
> Link: https://lore.kernel.org/all/20260919221742.3709658-1-benquike@gmail.com/
> Signed-off-by: Florian Bauckholt <florian.bauckholt@cispa.de>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261111-keyctl-pkey-fixes-v1-0-934ebaa267a7@cispa.de?part=2


  reply	other threads:[~2026-11-11 16:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11 15:56 [PATCH 0/2] KEYS: two fixes for the asymmetric keyctl operations Florian Bauckholt
2026-11-11 15:56 ` Florian Bauckholt via B4 Relay
2026-11-11 15:56 ` [PATCH 1/2] KEYS: fix signature length passed to KEYCTL_PKEY_VERIFY Florian Bauckholt
2026-11-11 15:56   ` Florian Bauckholt via B4 Relay
2026-11-11 16:40   ` sashiko-bot
2026-11-11 22:56   ` Jarkko Sakkinen
2026-11-11 15:56 ` [PATCH 2/2] KEYS: asymmetric: Fix PKCS#1 decryption of an empty message Florian Bauckholt
2026-11-11 15:56   ` Florian Bauckholt via B4 Relay
2026-11-11 16:48   ` sashiko-bot [this message]
2026-11-11 23:01   ` Jarkko Sakkinen

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=sashiko-outbox-209325@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.