On Thu, Nov 23, 2017 at 7:46 PM, Łukasz Stelmach <l.stelmach@xxxxxxxxxxx> wrote: > It was <2017-11-23 czw 17:31>, when Krzysztof Kozlowski wrote: >> On Thu, Nov 23, 2017 at 4:09 PM, Łukasz Stelmach <l.stelmach@xxxxxxxxxxx> wrote: >>> Add support for True Random Number Generator found in Samsung Exynos >>> 5250+ SoCs. >>> >>> Signed-off-by: Łukasz Stelmach <l.stelmach@xxxxxxxxxxx> >>> --- >>> MAINTAINERS | 7 + >>> drivers/char/hw_random/Kconfig | 12 ++ >>> drivers/char/hw_random/Makefile | 1 + >>> drivers/char/hw_random/exynos-trng.c | 256 +++++++++++++++++++++++++++++++++++ >>> 4 files changed, 276 insertions(+) >>> create mode 100644 drivers/char/hw_random/exynos-trng.c >>> > +Cc Stephan Müller, who reviewed intensively exynos-rng.c. > [...] > >>> endif # HW_RANDOM >> >> Thanks for working on TRNG. >> >> 1. I was rather thinking about extending existing exynos-rng.c [1] so >> it would be using TRNG as seed for PRNG as this gives you much more >> random data. Instead you developed totally separate driver which has >> its own benefits - one can choose which interface he wants. Although >> it is a little bit duplication. > > As far as I can tell, these are two different devices. However, PRNG > shares hardware with the hash engine. Indeed there is a hardware to > connect TRNG and PRNG, but, IMHO, it might be hard to model that > dependency in kernel. It should be as simple as setting few more registers in SSS module (actually maybe just enabling TRNG_SEED_START in PRNG). You do not have to model it in a kernel like connecting some hw_rng entity to cryptoai's rng_alg. See the jitterentropy-kcapi.c. I understand that in that case existing exynos-rng.c could expose two different RNG devices - one PRNG based on user's seed and second TRNG (actually TRNG+PRNG). It does not seem difficult to model but the question is whether that makes sense. > To me it seems easier to read TRNG (or > /dev/random) and and write the result to PRNG manually (in software). Indeed this gives more flexibility to the user (choice of engine) but first, it is slower, and second it reduces the quality of random numbers (PRNG reseeds itself... but in this model cannot reseed from TRNG). Best regards, Krzysztof