[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4248691.8fGIDmasva@tauon.atsec.com>
Date: Fri, 24 Mar 2017 21:41:59 +0100
From: Stephan Müller <smueller@...onox.de>
To: Krzysztof Kozlowski <krzk@...nel.org>
Cc: Kukjin Kim <kgene@...nel.org>,
Javier Martinez Canillas <javier@....samsung.com>,
Matt Mackall <mpm@...enic.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
"David S. Miller" <davem@...emloft.net>,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-samsung-soc@...r.kernel.org, linux-crypto@...r.kernel.org,
Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
Arnd Bergmann <arnd@...db.de>, Olof Johansson <olof@...om.net>
Subject: Re: [PATCH v2 1/3] crypto: hw_random - Add new Exynos RNG driver
Am Freitag, 24. März 2017, 19:26:04 CET schrieb Krzysztof Kozlowski:
Hi Krzysztof,
> +static unsigned int exynos_rng_copy_random(struct exynos_rng_dev *rng,
> + u8 *dst, unsigned int dlen)
> +{
> + unsigned int cnt = 0;
> + int i, j;
> + u32 val;
> +
> + for (j = 0; j < EXYNOS_RNG_SEED_REGS; j++) {
> + val = exynos_rng_readl(rng, EXYNOS_RNG_OUT(j));
> +
> + for (i = 0; i < 4; i++) {
> + dst[cnt] = val & 0xff;
> + val >>= 8;
> + if (++cnt >= dlen)
> + return cnt;
> + }
> + rng->seed_save[j] = val;
Just to clarify: is this call right? Shouldn't that be removed? Any RNG that
is given to a caller is tainted and should not serve as seed.
> + }
> +
> + /*
> + * Engine filled all output registers, so read the remaining registers
> + * for storing data as future seed.
> + */
> + for (; j < EXYNOS_RNG_SEED_REGS; j++)
> + rng->seed_save[j] = exynos_rng_readl(rng, EXYNOS_RNG_OUT(j));
With this call, I guess the questioned line above could go away, right?
Ciao
Stephan
Powered by blists - more mailing lists