Skip to contentSkip to conversation

crypto: hisi-trng - Remove crypto_rng interface

PATCH Applied Eric Biggers 2 participants 2 messages Jul 17 – Jul 19

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: hisi-trng - Remove crypto_rng interface

commit 216a7795ec210bdabd5dad42323eee70bbfc8d90 upstream.

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")
---
 drivers/crypto/hisilicon/Kconfig     |   1 -
 drivers/crypto/hisilicon/trng/trng.c | 298 +--------------------------
 2 files changed, 2 insertions(+), 297 deletions(-)
drivers/crypto/hisilicon/Kconfig +0 -1
index 4137a8bf131f..107bfffaead2 100644
@@ -79,6 +79,5 @@ config CRYPTO_DEV_HISI_TRNG
 	tristate "Support for HISI TRNG Driver"
 	depends on ARM64 && ACPI
 	select HW_RANDOM
-	select CRYPTO_RNG
 	help
 	  Support for HiSilicon TRNG Driver.
drivers/crypto/hisilicon/trng/trng.c +2 -296

355 lines not on this page · raw message

base-commit: da47cbc254661aa66d61ef061485a7080305c4be

Signature · 1 line
2.55.0
maintainer Applied
#1 lore raw
Quoted 2 lines

drivers/crypto/hisilicon/trng/trng.c exposes the same hardware through two completely separate interfaces, crypto_rng and hwrng.

Queued for 6.6, 6.1, and 5.15, thanks.

Signature · 2 lines
Thanks,
Sasha