All of lore.kernel.org
 help / color / mirror / Atom feed
* Subject: [PATCH 1/4] random: Simple utility functions
@ 2022-02-10 14:32 Sandy Harris
  2022-02-10 14:48 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 2+ messages in thread
From: Sandy Harris @ 2022-02-10 14:32 UTC (permalink / raw)
  To: Linux Crypto Mailing List, Ted Ts'o, Jason A. Donenfeld,
	Herbert Xu, Greg Kroah-Hartman

Simple utilty functions used by patches later in the series

Signed-off-by: Sandy Harris <sandyinchina@gmail.com>

---
 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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-10 14:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-10 14:32 Subject: [PATCH 1/4] random: Simple utility functions Sandy Harris
2022-02-10 14:48 ` Greg Kroah-Hartman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.