diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-03-08 06:11:19 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-03-09 01:13:04 +0100 |
commit | b126bb818430542ff44aa960f3a53009c0333d16 (patch) | |
tree | f5f998ba1f0591412faed9e83897d560792521e6 | |
parent | build: mirror the less reliable ones (diff) | |
download | wireguard-windows-b126bb818430542ff44aa960f3a53009c0333d16.tar.xz wireguard-windows-b126bb818430542ff44aa960f3a53009c0333d16.zip |
build: verify hashes
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | README.md | 8 | ||||
-rw-r--r-- | build.bat | 30 |
2 files changed, 23 insertions, 15 deletions
@@ -4,11 +4,13 @@ Nothing to see here yet. Come back later. ### Requirements - - [Wintun](https://git.zx2c4.com/wintun) + - [Wintun](https://git.zx2c4.com/wintun) (at runtime) + - [Go 1.12](https://golang.org/) (for compilation) + - [Mingw](http://www.mingw.org/) (for compilation) ### Building on Windows -The build script will take care of downloading (without verification) and installing Go 1.12, Mingw, and Patch. +The build script will take care of downloading, verifying, and extracting the right versions of Go, Mingw, and Patch. ``` C:\Projects> git clone https://git.zx2c4.com/wireguard-windows @@ -18,7 +20,7 @@ C:\Projects\wireguard-windows> build ### Building on Linux -You must first have Go 1.12 and Mingw installed. +You must first have Go and Mingw installed. ``` $ sudo apt install mingw-w64 golang-go @@ -7,23 +7,29 @@ if exist deps\.prepared goto :build rmdir /s /q deps 2> NUL mkdir deps || goto :error cd deps || goto :error - echo Downloading golang + echo [+] Downloading golang curl -#fo go.zip https://dl.google.com/go/go1.12.windows-amd64.zip || goto :error - echo Downloading mingw + echo [+] Verifying golang + for /f %%a in ('CertUtil -hashfile go.zip SHA256 ^| findstr /r "^[0-9a-f]*$"') do if not "%%a"=="880ced1aecef08b3471a84381b6c7e2c0e846b81dd97ecb629b534d941f282bd" goto :error + echo [+] Downloading mingw rem Mirror of https://musl.cc/x86_64-w64-mingw32-native.zip curl -#fo mingw.zip https://download.wireguard.com/windows-toolchain/distfiles/x86_64-w64-mingw32-native-20190307.zip || goto :error - echo Downloading patch + echo [+] Verifying mingw + for /f %%a in ('CertUtil -hashfile mingw.zip SHA256 ^| findstr /r "^[0-9a-f]*$"') do if not "%%a"=="5390762183e181804b28eb13815b6210f85a1280057b815f749b06768215f817" goto :error + echo [+] Downloading patch rem Mirror of https://sourceforge.net/projects/gnuwin32/files/patch/2.5.9-7/patch-2.5.9-7-bin.zip curl -#fo patch.zip https://download.wireguard.com/windows-toolchain/distfiles/patch-2.5.9-7-bin.zip || goto :error - echo Extracting golang + echo [+] Verifying patch + for /f %%a in ('CertUtil -hashfile patch.zip SHA256 ^| findstr /r "^[0-9a-f]*$"') do if not "%%a"=="fabd6517e7bd88e067db9bf630d69bb3a38a08e044fa73d13a704ab5f8dd110b" goto :error + echo [+] Extracting golang tar -xf go.zip || goto :error - echo Extracting mingw + echo [+] Extracting mingw tar -xf mingw.zip || goto :error - echo Extracting patch + echo [+] Extracting patch tar -xf patch.zip --strip-components 1 bin || goto :error - echo Patching golang + echo [+] Patching golang .\patch.exe -f -N -r- -d go -p1 --binary < ..\golang-runtime-dll-injection.patch || goto :error - echo Cleaning up + echo [+] Cleaning up del patch.exe patch.zip go.zip mingw.zip || goto :error copy /y NUL .prepared > NUL || goto :error cd .. || goto :error @@ -37,11 +43,11 @@ if exist deps\.prepared goto :build set GOPATH=%STARTDIR%\deps\gopath set GOROOT=%STARTDIR%\deps\go set CGO_ENABLED=1 - echo Assembling resources + echo [+] Assembling resources windres.exe -i resources.rc -o resources.syso -O coff || goto :error - echo Building program + echo [+] Building program go build -ldflags="-H windowsgui -s -w" -v -o wireguard.exe || goto :error - echo Success. Launch wireguard.exe. + echo [+] Success. Launch wireguard.exe. :out set PATH=%OLDPATH% @@ -49,5 +55,5 @@ if exist deps\.prepared goto :build exit /b %errorlevel% :error - echo Failed with error #%errorlevel%. + echo [-] Failed with error #%errorlevel%. goto :out |