]> git.ipfire.org Git - thirdparty/wireguard-go.git/log
thirdparty/wireguard-go.git
6 years agowintun: Fix double-quoted strings escaping on output
Simon Rozman [Fri, 8 Mar 2019 08:43:54 +0000 (09:43 +0100)] 
wintun: Fix double-quoted strings escaping on output

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agowintun: Introduce SetupAPI enumerator and machineName consts
Simon Rozman [Fri, 8 Mar 2019 08:42:34 +0000 (09:42 +0100)] 
wintun: Introduce SetupAPI enumerator and machineName consts

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agoWindows: Apply strict security descriptor on pipe server
Odd Stranne [Wed, 6 Mar 2019 13:58:25 +0000 (14:58 +0100)] 
Windows: Apply strict security descriptor on pipe server

Signed-off-by: Odd Stranne <odd@mullvad.net>
6 years agouapi: windows: work out pipe semantics
Jason A. Donenfeld [Fri, 8 Mar 2019 00:40:54 +0000 (01:40 +0100)] 
uapi: windows: work out pipe semantics

Pipes can be arranged like this, so that's fine. We also apply a strict
SDDL that can't be inherited and only gives access to local system.

Developed-with: Odd Stranne <odd@mullvad.net>

6 years agowintun: Cleanup
Simon Rozman [Thu, 7 Mar 2019 14:45:17 +0000 (15:45 +0100)] 
wintun: Cleanup

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agowintun: Refactor network registry key name generation
Simon Rozman [Thu, 7 Mar 2019 14:34:34 +0000 (15:34 +0100)] 
wintun: Refactor network registry key name generation

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agowintun: Revise interface creation wait
Simon Rozman [Thu, 7 Mar 2019 14:19:27 +0000 (15:19 +0100)] 
wintun: Revise interface creation wait

DIF_INSTALLDEVICE returns almost immediately, while the device
installation continues in the background. It might take a while, before
all registry keys and values are populated.

Previously, wireguard-go waited for HKLM\SYSTEM\CurrentControlSet\
Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\<id> registry key
only.

Followed by a SetInterfaceName() method of Wintun struct which tried to
access HKLM\SYSTEM\CurrentControlSet\Control\Network\
{4D36E972-E325-11CE-BFC1-08002BE10318}\<id>\Connection registry key
might not be available yet.

This commit loops until both registry keys are available before
returning from CreateInterface() function.

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agoreceive: squelch tear down error
Jason A. Donenfeld [Thu, 7 Mar 2019 01:03:48 +0000 (02:03 +0100)] 
receive: squelch tear down error

6 years agotun: linux: work out netpoll trick
Jason A. Donenfeld [Thu, 7 Mar 2019 00:51:41 +0000 (01:51 +0100)] 
tun: linux: work out netpoll trick

6 years agowintun: Resolve some of golint warnings
Simon Rozman [Mon, 4 Mar 2019 13:27:16 +0000 (14:27 +0100)] 
wintun: Resolve some of golint warnings

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agoElaborate the failing step when forwarding errors on return
Simon Rozman [Mon, 4 Mar 2019 13:08:13 +0000 (14:08 +0100)] 
Elaborate the failing step when forwarding errors on return

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agoSimplify reading NetCfgInstanceId from registry
Simon Rozman [Mon, 4 Mar 2019 12:25:18 +0000 (13:25 +0100)] 
Simplify reading NetCfgInstanceId from registry

As querying non-existing registry value and reading non-existing
registry string value both return ERROR_FILE_NOT_FOUND, we can
use later only.

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agoUnify interface-specific network registry key open
Simon Rozman [Mon, 4 Mar 2019 10:58:02 +0000 (11:58 +0100)] 
Unify interface-specific network registry key open

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agotun: import mobile particularities
Jason A. Donenfeld [Sun, 3 Mar 2019 04:20:13 +0000 (05:20 +0100)] 
tun: import mobile particularities

