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: Sun, 24 May 2026 22:20:06 -0500	[thread overview]
Message-ID: <20260525032006.GA243157@quark> (raw)
In-Reply-To: <4501444d-9c17-8d4b-8bfd-bd1d69d77a76@loongson.cn>

On Mon, May 25, 2026 at 10:45:14AM +0800, Qunqin Zhao wrote:
> > > 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?
> 
> Loongson's hardware supports both TRNG and PRNG simultaneously.
> 
> We can locate a reseed function within loongson-rng.c, which clearly
> indicates that it is a PRNG driver.

That reseed function gets called with entropy from the Linux RNG.  So,
it seems it's really just a PRNG seeded from the Linux RNG.  What value
does that provide over just using the Linux RNG directly?

> So the core issue here is whether a PRNG driver can utilize the crypto
> interface.

If you're asking about crypto_rng, it can.  But the crypto_rng interface
is also kind of useless.  If you're asking about hwrng, it does look
like it's designed for TRNGs.  Would it be possible for this driver to
use the TRNG mode?

> If it cannot, does that imply the drivers listed below serve no practical
> purpose? (7.1-rc1)
> 
> loongson@loongson:~/upstream/linux/drivers/crypto$ grep crypto_register_rng

Most of the drivers in drivers/crypto/ are added by the hardware
manufacturer without any regard for whether they're useful or not.

- Eric

  reply	other threads:[~2026-05-25  3:20 UTC|newest]

Thread overview: 11+ 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
2026-05-25  2:45             ` Qunqin Zhao
2026-05-25  3:20               ` Eric Biggers [this message]
2026-05-25  8:17                 ` Qunqin Zhao
2026-05-25 14:59                   ` 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=20260525032006.GA243157@quark \
    --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