Re: [PATCH v2] crypto: sun4i-ss: support the Security System PRNG

2016-12-14 Thread Herbert Xu
On Thu, Dec 15, 2016 at 12:47:16AM +0530, PrasannaKumar Muralidharan wrote: > Should there be a mandate that driver will be accepted only when it > passes 'rngtest'. This will make sure that prng drivers won't get > added in future. You cannot use software to distinguish between a PRNG and an HRNG

Re: [PATCH v2] crypto: sun4i-ss: support the Security System PRNG

2016-12-14 Thread PrasannaKumar Muralidharan
>> I have found two solutions: > > No we already have algif_rng so let's not confuse things even > further by making hwrng take PRNGs. Even if both the solutions could not be adopted I think there must be a way for applications to use similar API to get true rng or prng. Given the case that no use

Re: [PATCH v2] crypto: sun4i-ss: support the Security System PRNG

2016-12-13 Thread Corentin Labbe
On Wed, Dec 14, 2016 at 01:05:51PM +0800, Herbert Xu wrote: > On Tue, Dec 13, 2016 at 03:10:59PM +0100, Corentin Labbe wrote: > > > > I have found two solutions: > > No we already have algif_rng so let's not confuse things even > further by making hwrng take PRNGs. > But algif_rng is not accessi

Re: [PATCH v2] crypto: sun4i-ss: support the Security System PRNG

2016-12-13 Thread Herbert Xu
On Tue, Dec 13, 2016 at 03:10:59PM +0100, Corentin Labbe wrote: > > I have found two solutions: No we already have algif_rng so let's not confuse things even further by making hwrng take PRNGs. Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.a

Re: [PATCH v2] crypto: sun4i-ss: support the Security System PRNG

2016-12-13 Thread Corentin Labbe
On Tue, Dec 13, 2016 at 08:53:54PM +0530, PrasannaKumar Muralidharan wrote: > > What do you think about those two solutions ? > > I prefer the second solution's idea of using two files (/dev/hwrng and > /dev/hwprng). Upon having a quick glance it looks like (based on > current_rng == prng check) t

Re: [PATCH v2] crypto: sun4i-ss: support the Security System PRNG

2016-12-13 Thread PrasannaKumar Muralidharan
> What do you think about those two solutions ? I prefer the second solution's idea of using two files (/dev/hwrng and /dev/hwprng). Upon having a quick glance it looks like (based on current_rng == prng check) that your current implementation allows only one rng device to be in use at a time. It

Re: [PATCH v2] crypto: sun4i-ss: support the Security System PRNG

2016-12-13 Thread Corentin Labbe
On Thu, Dec 08, 2016 at 05:06:18PM +0800, Herbert Xu wrote: > On Wed, Dec 07, 2016 at 01:51:27PM +0100, Corentin Labbe wrote: > > > > So I must expose it as a crypto_rng ? > > If it is to be exposed at all then algif_rng would be the best > place. > > > Could you explain why PRNG must not be use

Re: [PATCH v2] crypto: sun4i-ss: support the Security System PRNG

2016-12-08 Thread PrasannaKumar Muralidharan
>> The hwrng interface was always meant to be an interface for real >> hardware random number generators. People rely on that so we >> should not provide bogus entropy sources through this interface. >> > > Why not adding a KCONFIG HW_RANDOM_ACCEPT_ALSO_PRNG with big warning ? > Or a HW_PRNG Kconf

Re: [PATCH v2] crypto: sun4i-ss: support the Security System PRNG

2016-12-08 Thread Corentin Labbe
On Thu, Dec 08, 2016 at 05:06:18PM +0800, Herbert Xu wrote: > On Wed, Dec 07, 2016 at 01:51:27PM +0100, Corentin Labbe wrote: > > > > So I must expose it as a crypto_rng ? > > If it is to be exposed at all then algif_rng would be the best > place. > I have badly said my question. So I need to u

Re: [PATCH v2] crypto: sun4i-ss: support the Security System PRNG

2016-12-08 Thread Herbert Xu
On Wed, Dec 07, 2016 at 01:51:27PM +0100, Corentin Labbe wrote: > > So I must expose it as a crypto_rng ? If it is to be exposed at all then algif_rng would be the best place. > Could you explain why PRNG must not be used as hw_random ? The hwrng interface was always meant to be an interface fo

Re: [PATCH v2] crypto: sun4i-ss: support the Security System PRNG

2016-12-07 Thread Corentin Labbe
On Wed, Dec 07, 2016 at 08:09:00PM +0800, Herbert Xu wrote: > On Mon, Dec 05, 2016 at 01:57:38PM +0100, Corentin Labbe wrote: > > > > So how to expose PRNG to user space ? or more generally how to "use" a PRNG > > ? > > We do have the algif_rng interface. > So I must expose it as a crypto_rng ?

Re: [PATCH v2] crypto: sun4i-ss: support the Security System PRNG

2016-12-07 Thread Herbert Xu
On Mon, Dec 05, 2016 at 01:57:38PM +0100, Corentin Labbe wrote: > > So how to expose PRNG to user space ? or more generally how to "use" a PRNG ? We do have the algif_rng interface. > I found hisi-rng, crypto4xx_ and exynos-rng which seems to be PRNG used as > hwrng. Thanks for checking. Patch

Re: [PATCH v2] crypto: sun4i-ss: support the Security System PRNG

2016-12-05 Thread Corentin Labbe
On Mon, Dec 05, 2016 at 08:37:05PM +0800, Herbert Xu wrote: > On Mon, Dec 05, 2016 at 11:48:42AM +0100, Corentin Labbe wrote: > > From: LABBE Corentin > > > > The Security System have a PRNG. > > This patch add support for it as an hwrng. > > > > Signed-off-by: Corentin Labbe > > Please don't

Re: [PATCH v2] crypto: sun4i-ss: support the Security System PRNG

2016-12-05 Thread Herbert Xu
On Mon, Dec 05, 2016 at 11:48:42AM +0100, Corentin Labbe wrote: > From: LABBE Corentin > > The Security System have a PRNG. > This patch add support for it as an hwrng. > > Signed-off-by: Corentin Labbe Please don't add PRNGs to hwrng. If we have existing PRNGs in there please let me know so

[PATCH v2] crypto: sun4i-ss: support the Security System PRNG

2016-12-05 Thread Corentin Labbe
From: LABBE Corentin The Security System have a PRNG. This patch add support for it as an hwrng. Signed-off-by: Corentin Labbe --- Changes since v1: - Replaced all spin_lock_bh by simple spin_lock - Removed handling of size not modulo 4 which will never happen - Added add_random_ready_callba