[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJKOXPc2MGf_b3xA=R=p2_fQ0+SQvwLL8vfZLGhGAAEssD=hJA@mail.gmail.com>
Date: Fri, 24 Nov 2017 13:09:06 +0100
From: Krzysztof Kozlowski <krzk@...nel.org>
To: Łukasz Stelmach <l.stelmach@...sung.com>
Cc: Rob Herring <robh+dt@...nel.org>, Matt Mackall <mpm@...enic.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
devicetree@...r.kernel.org, linux-crypto@...r.kernel.org,
linux-samsung-soc@...r.kernel.org, linux-kernel@...r.kernel.org,
Marek Szyprowski <m.szyprowski@...sung.com>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
Stephan Müller <smueller@...onox.de>
Subject: Re: [PATCH 2/3] hwrng: exynos - add Samsung Exynos True RNG driver
On Thu, Nov 23, 2017 at 7:46 PM, Łukasz Stelmach <l.stelmach@...sung.com> 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@...sung.com> wrote:
>>> Add support for True Random Number Generator found in Samsung Exynos
>>> 5250+ SoCs.
>>>
>>> Signed-off-by: Łukasz Stelmach <l.stelmach@...sung.com>
>>> ---
>>> 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
Powered by blists - more mailing lists