6 years agoboundif: introduce API for socket binding
Jason A. Donenfeld [Sun, 3 Mar 2019 04:01:06 +0000 (05:01 +0100)] 
boundif: introduce API for socket binding

6 years agoglobal: begin modularization
Jason A. Donenfeld [Sun, 3 Mar 2019 03:04:41 +0000 (04:04 +0100)] 
global: begin modularization

6 years agotun: windows: expose GUID
Jason A. Donenfeld [Thu, 28 Feb 2019 23:11:12 +0000 (00:11 +0100)] 
tun: windows: expose GUID

6 years agotun: allow special methods in NativeTun
Jason A. Donenfeld [Thu, 28 Feb 2019 23:05:57 +0000 (00:05 +0100)] 
tun: allow special methods in NativeTun

6 years agotun: linux: netpoll is broken for tun's epoll
Jason A. Donenfeld [Wed, 27 Feb 2019 03:10:01 +0000 (04:10 +0100)] 
tun: linux: netpoll is broken for tun's epoll

So this mostly reverts the switch to Sysconn for Linux.

Issue: https://github.com/golang/go/issues/30426

6 years agotun: linux: netlink sock needs cleaning up but file will be gc'd
Jason A. Donenfeld [Wed, 27 Feb 2019 01:20:17 +0000 (02:20 +0100)] 
tun: linux: netlink sock needs cleaning up but file will be gc'd

6 years agotun: use netpoll instead of rwcancel
Jason A. Donenfeld [Wed, 27 Feb 2019 00:48:58 +0000 (01:48 +0100)] 
tun: use netpoll instead of rwcancel

The new sysconn function of Go 1.12 makes this possible:

package main

import "log"
import "os"
import "unsafe"
import "time"
import "syscall"
import "sync"
import "golang.org/x/sys/unix"

func main() {
fd, err := os.OpenFile("/dev/net/tun", os.O_RDWR, 0)
if err != nil {
log.Fatal(err)
}

var ifr [unix.IFNAMSIZ + 64]byte
copy(ifr[:], []byte("cheese"))
*(*uint16)(unsafe.Pointer(&ifr[unix.IFNAMSIZ])) = unix.IFF_TUN

var errno syscall.Errno
s, _ := fd.SyscallConn()
s.Control(func(fd uintptr) {
_, _, errno = unix.Syscall(
unix.SYS_IOCTL,
fd,
uintptr(unix.TUNSETIFF),
uintptr(unsafe.Pointer(&ifr[0])),
)
})
if errno != 0 {
log.Fatal(errno)
}

b := [4]byte{}
wait := sync.WaitGroup{}
wait.Add(1)
go func() {
_, err := fd.Read(b[:])
log.Print("Read errored: ", err)
wait.Done()
}()
time.Sleep(time.Second)
log.Print("Closing")
err = fd.Close()
if err != nil {
log.Print("Close errored: " , err)
}
wait.Wait()
log.Print("Exiting")
}

6 years agotun: use sysconn instead of .Fd with Go 1.12
Jason A. Donenfeld [Wed, 27 Feb 2019 00:06:43 +0000 (01:06 +0100)] 
tun: use sysconn instead of .Fd with Go 1.12

6 years agoRearrange imports
Jason A. Donenfeld [Fri, 22 Feb 2019 19:59:43 +0000 (20:59 +0100)] 
Rearrange imports

6 years agodevice: send persistent keepalive when bringing up device
Jason A. Donenfeld [Fri, 22 Feb 2019 18:33:28 +0000 (19:33 +0100)] 
device: send persistent keepalive when bringing up device

Reported-by: Marcelo Bello
6 years agowintun: Read/write packet size from/to exchange buffer directly
Simon Rozman [Fri, 22 Feb 2019 15:16:14 +0000 (16:16 +0100)] 
wintun: Read/write packet size from/to exchange buffer directly

