]> git.ipfire.org Git - thirdparty/linux.git/commit
crypto: hisi-trng - Remove crypto_rng interface
authorEric Biggers <ebiggers@kernel.org>
Sat, 30 May 2026 20:26:23 +0000 (13:26 -0700)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 11 Jun 2026 05:53:59 +0000 (13:53 +0800)
commit216a7795ec210bdabd5dad42323eee70bbfc8d90
treec9da96068ffd5a48ffa6011529fecdcebaa05c6b
parentaf3d1bb9a09daf928fc3f173689fb7904d6a6d4f
crypto: hisi-trng - Remove crypto_rng interface

drivers/crypto/hisilicon/trng/trng.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, hisi_trng_generate() synchronizes with itself
but not with hisi_trng_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
likewise being phased out, leaving just the hwrng support.

Thus, remove it to simplify the code and avoid conflict (and confusion)
with the hwrng interface which is the one that actually matters.

Fixes: e4d9d10ef4be ("crypto: hisilicon/trng - add support for PRNG")
Cc: stable@vger.kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/hisilicon/Kconfig
drivers/crypto/hisilicon/trng/trng.c