MAINLINE lib: rand: add call to hw_rand() - hardware random number generator
authorPrzemyslaw Marczak <p.marczak@samsung.com>
Wed, 19 Feb 2014 16:09:37 +0000 (17:09 +0100)
committerLukasz Majewski <l.majewski@samsung.com>
Mon, 10 Mar 2014 09:14:00 +0000 (10:14 +0100)
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 <p.marczak@samsung.com>
include/common.h
lib/rand.c

index 15f5834..f67f9c5 100644 (file)
@@ -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    */
index 5c367e1..f534635 100644 (file)
@@ -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)