diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-05-25 18:05:14 -0600 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-05-25 18:07:49 -0600 |
commit | eb4665ecf082033d986c64453e2becce19bc7af7 (patch) | |
tree | a105defb5f8849d5d12f330eaec0ccc3d59a1fb5 /src/genkey.c | |
parent | ipc: split into separate files per-platform (diff) | |
download | wireguard-tools-eb4665ecf082033d986c64453e2becce19bc7af7.tar.xz wireguard-tools-eb4665ecf082033d986c64453e2becce19bc7af7.zip |
wincompat: fold random into genkey
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/genkey.c')
-rw-r--r-- | src/genkey.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/genkey.c b/src/genkey.c index d1bb643..ef7770b 100644 --- a/src/genkey.c +++ b/src/genkey.c @@ -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,7 +65,11 @@ 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[]) |