aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/genkey.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/genkey.c')
-rw-r--r--src/genkey.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/genkey.c b/src/genkey.c
index d1bb643..0201b28 100644
--- a/src/genkey.c
+++ b/src/genkey.c
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+// SPDX-License-Identifier: GPL-2.0 OR MIT
/*
* Copyright (C) 2015-2020 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
*/
@@ -28,7 +28,7 @@
#include "encoding.h"
#include "subcommands.h"
-#ifndef WINCOMPAT
+#ifndef _WIN32
static inline bool __attribute__((__warn_unused_result__)) get_random_bytes(uint8_t *out, size_t len)
{
ssize_t ret = 0;
@@ -65,10 +65,14 @@ static inline bool __attribute__((__warn_unused_result__)) get_random_bytes(uint
return i == len;
}
#else
-#include "wincompat/getrandom.c"
+#include <ntsecapi.h>
+static inline bool __attribute__((__warn_unused_result__)) get_random_bytes(uint8_t *out, size_t len)
+{
+ return RtlGenRandom(out, len);
+}
#endif
-int genkey_main(int argc, char *argv[])
+int genkey_main(int argc, const char *argv[])
{
uint8_t key[WG_KEY_LEN];
char base64[WG_KEY_LEN_BASE64];