From: Eric Biggers <ebiggers@kernel.org>
To: Neeraj Soni <neeraj.soni@oss.qualcomm.com>
Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
Om Prakash Singh <quic_omprsing@quicinc.com>,
Bjorn Andersson <quic_bjorande@quicinc.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
linux-arm-msm@vger.kernel.org,
Olivia Mackall <olivia@selenic.com>,
stable@vger.kernel.org
Subject: Re: [PATCH 3/4] crypto: qcom-rng - Remove crypto_rng interface
Date: Thu, 4 Jun 2026 05:42:48 +0000 [thread overview]
Message-ID: <20260604054248.GA3999742@google.com> (raw)
In-Reply-To: <021127c9-baff-816d-e053-897a7d4043d8@oss.qualcomm.com>
On Thu, Jun 04, 2026 at 10:20:38AM +0530, Neeraj Soni wrote:
> On 5/30/2026 7:33 AM, Eric Biggers wrote:
> > qcom-rng.c exposes the same hardware through two completely separate
> > interfaces, crypto_rng and hwrng. However, the implementation of this
> > is buggy because it permits generation operations from these interfaces
> > to run concurrently with each other, accessing the same registers. That
> > is, qcom_rng_generate() synchronizes with itself but not with
> > qcom_hwrng_read(). This results in potential repetition of output from
> > the RNG, output of non-random values, etc.
> >
> > Fortunately, there's actually no point in hardware RNG drivers
> > implementing the crypto_rng interface. It's not actually used by
> > anything besides the "rng" algorithm type of AF_ALG, which in turn is
> > not actually used in practice. Other crypto_rng hardware drivers are
>
> How it was established that there are no active users/clints for qcom-rng
> using crypto_rng interface? If there is no concrete way to do then this
> patch breaks backward compatibility.
The only in-kernel user of crypto_rng uses it to access
"drbg_nopr_hmac_sha512" on "FIPS-enabled" systems. So, the only
possibility for a user of "qcom-rng" would be userspace via AF_ALG. But
I've never heard of that being done. It would be a really odd and
pointless thing to do when the much easier to use UAPIs /dev/random and
/dev/hwrng already exist. And broken too, as I pointed out.
AF_ALG as a whole is rarely used and is a mistake. It exposes a massive
amount of unused and broken functionality to userspace, including every
single implementation of every single crypto algorithm by name, which
never should have been done in the way it was. We don't have much
choice but to continue removing algorithms/drivers from it to keep Linux
maintainable, as has already been happening successfully for many years.
The AF_ALG hardware RNG support is especially pointless, given the
redundancy with /dev/random and /dev/hwrng. As far as I can tell the
main purpose of it is just to confuse RNG driver authors into thinking
that they are making Linux utilize their RNG.
Keep in mind that for AF_ALG there's also a compatibility trick
available to be implemented if it ever needs to: the kernel could
automatically remap requests for a particular driver name, like
"qcom-rng", to a different one like "drbg_nopr_hmac_sha512".
However, it's never actually been necessary to use that trick in *any*
of the times that crypto drivers have been removed or renamed. No one
has ever cared. There's some AF_ALG functionality we know that a few
programs use, but this isn't part of that.
So I think we can be quite confident in proceeding with this patch even
without proactively putting in the name remapping.
- Eric
next prev parent reply other threads:[~2026-06-04 5:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-30 2:03 [PATCH 0/4] qcom-rng fixes and cleanups Eric Biggers
2026-05-30 2:03 ` [PATCH 1/4] crypto: qcom-rng - Enable clock in hwrng case Eric Biggers
2026-05-30 2:03 ` [PATCH 2/4] crypto: qcom-rng - Allow zero as a random number Eric Biggers
2026-05-30 2:03 ` [PATCH 3/4] crypto: qcom-rng - Remove crypto_rng interface Eric Biggers
2026-06-04 4:50 ` Neeraj Soni
2026-06-04 5:42 ` Eric Biggers [this message]
2026-05-30 2:03 ` [PATCH 4/4] hwrng: qcom - Move qcom-rng.c into drivers/char/hw_random/ Eric Biggers
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=20260604054248.GA3999742@google.com \
--to=ebiggers@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=neeraj.soni@oss.qualcomm.com \
--cc=neil.armstrong@linaro.org \
--cc=olivia@selenic.com \
--cc=quic_bjorande@quicinc.com \
--cc=quic_omprsing@quicinc.com \
--cc=stable@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