From: Przemyslaw Marczak
Date: Wed, 19 Feb 2014 16:09:37 +0000 (+0100)
Subject: MAINLINE lib: rand: add call to hw_rand() - hardware random number generator
X-Git-Tag: submit/tizen/20140328.090301~21
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=af5dae2e3d25272aec22f919a35968a934367716;p=kernel%2Fu-boot.git
MAINLINE lib: rand: add call to hw_rand() - hardware random number generator
Changes:
- lib/rand.c: add call to hw_rand() (depends on CONFIG_RAND_HW_ACCEL)
- include/common.h: add hw_rand() declaration.
Change-Id: I7439440fd9d20311466c9e3bb8a5512a6da63fb7
Signed-off-by: Przemyslaw Marczak
---
diff --git a/include/common.h b/include/common.h
index 15f5834..f67f9c5 100644
--- a/include/common.h
+++ b/include/common.h
@@ -840,6 +840,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
}
void srand(unsigned int seed)