1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/pkg/libhydrogen/patches/0001-Add-support-for-RIOT-OS.patch
2018-09-21 13:48:00 +02:00

36 lines
788 B
Diff

From 59ba85698386d2d55c86a00557169f3f5efad502 Mon Sep 17 00:00:00 2001
From: Silke Hofstra <silke@slxh.eu>
Date: Thu, 20 Sep 2018 16:32:40 +0200
Subject: [PATCH] Add support for RIOT OS
---
impl/random.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/impl/random.h b/impl/random.h
index f2ca1a4..2c09e02 100644
--- a/impl/random.h
+++ b/impl/random.h
@@ -99,6 +99,18 @@ hydro_random_init(void)
return 0;
}
+#elif defined(RIOT_VERSION) && !defined(__unix__)
+
+#include <random.h>
+
+static int
+hydro_random_init(void)
+{
+ random_bytes(hydro_random_context.state, sizeof hydro_random_context.state);
+ hydro_random_context.counter = ~LOAD64_LE(hydro_random_context.state);
+ return 0;
+}
+
#elif defined(_WIN32)
#include <windows.h>
--
2.18.0