summaryrefslogtreecommitdiffstatshomepage
path: root/src/tools/wincompat/getrandom.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/wincompat/getrandom.c')
-rw-r--r--src/tools/wincompat/getrandom.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/tools/wincompat/getrandom.c b/src/tools/wincompat/getrandom.c
new file mode 100644
index 0000000..4e2c4bd
--- /dev/null
+++ b/src/tools/wincompat/getrandom.c
@@ -0,0 +1,12 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2015-2019 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
+ */
+
+#include <stdbool.h>
+#include <ntsecapi.h>
+
+static inline bool __attribute__((__warn_unused_result__)) get_random_bytes(uint8_t *out, size_t len)
+{
+ return RtlGenRandom(out, len);
+}