Driver <-> user-space communication is local and using native endian.

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agowintun: Make two-step slicing a one step
Simon Rozman [Fri, 22 Feb 2019 15:11:33 +0000 (16:11 +0100)] 
wintun: Make two-step slicing a one step

Stop relying to Go compiler optimizations and calculate the end offset
directly.

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agowintun: Write exchange buffer increased back to 1MiB
Simon Rozman [Wed, 20 Feb 2019 19:13:33 +0000 (20:13 +0100)] 
wintun: Write exchange buffer increased back to 1MiB

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agowintun: Migrate from unsafe buffer handling to encoding/binary
Simon Rozman [Wed, 20 Feb 2019 19:10:24 +0000 (20:10 +0100)] 
wintun: Migrate from unsafe buffer handling to encoding/binary

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agowintun: Adopt new packet data alignment
Simon Rozman [Wed, 20 Feb 2019 18:56:10 +0000 (19:56 +0100)] 
wintun: Adopt new packet data alignment

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agowintun: Cleanup
Simon Rozman [Wed, 20 Feb 2019 17:38:18 +0000 (18:38 +0100)] 
wintun: Cleanup

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agowintun: Add TUN device locking
Simon Rozman [Wed, 20 Feb 2019 12:12:08 +0000 (13:12 +0100)] 
wintun: Add TUN device locking

In case reading from TUN device detected TUN device was closed, it
closed the file handle and set tunFile to nil. The tunFile is
automatically reopened on retry, but... If another packet comes in the
WireGuard calls Write() method. With tunFile set to nil, this will
cause access violation.

Therefore, locking was introduced.

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agowintun: Move exchange buffer in separate struct on heap
Simon Rozman [Wed, 20 Feb 2019 10:41:37 +0000 (11:41 +0100)] 
wintun: Move exchange buffer in separate struct on heap

This allows buffer alignment and keeps it together with its meta-data.

Furthermore, the write buffer has been reduced - as long as we flush
after _every_ write, we don't need a 1MiB write buffer.

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agowintun: Switch to dynamic packet sizes
Simon Rozman [Tue, 19 Feb 2019 17:49:24 +0000 (18:49 +0100)] 
wintun: Switch to dynamic packet sizes

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agoChange package path
Jason A. Donenfeld [Mon, 18 Feb 2019 03:44:41 +0000 (04:44 +0100)] 
Change package path

6 years agoBump dependencies for ARM ChaCha20
Jason A. Donenfeld [Thu, 14 Feb 2019 09:59:01 +0000 (10:59 +0100)] 
Bump dependencies for ARM ChaCha20

6 years agowintun: Auto-calculate TUN exchange buffer size
Simon Rozman [Fri, 8 Feb 2019 14:21:24 +0000 (15:21 +0100)] 
wintun: Auto-calculate TUN exchange buffer size

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agowintun: Simplify Read method()
Simon Rozman [Fri, 8 Feb 2019 13:31:05 +0000 (14:31 +0100)] 
wintun: Simplify Read method()

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agowintun: Make constants private and adopt Go recommended case
Simon Rozman [Fri, 8 Feb 2019 07:55:23 +0000 (08:55 +0100)] 
wintun: Make constants private and adopt Go recommended case

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agowintun: Check for user close in read loop regardless the load
Simon Rozman [Fri, 8 Feb 2019 07:48:35 +0000 (08:48 +0100)] 
wintun: Check for user close in read loop regardless the load

Do the WaitForSingleObject() always to provide high-load responsiveness.

