Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Qunqin Zhao <zhaoqunqin@loongson.cn>
Cc: Huacai Chen <chenhuacai@kernel.org>,
	linux-crypto@vger.kernel.org,
	Herbert Xu <herbert@gondor.apana.org.au>,
	linux-kernel@vger.kernel.org, loongarch@lists.linux.dev,
	Yinggang Gu <guyinggang@loongson.cn>, Lee Jones <lee@kernel.org>,
	kernel test robot <lkp@intel.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH] crypto: loongson - Select CRYPTO_RNG
Date: Fri, 22 May 2026 17:48:35 +0000	[thread overview]
Message-ID: <20260522174835.GA1894319@google.com> (raw)
In-Reply-To: <bc3acf15-808d-4141-7f1f-4a7a7f856c6c@loongson.cn>

On Fri, May 22, 2026 at 02:40:38PM +0800, Qunqin Zhao wrote:
> 
> 在 2026/5/22 下午12:03, Eric Biggers 写道:
> > On Fri, May 22, 2026 at 11:41:15AM +0800, Qunqin Zhao wrote:
> > > 在 2026/5/22 上午10:57, Eric Biggers 写道:
> > > > On Fri, May 22, 2026 at 10:52:42AM +0800, Huacai Chen wrote:
> > > > > On Fri, May 22, 2026 at 10:26 AM Eric Biggers <ebiggers@kernel.org> wrote:
> > > > > > This driver registers a rng_alg, so it requires CRYPTO_RNG.
> > > > > > 
> > > > > > Fixes: 766b2d724c8d ("crypto: loongson - add Loongson RNG driver support")
> > > > > > Reported-by: kernel test robot <lkp@intel.com>
> > > > > > Closes: https://lore.kernel.org/oe-kbuild-all/202605201622.qWOiiZTV-lkp@intel.com/
> > > > > > Cc: stable@vger.kernel.org
> > > > > > Signed-off-by: Eric Biggers <ebiggers@kernel.org>
> > > > > Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
> > > > > > ---
> > > > > >    drivers/crypto/loongson/Kconfig | 1 +
> > > > > >    1 file changed, 1 insertion(+)
> > > > > > 
> > > > By the way, do any of the loongson people have any comment on what they
> > > > think the point of this driver is?  It's not registered with the actual
> > > To provide an AF_ALG-based random number generation interface for other
> > > modules and user-space programs.
> > > 
> > > Thanks,
> > > 
> > > Qunqin
> > AF_ALG is a userspace interface; it's not available for in-kernel use.
> > If you mean using crypto_rng directly, note that no kernel code actually
> > uses it other than the tests, the implementation of AF_ALG, and the
> > FIPS-specific code which uses drbg.c specifically.
> > 
> > So, the first half of your justification doesn't make any sense.
> > 
> > As far as the second half: why would a userspace program do that instead
> > of just using the regular Linux RNG (/dev/urandom)?

Could you answer this question?  If there's no answer to this question,
then there's no use case for this driver as-is.

> > AFAIK, the only reason to use a HW RNG directly is for certification
> > reasons.
> > 
> > However, there's also already an interface for that: /dev/hw_random.
> > 
> > So AF_ALG seems completely redundant for this case.
> 
> To be honest, I previously assumed that the `hw_random` was designed
> strictly and exclusively for the TRNG mode.
> 
> Is it architecturally acceptable or common practice for a PRNG mode to
> utilize `hw_random` as well?
> 
> Thanks,

So the Loongson RNG is a PRNG?  Where does it get its entropy from, and
what is its security strength?

- Eric

      reply	other threads:[~2026-05-22 17:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-22  2:25 [PATCH] crypto: loongson - Select CRYPTO_RNG Eric Biggers
2026-05-22  2:52 ` Huacai Chen
2026-05-22  2:57   ` Eric Biggers
2026-05-22  3:41     ` Qunqin Zhao
2026-05-22  4:03       ` Eric Biggers
2026-05-22  6:40         ` Qunqin Zhao
2026-05-22 17:48           ` Eric Biggers [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=20260522174835.GA1894319@google.com \
    --to=ebiggers@kernel.org \
    --cc=chenhuacai@kernel.org \
    --cc=guyinggang@loongson.cn \
    --cc=herbert@gondor.apana.org.au \
    --cc=lee@kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=loongarch@lists.linux.dev \
    --cc=stable@vger.kernel.org \
    --cc=zhaoqunqin@loongson.cn \
    /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