From: Herbert Xu <herbert@gondor.apana.org.au>
To: Ignat Korchagin <ignat@cloudflare.com>
Cc: "David S . Miller" <davem@davemloft.net>,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-team@cloudflare.com
Subject: Re: [PATCH v2] crypto: akcipher - default implementation for setting a private key
Date: Fri, 9 Sep 2022 17:07:41 +0800 [thread overview]
Message-ID: <YxsCXdftDX2OPJ9r@gondor.apana.org.au> (raw)
In-Reply-To: <20220831183706.1600-1-ignat@cloudflare.com>
On Wed, Aug 31, 2022 at 07:37:06PM +0100, Ignat Korchagin wrote:
> Changes from v1:
> * removed the default implementation from set_pub_key: it is assumed that
> an implementation must always have this callback defined as there are
> no use case for an algorithm, which doesn't need a public key
>
> Many akcipher implementations (like ECDSA) support only signature
> verifications, so they don't have all callbacks defined.
>
> Commit 78a0324f4a53 ("crypto: akcipher - default implementations for
> request callbacks") introduced default callbacks for sign/verify
> operations, which just return an error code.
>
> However, these are not enough, because before calling sign the caller would
> likely call set_priv_key first on the instantiated transform (as the
> in-kernel testmgr does). This function does not have a default stub, so the
> kernel crashes, when trying to set a private key on an akcipher, which
> doesn't support signature generation.
>
> I've noticed this, when trying to add a KAT vector for ECDSA signature to
> the testmgr.
>
> With this patch the testmgr returns an error in dmesg (as it should)
> instead of crashing the kernel NULL ptr dereference.
>
> Fixes: 78a0324f4a53 ("crypto: akcipher - default implementations for request callbacks")
> Signed-off-by: Ignat Korchagin <ignat@cloudflare.com>
> ---
> crypto/akcipher.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
prev parent reply other threads:[~2022-09-09 9:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-31 18:37 Ignat Korchagin
2022-09-09 9:07 ` Herbert Xu [this message]
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=YxsCXdftDX2OPJ9r@gondor.apana.org.au \
--to=herbert@gondor.apana.org.au \
--cc=davem@davemloft.net \
--cc=ignat@cloudflare.com \
--cc=kernel-team@cloudflare.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®