Reorder events so TUN_SIGNAL_CLOSE has priority over
TUN_SIGNAL_DATA_AVAIL, to provide high-load responsiveness at all.

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agowintun: Adjust tunRWQueue.left member to match Wintun driver
Simon Rozman [Thu, 7 Feb 2019 23:19:56 +0000 (00:19 +0100)] 
wintun: Adjust tunRWQueue.left member to match Wintun driver

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agosetupapi: Merge _SP_DRVINFO_DETAIL_DATA and DrvInfoDetailData
Simon Rozman [Thu, 7 Feb 2019 22:45:11 +0000 (23:45 +0100)] 
setupapi: Merge _SP_DRVINFO_DETAIL_DATA and DrvInfoDetailData

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agosetupapi: Merge SP_DRVINFO_DATA and DrvInfoData
Simon Rozman [Thu, 7 Feb 2019 22:12:58 +0000 (23:12 +0100)] 
setupapi: Merge SP_DRVINFO_DATA and DrvInfoData

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agosetupapi: Rename SP_REMOVEDEVICE_PARAMS to RemoveDeviceParams
Simon Rozman [Thu, 7 Feb 2019 22:00:52 +0000 (23:00 +0100)] 
setupapi: Rename SP_REMOVEDEVICE_PARAMS to RemoveDeviceParams

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agosetupapi: Rename SP_CLASSINSTALL_HEADER to ClassInstallHeader
Simon Rozman [Thu, 7 Feb 2019 21:37:14 +0000 (22:37 +0100)] 
setupapi: Rename SP_CLASSINSTALL_HEADER to ClassInstallHeader

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agosetupapi: Merge _SP_DEVINSTALL_PARAMS and DevInstallParams
Simon Rozman [Thu, 7 Feb 2019 21:35:03 +0000 (22:35 +0100)] 
setupapi: Merge _SP_DEVINSTALL_PARAMS and DevInstallParams

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agosetupapi: Merge _SP_DEVINFO_LIST_DETAIL_DATA and DevInfoListDetailData
Simon Rozman [Thu, 7 Feb 2019 21:23:03 +0000 (22:23 +0100)] 
setupapi: Merge _SP_DEVINFO_LIST_DETAIL_DATA and DevInfoListDetailData

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agosetupapi: Rename SP_DEVINFO_DATA to DevInfoData
Simon Rozman [Thu, 7 Feb 2019 21:09:18 +0000 (22:09 +0100)] 
setupapi: Rename SP_DEVINFO_DATA to DevInfoData

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agowintun: Detect if a foreign interface with the same name exists
Simon Rozman [Thu, 7 Feb 2019 21:02:51 +0000 (22:02 +0100)] 
wintun: Detect if a foreign interface with the same name exists

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agowintun: Clean excessive setupapi.DevInfo.GetDeviceInfoListDetail() call
Simon Rozman [Thu, 7 Feb 2019 19:49:41 +0000 (20:49 +0100)] 
wintun: Clean excessive setupapi.DevInfo.GetDeviceInfoListDetail() call

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agowintun: Explain rationale behind case-insensitive interface names
Simon Rozman [Thu, 7 Feb 2019 18:42:59 +0000 (19:42 +0100)] 
wintun: Explain rationale behind case-insensitive interface names

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agowintun: Implement TODO in TestSetupDiGetDeviceRegistryProperty()
Simon Rozman [Thu, 7 Feb 2019 17:49:21 +0000 (18:49 +0100)] 
wintun: Implement TODO in TestSetupDiGetDeviceRegistryProperty()

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agowintun: add FlushInterface stub
Jason A. Donenfeld [Thu, 7 Feb 2019 17:24:28 +0000 (18:24 +0100)] 
wintun: add FlushInterface stub

6 years agomain_windows: Get iface name from argument
Jason A. Donenfeld [Thu, 7 Feb 2019 14:44:07 +0000 (15:44 +0100)] 
main_windows: Get iface name from argument

6 years agowintun: Compare values of GUID, not pointers, when removing
Jason A. Donenfeld [Thu, 7 Feb 2019 03:49:15 +0000 (04:49 +0100)] 
wintun: Compare values of GUID, not pointers, when removing

6 years agomain_windows: Catch more exit events
Jason A. Donenfeld [Thu, 7 Feb 2019 03:42:35 +0000 (04:42 +0100)] 
main_windows: Catch more exit events

