From: Michael Walle <michael@walle.cc>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/3] lib: rand: add call to hw_rand() - hardware random number generator
Date: Fri, 28 Feb 2014 18:02:05 +0100 [thread overview]
Message-ID: <201402281802.05442.michael@walle.cc> (raw)
In-Reply-To: <0de8fbc2fd577e8bae1359e6a0babf17c8ae7018.1393604659.git.p.marczak@samsung.com>
Am Freitag, 28. Februar 2014, 17:30:54 schrieb Przemyslaw Marczak:
> Changes:
> - lib/rand.c: add call to hw_rand() (depends on CONFIG_RAND_HW_ACCEL)
> - include/common.h: add hw_rand() declaration.
>
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> cc: Michael Walle <michael@walle.cc>
> cc: Tom Rini <trini@ti.com>
> ---
> include/common.h | 3 +++
> lib/rand.c | 4 ++++
> 2 files changed, 7 insertions(+)
>
> diff --git a/include/common.h b/include/common.h
> index 96a45a6..58e2fbc 100644
> --- a/include/common.h
> +++ b/include/common.h
> @@ -836,6 +836,9 @@ void srand(unsigned int seed);
> unsigned int rand(void);
> unsigned int rand_r(unsigned int *seedp);
> #endif
> +#ifdef CONFIG_RAND_HW_ACCEL
> +unsigned int hw_rand(void);
> +#endif
>
> /* common/console.c */
> int console_init_f(void); /* Before relocation; uses the serial stuff
*/
> diff --git a/lib/rand.c b/lib/rand.c
> index 5c367e1..f534635 100644
> --- a/lib/rand.c
> +++ b/lib/rand.c
> @@ -23,7 +23,11 @@ unsigned int rand_r(unsigned int *seedp)
>
> unsigned int rand(void)
> {
> +#ifdef CONFIG_RAND_HW_ACCEL
> + return hw_rand();
> +#else
> return rand_r(&y);
> +#endif
> }
shouldn't we put that into rand_r() and ignore the argument? because then both
users of rand() and rand_r() will benefit from the hardware random generator.
and what does HW_ACCEL mean? is this a real hardware random generator? if this
is the case, wouldn't it make more sense to name it CONFIG_RAND_USE_HW_RNG.
-michael
next prev parent reply other threads:[~2014-02-28 17:02 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-28 16:30 [U-Boot] [PATCH 1/3] cpu: exynos4: ace_sha: add hardware random number generator support Przemyslaw Marczak
2014-02-28 16:30 ` [U-Boot] [PATCH 2/3] lib: rand: add call to hw_rand() - hardware random number generator Przemyslaw Marczak
2014-02-28 17:02 ` Michael Walle [this message]
2014-03-03 14:19 ` Przemyslaw Marczak
2014-02-28 16:30 ` [U-Boot] [PATCH 3/3] trats/trats2: enable exynos security subsystem and function hw_rand() Przemyslaw Marczak
2014-03-05 16:57 ` [U-Boot] [PATCH V2 1/3] cpu: exynos4: ace_sha: add hardware random number generator support Przemyslaw Marczak
2014-03-05 16:57 ` [U-Boot] [PATCH V2 2/3] lib: rand: add call to hw_rand() - hardware random number generator Przemyslaw Marczak
2014-03-05 21:22 ` Tom Rini
2014-03-06 4:58 ` Masahiro Yamada
2014-03-05 16:57 ` [U-Boot] [PATCH V2 3/3] trats/trats2: enable exynos security subsystem and function hw_rand() Przemyslaw Marczak
2014-03-06 5:43 ` [U-Boot] [PATCH V2 1/3] cpu: exynos4: ace_sha: add hardware random number generator support Jaehoon Chung
2014-03-13 1:58 ` Minkyu Kang
2014-03-20 17:23 ` [U-Boot] [PATCH v3 1/4] lib: rand: introduce new configs: CONFIG_LIB_RAND CONFIG_LIB_HW_RAND Przemyslaw Marczak
2014-03-20 17:23 ` [U-Boot] [PATCH v3 2/4] cpu: exynos4: add ace sha base address Przemyslaw Marczak
2014-03-20 17:23 ` [U-Boot] [PATCH v3 3/4] drivers: crypto: ace_sha: add implementation of hardware based lib rand Przemyslaw Marczak
2014-03-20 17:23 ` [U-Boot] [PATCH v3 4/4] trats/trats2: enable exynos ace sha subsystem and " Przemyslaw Marczak
2014-03-20 17:36 ` [U-Boot] [PATCH v3 1/4] lib: rand: introduce new configs: CONFIG_LIB_RAND CONFIG_LIB_HW_RAND Przemyslaw Marczak
2014-03-20 21:10 ` Michael Walle
2014-03-21 8:56 ` [U-Boot] [PATCH v4 1/4] lib: rand: introduce new configs: CONFIG_LIB_RAND and CONFIG_LIB_HW_RAND Przemyslaw Marczak
2014-03-21 8:56 ` [U-Boot] [PATCH v4 2/4] cpu: exynos4: add ace sha base address Przemyslaw Marczak
2014-03-21 15:09 ` Tom Rini
2014-03-22 15:18 ` Minkyu Kang
2014-03-24 7:44 ` Przemyslaw Marczak
2014-03-25 1:26 ` Minkyu Kang
2014-03-25 7:38 ` Przemyslaw Marczak
2014-03-21 8:56 ` [U-Boot] [PATCH v4 3/4] drivers: crypto: ace_sha: add implementation of hardware based lib rand Przemyslaw Marczak
2014-03-21 15:14 ` Tom Rini
2014-03-21 8:56 ` [U-Boot] [PATCH v4 4/4] trats/trats2: enable exynos ace sha subsystem and " Przemyslaw Marczak
2014-03-21 15:14 ` Tom Rini
2014-03-21 9:00 ` [U-Boot] [PATCH v4 1/4] lib: rand: introduce new configs: CONFIG_LIB_RAND and CONFIG_LIB_HW_RAND Przemyslaw Marczak
2014-03-21 15:00 ` Tom Rini
2014-03-25 9:58 ` [U-Boot] [PATCH v5 " Przemyslaw Marczak
2014-03-25 9:58 ` [U-Boot] [PATCH v5 2/4] cpu: exynos4: add ace sha base address Przemyslaw Marczak
2014-03-28 21:17 ` [U-Boot] [U-Boot, v5, " Tom Rini
2014-03-25 9:58 ` [U-Boot] [PATCH v5 3/4] drivers: crypto: ace_sha: add implementation of hardware based lib rand Przemyslaw Marczak
2014-03-28 21:17 ` [U-Boot] [U-Boot, v5, " Tom Rini
2014-03-25 9:58 ` [U-Boot] [PATCH v5 4/4] trats/trats2: enable exynos ace sha subsystem and " Przemyslaw Marczak
2014-03-28 21:17 ` [U-Boot] [U-Boot, v5, " Tom Rini
2014-03-25 10:17 ` [U-Boot] [PATCH v5 1/4] lib: rand: introduce new configs: CONFIG_LIB_RAND and CONFIG_LIB_HW_RAND Przemyslaw Marczak
2014-03-28 21:16 ` [U-Boot] [U-Boot, v5, " Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201402281802.05442.michael@walle.cc \
--to=michael@walle.cc \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox