lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230220235811.GA618419-robh@kernel.org>
Date:   Mon, 20 Feb 2023 17:58:11 -0600
From:   Rob Herring <robh@...nel.org>
To:     Matthias Brugger <matthias.bgg@...il.com>
Cc:     AngeloGioacchino Del Regno 
        <angelogioacchino.delregno@...labora.com>,
        Daniel Golle <daniel@...rotopia.org>,
        Sean Wang <sean.wang@...iatek.com>,
        Olivia Mackall <olivia@...enic.com>,
        Herbert Xu <herbert@...dor.apana.org.au>,
        Conor Dooley <conor.dooley@...rochip.com>,
        Mingming Su <Mingming.Su@...iatek.com>,
        linux-crypto@...r.kernel.org, linux-mediatek@...ts.infradead.org,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] hwrng: add driver for MediaTek TRNG SMC

On Thu, Feb 16, 2023 at 12:32:10PM +0100, Matthias Brugger wrote:
> 
> 
> On 16/02/2023 11:03, AngeloGioacchino Del Regno wrote:
> > Il 15/02/23 14:27, Daniel Golle ha scritto:
> > > Add driver providing kernel-side support for the Random Number
> > > Generator hardware found on Mediatek SoCs which have a driver in ARM
> > > TrustedFirmware-A allowing Linux to read random numbers using a
> > > non-standard vendor-defined Secure Monitor Call.
> > > 
> > > Signed-off-by: Daniel Golle <daniel@...rotopia.org>
> > 
> > Hello Daniel,
> > 
> > incidentally, I've also done some research on this one some months ago, when
> > I was deep in adding support for the Helio X10 SoC (MT6795) on Xperia M5.
> > 
> > The rng-v2 is simply the same rng but hypervised by the TF-A... and the only
> > difference is, well, as you're also pointing out, that we're using secure
> > monitor calls instead of direct MMIO handling.
> > 
> > There's also not much more than what you've implemented here and the only kind
> > of addition that we will ever see on this one will be about changing the SIP
> > command (as some older SoCs use a different one)... so...
> > 
> > ...I don't think that adding an entirely new driver is worth the noise, hence
> > I propose to simply add handling for the Secure RNG to mtk-rng.c instead: it's
> > shorter and we would only need to address one if branch on that probe function
> > to set a different callback.
> > 
> > The clock should then be optional for *some* of those "v2 handling" devices,
> > as if I recall correctly, some do need the clock to be handled from Linux
> > anyway... otherwise this v2 driver will be "soon" looking bloody similar to
> > the "v1", adding a bit of code duplication around.
> > 
> > What do you think?
> > 
> 
> That was exactly what I was thinking as well when I had a look at the
> driver. I propose to add it to mtk-rng.c. I don't see any value having a
> second driver for this.

Or fix the firmware to use the already defined SMC TRNG interface...

In any case, like the SMC TRNG, you don't need a DT binding. The 
firmware interface is discoverable. Try the SMC call and if it succeeds, 
you have a TRNG.

Rob

> 
> Regards,
> Matthias
> 
> > Regards,
> > Angelo
> > 
> > > ---
> > >   MAINTAINERS                         |  1 +
> > >   drivers/char/hw_random/Kconfig      | 16 +++++++
> > >   drivers/char/hw_random/Makefile     |  1 +
> > >   drivers/char/hw_random/mtk-rng-v2.c | 74 +++++++++++++++++++++++++++++
> > >   4 files changed, 92 insertions(+)
> > >   create mode 100644 drivers/char/hw_random/mtk-rng-v2.c
> > > 
> > 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