6 years agowintun: Introduce new package for obscuring Windows bits
Jason A. Donenfeld [Thu, 7 Feb 2019 03:18:27 +0000 (04:18 +0100)] 
wintun: Introduce new package for obscuring Windows bits

6 years agotun_windows: Style
Jason A. Donenfeld [Thu, 7 Feb 2019 03:08:05 +0000 (04:08 +0100)] 
tun_windows: Style

6 years agosetupapi: Lower case params
Jason A. Donenfeld [Thu, 7 Feb 2019 02:24:58 +0000 (03:24 +0100)] 
setupapi: Lower case params

6 years agosetupapi: Do not export the toGo/toWindows functions
Jason A. Donenfeld [Thu, 7 Feb 2019 01:56:31 +0000 (02:56 +0100)] 
setupapi: Do not export the toGo/toWindows functions

6 years agosetupapi: Pass pointers instead of values
Jason A. Donenfeld [Thu, 7 Feb 2019 01:26:50 +0000 (02:26 +0100)] 
setupapi: Pass pointers instead of values

6 years agotun_windows: Introduce preliminary TUN interface creation
Simon Rozman [Wed, 6 Feb 2019 21:30:14 +0000 (22:30 +0100)] 
tun_windows: Introduce preliminary TUN interface creation

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agotun_windows: Stop checking minimum size of received TUN packets
Simon Rozman [Wed, 6 Feb 2019 19:22:04 +0000 (20:22 +0100)] 
tun_windows: Stop checking minimum size of received TUN packets

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agosetupapi: Add DrvInfoDetailData.IsCompatible() to simplify HID detection
Simon Rozman [Wed, 6 Feb 2019 19:18:44 +0000 (20:18 +0100)] 
setupapi: Add DrvInfoDetailData.IsCompatible() to simplify HID detection

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agosetupapi: Add SP_DRVINFO_DATA.IsNewer() method to simplify comparison
Simon Rozman [Wed, 6 Feb 2019 19:17:47 +0000 (20:17 +0100)] 
setupapi: Add SP_DRVINFO_DATA.IsNewer() method to simplify comparison

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agosetupapi: Make toUTF16() public and add UTF16ToBuf() counterpart
Simon Rozman [Wed, 6 Feb 2019 19:15:40 +0000 (20:15 +0100)] 
setupapi: Make toUTF16() public and add UTF16ToBuf() counterpart

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agoFix up errors and paths
Jason A. Donenfeld [Tue, 5 Feb 2019 13:06:25 +0000 (22:06 +0900)] 
Fix up errors and paths

6 years agoconn: close ipv4 socket when ipv6 socket fails
Jason A. Donenfeld [Tue, 5 Feb 2019 12:55:33 +0000 (21:55 +0900)] 
conn: close ipv4 socket when ipv6 socket fails

6 years agosetupapi: Add support for driver info lists
Simon Rozman [Tue, 5 Feb 2019 15:29:17 +0000 (16:29 +0100)] 
setupapi: Add support for driver info lists

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agosetupapi: Move Go<>Windows struct marshaling to types_windows.go
Simon Rozman [Tue, 5 Feb 2019 13:03:28 +0000 (14:03 +0100)] 
setupapi: Move Go<>Windows struct marshaling to types_windows.go

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agosetupapi: Add support for SetupDi(Get|Set)DeviceRegistryProperty()
Simon Rozman [Tue, 5 Feb 2019 10:44:47 +0000 (11:44 +0100)] 
setupapi: Add support for SetupDi(Get|Set)DeviceRegistryProperty()

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agosetupapi: Introduce DevInfo methods for cleaner code
Simon Rozman [Tue, 5 Feb 2019 07:45:44 +0000 (08:45 +0100)] 
setupapi: Introduce DevInfo methods for cleaner code

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agoAdd support for setupapi.SetupDi(Get|Set)SelectedDevice()
Simon Rozman [Mon, 4 Feb 2019 14:50:59 +0000 (15:50 +0100)] 
Add support for setupapi.SetupDi(Get|Set)SelectedDevice()

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agoReorder data-types and functions to match SetupAPI.h
Simon Rozman [Mon, 4 Feb 2019 14:21:19 +0000 (15:21 +0100)] 
Reorder data-types and functions to match SetupAPI.h

