Keyrings Archive mirror
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Lukas Wunner <lukas@wunner.de>
Cc: "David S. Miller" <davem@davemloft.net>,
	Klara Modin <klarasmodin@gmail.com>,
	klara@kasm.eu, Denis Kenzior <denkenz@gmail.com>,
	Marcel Holtmann <marcel@holtmann.org>,
	Andrew Zaborowski <andrew.zaborowski@intel.com>,
	Zoltan Kelemen <zoltan@kelemen.se>,
	Kevin Jones <vcsjones@github.com>,
	linux-crypto@vger.kernel.org, keyrings@vger.kernel.org,
	iwd@lists.linux.dev, Eric Biggers <ebiggers@google.com>,
	Stefan Berger <stefanb@linux.ibm.com>,
	Tadeusz Struk <tstruk@gigaio.com>,
	David Howells <dhowells@redhat.com>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	Ignat Korchagin <ignat@cloudflare.com>,
	Stephan Mueller <smueller@chronox.de>,
	Varad Gautam <varadgautam@google.com>,
	Saulo Alessandre <saulo.alessandre@tse.jus.br>
Subject: Re: [PATCH cryptodev-2.6] crypto: rsassa-pkcs1 - Reinstate support for legacy protocols
Date: Sun, 10 Nov 2024 11:54:20 +0800	[thread overview]
Message-ID: <ZzAubO_g5rKQy8Fv@gondor.apana.org.au> (raw)
In-Reply-To: <6dc2b6afd9c4c5e9577acf2448cdcba41378e859.1730193800.git.lukas@wunner.de>

On Tue, Oct 29, 2024 at 11:24:57AM +0100, Lukas Wunner wrote:
> Commit 1e562deacecc ("crypto: rsassa-pkcs1 - Migrate to sig_alg backend")
> enforced that rsassa-pkcs1 sign/verify operations specify a hash
> algorithm.  That is necessary because per RFC 8017 sec 8.2, a hash
> algorithm identifier must be prepended to the hash before generating or
> verifying the signature ("Full Hash Prefix").
> 
> However the commit went too far in that it changed user space behavior:
> KEYCTL_PKEY_QUERY system calls now return -EINVAL unless they specify a
> hash algorithm.  Intel Wireless Daemon (iwd) is one application issuing
> such system calls (for EAP-TLS).
> 
> Closer analysis of the Embedded Linux Library (ell) used by iwd reveals
> that the problem runs even deeper:  When iwd uses TLS 1.1 or earlier, it
> not only queries for keys, but performs sign/verify operations without
> specifying a hash algorithm.  These legacy TLS versions concatenate an
> MD5 to a SHA-1 hash and omit the Full Hash Prefix:
> 
> https://git.kernel.org/pub/scm/libs/ell/ell.git/tree/ell/tls-suites.c#n97
> 
> TLS 1.1 was deprecated in 2021 by RFC 8996, but removal of support was
> inadvertent in this case.  It probably should be coordinated with iwd
> maintainers first.
> 
> So reinstate support for such legacy protocols by defaulting to hash
> algorithm "none" which uses an empty Full Hash Prefix.
> 
> If it is later on decided to remove TLS 1.1 support but still allow
> KEYCTL_PKEY_QUERY without a hash algorithm, that can be achieved by
> reverting the present commit and replacing it with the following patch:
> 
> https://lore.kernel.org/r/ZxalYZwH5UiGX5uj@wunner.de/
> 
> It's worth noting that Python's cryptography library gained support for
> such legacy use cases very recently, so they do seem to still be a thing.
> The Python developers identified IKE version 1 as another protocol
> omitting the Full Hash Prefix:
> 
> https://github.com/pyca/cryptography/issues/10226
> https://github.com/pyca/cryptography/issues/5495
> 
> The author of those issues, Zoltan Kelemen, spent considerable effort
> searching for test vectors but only found one in a 2019 blog post by
> Kevin Jones.  Add it to testmgr.h to verify correctness of this feature.
> 
> Examination of wpa_supplicant as well as various IKE daemons (libreswan,
> strongswan, isakmpd, raccoon) has determined that none of them seems to
> use the kernel's Key Retention Service, so iwd is the only affected user
> space application known so far.
> 
> Fixes: 1e562deacecc ("crypto: rsassa-pkcs1 - Migrate to sig_alg backend")
> Reported-by: Klara Modin <klarasmodin@gmail.com>
> Tested-by: Klara Modin <klarasmodin@gmail.com>
> Closes: https://lore.kernel.org/r/2ed09a22-86c0-4cf0-8bda-ef804ccb3413@gmail.com/
> Signed-off-by: Lukas Wunner <lukas@wunner.de>
> ---
>  crypto/asymmetric_keys/public_key.c |  2 +-
>  crypto/rsassa-pkcs1.c               | 20 +++++++++++---
>  crypto/testmgr.c                    |  6 ++++
>  crypto/testmgr.h                    | 55 +++++++++++++++++++++++++++++++++++++
>  4 files changed, 78 insertions(+), 5 deletions(-)

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

      reply	other threads:[~2024-11-10  3:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-29 10:24 [PATCH cryptodev-2.6] crypto: rsassa-pkcs1 - Reinstate support for legacy protocols Lukas Wunner
2024-11-10  3:54 ` 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=ZzAubO_g5rKQy8Fv@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=andrew.zaborowski@intel.com \
    --cc=davem@davemloft.net \
    --cc=denkenz@gmail.com \
    --cc=dhowells@redhat.com \
    --cc=ebiggers@google.com \
    --cc=ignat@cloudflare.com \
    --cc=iwd@lists.linux.dev \
    --cc=keyrings@vger.kernel.org \
    --cc=klara@kasm.eu \
    --cc=klarasmodin@gmail.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=marcel@holtmann.org \
    --cc=saulo.alessandre@tse.jus.br \
    --cc=smueller@chronox.de \
    --cc=stefanb@linux.ibm.com \
    --cc=tstruk@gigaio.com \
    --cc=varadgautam@google.com \
    --cc=vcsjones@github.com \
    --cc=zoltan@kelemen.se \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).