[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2] hw/misc: Add Exynos4210 Pseudo Random Number

From: Krzysztof Kozlowski
Subject: Re: [Qemu-devel] [PATCH v2] hw/misc: Add Exynos4210 Pseudo Random Number Generator
Date: Tue, 4 Apr 2017 15:44:02 +0200
User-agent: Mutt/1.5.24 (2015-08-30)

On Tue, Apr 04, 2017 at 01:09:08PM +0100, Peter Maydell wrote:
> On 18 March 2017 at 19:25, Krzysztof Kozlowski <address@hidden> wrote:
> > Add emulation for Exynos4210 Pseudo Random Number Generator which could
> > work on fixed seeds or with seeds provided by True Random Number
> > Generator block inside the SoC.
> >
> > Implement only the fixed seeds part of it in polling mode (no
> > interrupts).  Simple testing:
> >     # echo "exynos" > /sys/class/misc/hw_random/rng_current
> >     # dd if=/dev/hwrng of=/dev/null bs=1 count=16
> >
> > Signed-off-by: Krzysztof Kozlowski <address@hidden>
> >
> > ---
> >
> > Changes since v1:
> > 1. Use GRand-like functions to fix build on MingW32 (this adds also
> >    finalize).
> > 2. Add DPRINTF macro.
> > 3. Use HWADDR_PRIx and family for printing values.
> Is there a data sheet that describes this RNG? I had a quick google
> but couldn't find anything in the 4210 manual you can get from Samsung.

Official and public datasheet - I never heard about it... AFAIK, Samsung
never released any datasheet... But recently I found a copy of
Exynos4412 datasheet published on FriendlyArm website:
(at the bottom in "Resources").

Some blocks in Exynos4412, including the RNG, are the same as in
Exynos4210. However, you should not expect too much data about the RNG
in the datasheet...

> In particular I'm not sure we want to use GRand here.

Now, I am not sure neither. :) Let me describe the background:

Recently I started also improving the Linux kernel driver for RNG module
which ended in writing a new driver followed by discussions
from which I learnt a lot. See [1][2][3]

The datasheet is not saying too much how the RNG module works inside...
so it is all a guessing. I must admit that I wrote the QEMU RNG part mostly
looking at behavior of kernel driver and combining the knowledge with
information obtained from datasheet. Thus I used GRand to have
repeatable sequences for same seed.

During the discussions about new kernel driver, I found that this RNG
module (at least on Exynos4412 board) requires seeding but it is not
following the Pseudo RNG behavior - seeding with the same value produces
different results. This means that GRand would not be needed here.

The new driver (not merged yet) took this into account and it behaves
differently than previous one. Most notably it tries to be a better pseudo
random number generator in terms of randomness.

I did not test the new kernel driver with this QEMU RNG driver because
it uses different user-space API and I still did not configure full
Linux box in QEMU (mounting root, having some distro in the image). I am
booting the QEMU kernel to initramfs with some toolset included.

[1] https://www.spinics.net/lists/kernel/msg2474154.html
[2] https://www.spinics.net/lists/arm-kernel/msg571653.html
[3] https://www.spinics.net/lists/arm-kernel/msg571516.html

Best regards,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]