Subject: [PATCH 1/4] random: Simple utility functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Simple utilty functions used by patches later in the series

Signed-off-by: Sandy Harris <sandyinchina@xxxxxxxxx>

---
 drivers/char/random.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/char/random.c b/drivers/char/random.c
index 3404a91edf29..c8618020b49f 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -356,6 +356,27 @@
 #define CREATE_TRACE_POINTS
 #include <trace/events/random.h>

+static void xor128(u32 *target, u32 *source)
+{
+    int i ;
+    for (i = 0 ; i < 4 ; i++)
+        *target++ ^= *source++ ;
+}
+
+static void add128(u32 *target, u32 *source)
+{
+    int i ;
+    for (i = 0 ; i < 4 ; i++)
+        *target++ += *source++ ;
+}
+
+static int get_hw_long(unsigned long *x)
+{
+    int ret ;
+    ret = get_random_bytes_arch((u8 *) x, 8) ;
+    return (ret == 8) ? 1 : 0 ;
+}
+
 /* #define ADD_INTERRUPT_BENCH */

 /*
-- 
2.25.1



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux