diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-10-26 18:51:52 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-10-27 19:04:36 +0200 |
commit | ea932e4304c17eddb63dbfbd4aa6d1b83b58c0d3 (patch) | |
tree | e6b7665a5465ad614053f203734f21c6fb5f4752 /main.go | |
parent | embeddable-dll-service: update for new wgnt API (diff) | |
download | wireguard-windows-ea932e4304c17eddb63dbfbd4aa6d1b83b58c0d3.tar.xz wireguard-windows-ea932e4304c17eddb63dbfbd4aa6d1b83b58c0d3.zip |
manager: delay boottime updates and simplify
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -6,15 +6,18 @@ package main import ( + "crypto/rand" "debug/pe" "errors" "fmt" "io" "log" + unsafeRand "math/rand" "os" "strconv" "strings" "time" + "unsafe" "golang.org/x/sys/windows" @@ -150,12 +153,19 @@ func pipeFromHandleArgument(handleStr string) (*os.File, error) { return os.NewFile(uintptr(handleInt), "pipe"), nil } +func seedUnsafeRng() { + var seed int64 + rand.Read(unsafe.Slice((*byte)(unsafe.Pointer(&seed)), unsafe.Sizeof(seed))) + unsafeRand.Seed(seed) +} + func main() { if windows.SetDllDirectory("") != nil || windows.SetDefaultDllDirectories(windows.LOAD_LIBRARY_SEARCH_SYSTEM32) != nil { panic("failed to restrict dll search path") } setLogFile() + seedUnsafeRng() checkForWow64() if len(os.Args) <= 1 { |