All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Laveesh Bansal <laveeshb@laveeshbansal.com>
Cc: David Howells <dhowells@redhat.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Lukas Wunner <lukas@wunner.de>, Ignat Korchagin <ignat@linux.win>,
	"David S . Miller" <davem@davemloft.net>,
	Denis Kenzior <denkenz@gmail.com>,
	Maximilian Stahlberg <maximilian.stahlberg@uni-bremen.de>,
	keyrings@vger.kernel.org, linux-crypto@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] X.509: Accept a certificate with an empty subject
Date: Thu, 12 Nov 2026 00:09:06 -0800	[thread overview]
Message-ID: <20261112080906.GA375698@sol> (raw)
In-Reply-To: <20261112074246.99421-2-laveeshb@laveeshbansal.com>

On Wed, Nov 11, 2026 at 11:42:45PM -0800, Laveesh Bansal wrote:
> A certificate with an empty Subject, which RFC 5280 allows, fails to
> load: add_key() returns -EBADMSG. iwd hits this with an eduroam server
> certificate.
> 
> The subject is parsed with the Name rule. The ASN.1 compiler turns a
> SEQUENCE OF into a loop that runs at least once, so the first RDN is
> mandatory and an empty SEQUENCE runs out of data in the decoder.
> 
> Give the subject its own rule, a SEQUENCE OF a one-member CHOICE, so the
> first RDN can be absent. Anything that is not a SET is still rejected.
> The issuer keeps the Name rule, as RFC 5280 requires it to be non-empty.
> 
> Fixes: c26fd69fa009 ("X.509: Add a crypto key parser for binary (DER) X.509 certificates")
> Cc: stable@vger.kernel.org # v3.7+
> Reported-by: Maximilian Stahlberg <maximilian.stahlberg@uni-bremen.de>
> Closes: https://lore.kernel.org/r/9b05b89cf296b8a6392bbe6327228c1bc2f05c49.camel@uni-bremen.de
> Signed-off-by: Laveesh Bansal <laveeshb@laveeshbansal.com>

This problem (and many others) could also be solved if iwd switched to
use a userspace crypto library instead of misusing the kernel APIs.

- Eric

  reply	other threads:[~2026-11-12  8:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12  7:42 [PATCH 0/2] X.509: Accept a certificate with an empty subject Laveesh Bansal
2026-11-12  7:42 ` [PATCH 1/2] " Laveesh Bansal
2026-11-12  8:09   ` Eric Biggers [this message]
2026-11-12  7:42 ` [PATCH 2/2] X.509: Add KUnit tests for the certificate parser Laveesh Bansal

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=20261112080906.GA375698@sol \
    --to=ebiggers@kernel.org \
    --cc=davem@davemloft.net \
    --cc=denkenz@gmail.com \
    --cc=dhowells@redhat.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=ignat@linux.win \
    --cc=keyrings@vger.kernel.org \
    --cc=laveeshb@laveeshbansal.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=maximilian.stahlberg@uni-bremen.de \
    /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.