Adding functions with non-consistent order made setupapi package a mess.
While we could reorder data-types and functions by alphabet - it would
make searching easier - it would put ...Get... and ...Set... functions
quite apart.

Therefore, the SetupAPI.h order was adopted.

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agoAdd support for setupapi.SetupDiCreateDeviceInfo()
Simon Rozman [Mon, 4 Feb 2019 10:52:42 +0000 (11:52 +0100)] 
Add support for setupapi.SetupDiCreateDeviceInfo()

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agoAdd support for setupapi.setupDiCreateDeviceInfoListEx()
Simon Rozman [Mon, 4 Feb 2019 10:49:26 +0000 (11:49 +0100)] 
Add support for setupapi.setupDiCreateDeviceInfoListEx()

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agoStop accessing SetupDiGetDeviceInfoListDetail() output on error
Simon Rozman [Mon, 4 Feb 2019 10:45:37 +0000 (11:45 +0100)] 
Stop accessing SetupDiGetDeviceInfoListDetail() output on error

The data returned by SetupDiGetDeviceInfoListDetail() is nil on error
which will cause the test to crash should the function fail.

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agoUnify certain variable names
Simon Rozman [Mon, 4 Feb 2019 10:42:51 +0000 (11:42 +0100)] 
Unify certain variable names

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agoSimplify SetupDiEnumDeviceInfo() synopsis
Simon Rozman [Mon, 4 Feb 2019 10:40:44 +0000 (11:40 +0100)] 
Simplify SetupDiEnumDeviceInfo() synopsis

The SetupDiEnumDeviceInfo() now returns a SP_DEVINFO_DATA rather than
taking it on input to fill it on return.

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agoChange generic local variable names with meaningful replacements
Simon Rozman [Mon, 4 Feb 2019 08:51:19 +0000 (09:51 +0100)] 
Change generic local variable names with meaningful replacements

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agoAdd support for setupapi.SetupDiClassGuidsFromNameEx()
Simon Rozman [Mon, 4 Feb 2019 08:36:42 +0000 (09:36 +0100)] 
Add support for setupapi.SetupDiClassGuidsFromNameEx()

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agoClean an unused constant
Simon Rozman [Mon, 4 Feb 2019 07:40:06 +0000 (08:40 +0100)] 
Clean an unused constant

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agoReplace SetupDiClassNameFromGuid() with SetupDiClassNameFromGuidEx()
Simon Rozman [Mon, 4 Feb 2019 07:39:31 +0000 (08:39 +0100)] 
Replace SetupDiClassNameFromGuid() with SetupDiClassNameFromGuidEx()

The former is only a subset of the later. To minimize future
maintenance, we'll provide support for extended version only.

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agoAdd support for setupapi.SetupDiClassNameFromGuid()
Simon Rozman [Mon, 4 Feb 2019 07:23:55 +0000 (08:23 +0100)] 
Add support for setupapi.SetupDiClassNameFromGuid()

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agoStop checking for valid handle in DevInfo.Close()
Simon Rozman [Mon, 4 Feb 2019 07:22:49 +0000 (08:22 +0100)] 
Stop checking for valid handle in DevInfo.Close()

User should not have called or deferred the Close() method should
SetupDiGetClassDevsEx() return an error (and invalid handle). And even
if user does that, a SetupDiDestroyDeviceInfoList(INVALID_HANDLE_VALUE)
is harmless. It just returns ERROR_INVALID_HANDLE - we have a unit test
for this in TestSetupDiDestroyDeviceInfoList().

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agoAdd support for setupapi.SetupDiCallClassInstaller()
Simon Rozman [Mon, 4 Feb 2019 06:50:30 +0000 (07:50 +0100)] 
Add support for setupapi.SetupDiCallClassInstaller()

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agoAdd support for setupapi.SetupDi(Get|Set)ClassInstallParams()
Simon Rozman [Fri, 1 Feb 2019 13:58:59 +0000 (14:58 +0100)] 
Add support for setupapi.SetupDi(Get|Set)ClassInstallParams()

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agoAdd support for setupapi.SetupDi(Get|Set)DeviceInstallParams()
Simon Rozman [Fri, 1 Feb 2019 12:59:53 +0000 (13:59 +0100)] 
Add support for setupapi.SetupDi(Get|Set)DeviceInstallParams()

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agoAdd support for setupapi.SetupDiOpenDevRegKey()
Simon Rozman [Fri, 1 Feb 2019 12:00:44 +0000 (13:00 +0100)] 
Add support for setupapi.SetupDiOpenDevRegKey()

Furthermore setupapi.DevInfoData has been obsoleted.
SetupDiEnumDeviceInfo() fills existing SP_DEVINFO_DATA structure now.
As other functions of SetupAPI use SP_DEVINFO_DATA, converting it to
DevInfoData and back would hurt performance.

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agoAdd support for setupapi.SetupDiEnumDeviceInfo()
Simon Rozman [Fri, 1 Feb 2019 11:17:09 +0000 (12:17 +0100)] 
Add support for setupapi.SetupDiEnumDeviceInfo()

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agoUpdate exported types and functions annotations
Simon Rozman [Fri, 1 Feb 2019 10:51:39 +0000 (11:51 +0100)] 
Update exported types and functions annotations

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agoAdd support for setupapi.SetupDiGetDeviceInfoListDetail()
Simon Rozman [Fri, 1 Feb 2019 10:39:57 +0000 (11:39 +0100)] 
Add support for setupapi.SetupDiGetDeviceInfoListDetail()

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agoFinish support for setupapi.SetupDiGetClassDevsEx()
Simon Rozman [Fri, 1 Feb 2019 09:58:06 +0000 (10:58 +0100)] 
Finish support for setupapi.SetupDiGetClassDevsEx()

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agoIntroduce SetupAPI - Windows device and driver management API
Simon Rozman [Thu, 31 Jan 2019 14:20:11 +0000 (15:20 +0100)] 
Introduce SetupAPI - Windows device and driver management API

Signed-off-by: Simon Rozman <simon@rozman.si>
6 years agoImport windows scafolding
Jason A. Donenfeld [Mon, 4 Feb 2019 16:29:52 +0000 (17:29 +0100)] 
Import windows scafolding

6 years agonoise: store clamped key instead of raw key
Jason A. Donenfeld [Sun, 3 Feb 2019 21:00:36 +0000 (22:00 +0100)] 
noise: store clamped key instead of raw key

6 years agotai64n: whiten nano seconds
Jason A. Donenfeld [Sun, 3 Feb 2019 01:08:16 +0000 (02:08 +0100)] 
tai64n: whiten nano seconds

Avoid being too precise of a time oracle.

6 years agouapi: Simpler function signature
Jason A. Donenfeld [Wed, 23 Jan 2019 21:05:07 +0000 (22:05 +0100)] 
uapi: Simpler function signature

6 years agoExtend structs rather than embed, when possible
Jason A. Donenfeld [Thu, 3 Jan 2019 18:04:00 +0000 (19:04 +0100)] 
Extend structs rather than embed, when possible

6 years agoUpdate copyright
Jason A. Donenfeld [Wed, 2 Jan 2019 00:55:51 +0000 (01:55 +0100)] 
Update copyright

6 years agoProperly bubble up setsockopt error from closure
Jason A. Donenfeld [Tue, 25 Dec 2018 21:56:36 +0000 (22:56 +0100)] 
Properly bubble up setsockopt error from closure