Merge pull request #825 from despair86/dev

remove binaries from source tree
pull/848/head
Jeff 5 years ago committed by GitHub
commit 48db4c4a1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

3
.gitignore vendored

@ -61,5 +61,8 @@ GRTAGS
GPATH
version.txt
lokinet-bootstrap.exe
regdbhelper.dll
# xcode
xcuserdata/

@ -20,7 +20,7 @@ if(NOT MSVC_VERSION)
# GNU ld sees fit to merge *all* the .ident sections in object files
# to .r[o]data section one after the other!
add_compile_options(-fno-ident -Wa,-mbig-obj)
link_libraries( -lshlwapi -ldbghelp )
link_libraries( -lws2_32 -liphlpapi -lshlwapi -ldbghelp )
add_definitions(-DWINVER=0x0500 -D_WIN32_WINNT=0x0500)
# Wait a minute, if we're not Microsoft C++, nor a Clang paired with Microsoft C++,
# then the only possible option has to be GNU or a GNU-linked Clang!

@ -1,4 +0,0 @@
*.o
mbedtls/
*.a
*.exe

@ -1,17 +0,0 @@
Copyright (c)2018-2019 Rick V. All rights reserved.
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.

@ -1,71 +0,0 @@
# makefile for windows bootstrap
# requires mbedtls to be installed somewhere, for both native and windows targets
# requires wget to be installed for ca bundle download
# to build:
# $ [g]make prepare;[g]make lokinet-bootstrap
# set this beforehand if you use clang
CC ?= i686-w64-mingw32-gcc
NATIVE_CC ?= cc
# set these for the native system
INCLUDE ?=
LIBS ?=
# set these for 32-bit windows if cross-compiling
WINNT_INCLUDE ?=
WINNT_LIBS ?=
ifdef LTO
LTO_FLAG = -flto
LTO_LDFLAG = -flto -march=nocona -mfpmath=sse -Ofast
endif
.PHONY: download prepare all default
# windows target only
.c.o:
$(CC) $(WINNT_INCLUDE) -Iinclude $(LTO_FLAG) -Ofast -march=nocona -mfpmath=sse $< -c
zpipe: zpipe.c miniz.c
$(NATIVE_CC) $(INCLUDE) -Iinclude $(LIBS) $^ -s -static -o $@
base64enc: base64enc.c
$(NATIVE_CC) $(INCLUDE) -Iinclude $(LIBS) $^ -s -static -o $@ -lmbedx509 -lmbedtls -lmbedcrypto
download:
wget -O ./cacert.pem https://curl.haxx.se/ca/cacert.pem
# I *think* this only work with GNU sed...
prepare: zpipe base64enc download
./zpipe < cacert.pem > data.enc
./base64enc < data.enc > out.bin
sed -ie "s/.\{76\}/&\n/g" out.bin
sed -i 's/.*/\"&\"/g' out.bin
sed -i '61,2268d' bootstrap.c
echo ';' >> out.bin
sed -i '60r out.bin' bootstrap.c
prepare-testnet: zpipe base64enc download
./zpipe < cacert.pem > data.enc
./base64enc < data.enc > out.bin
sed -ie "s/.\{76\}/&\n/g" out.bin
sed -i 's/.*/\"&\"/g' out.bin
sed -i '58,2144d' testnet.c
echo ';' >> out.bin
sed -i '57r out.bin' testnet.c
lokinet-bootstrap: bootstrap.o miniz.o
$(CC) $(WINNT_LIBS) -s -static $^ -o $@.exe $(LTO_LDFLAG) -lmbedx509 -lmbedtls -lmbedcrypto -lws2_32
lokinet-bootstrap-testnet: testnet.o miniz.o
$(CC) $(WINNT_LIBS) -s -static $^ -o $@.exe $(LTO_LDFLAG) -lmbedx509 -lmbedtls -lmbedcrypto -lws2_32
clean:
-@rm lokinet*.exe
-@rm base64enc
-@rm zpipe
-@rm cacert.pem
-@rm data.enc
-@rm out.*
-@rm *.o

@ -1,35 +0,0 @@
# LokiNET bootstrap for Windows
This is a tiny executable that does the same thing as the `lokinet-bootstrap` shell script for Linux, specifically for the purpose of bypassing broken or outdated versions of Schannel that do not support current versions of TLS.
# Building
## requirements
- mbedtls 2.13.0 or later, for both host and windows
- wget for host (to download Netscape CA bundle from cURL website)
- Also included is a patch that can be applied to the mbedtls source to enable features like AES-NI in protected mode, plus some networking fixes for win32
native build:
$ export INCLUDE=/mingw32/include LIBS=/mingw32/lib # or a different path
$ export CC=cc # change these if you use clang
$ export NATIVE_CC=$CC
$ export WINNT_INCLUDE=$INCLUDE WINNT_LIBS=$LIBS
$ make prepare;make lokinet-bootstrap
cross-compile build (If you have *GNU* sed, you can also update the certificate trust store with `make prepare`):
$ export INCLUDE=/usr/local/include LIBS=/usr/local/lib # or a different path
$ export CC=i686-w64-mingw32-gcc # change these if you use clang, make sure these are in your system $PATH!
$ export NATIVE_CC=cc
$ export WINNT_INCLUDE=/path/to/win32/headers WINNT_LIBS=/path/to/win32/libs
$ make lokinet-bootstrap
# Usage
C:\>lokinet-bootstrap [uri] [local download path]
this is also included in the lokinet installer package.
-rick

@ -1,64 +0,0 @@
/*
* Copyright (c)2018-2019 Rick V. All rights reserved.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*/
/* this is a tiny build-time utility that base64 encodes up to 512K
* of text/binary data from stdin. (On UNIX, we'd use GNU's [g]base64(1)
* to encode the stream. Can't guarantee that a windows user will have cygwin
* installed, so we bootstrap these at build-time instead.)
*
* here, it is used to encode the compressed zlib-stream of the
* Netscape root certificate trust store on behalf of the lokinet
* for NT bootstrap stubs.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "sysconf.h"
#ifdef HAVE_SETMODE
# define SET_BINARY_MODE(handle) setmode(handle, O_BINARY)
#else
# define SET_BINARY_MODE(handle) ((void)0)
#endif
#include <mbedtls/base64.h>
#include <mbedtls/error.h>
main(argc, argv)
char** argv;
{
int size,r, inl;
unsigned char in[524288];
unsigned char out[1048576];
unsigned char err[1024];
memset(&in, 0, 524288);
memset(&out, 0, 1048576);
SET_BINARY_MODE(0);
/* Read up to 512K of data from stdin */
inl = fread(in, 1, 524288, stdin);
r = mbedtls_base64_encode(out, 1048576, &size, in, inl);
if (r)
{
mbedtls_strerror(r, err, 1024);
printf("error: %s\n", err);
return r;
}
fprintf(stdout, "%s", out);
return 0;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -1,95 +0,0 @@
/**
* sysconf.h -- system-dependent macros and settings
*
* Copyright (C) 2002-2004 Cosmin Truta.
* Permission to use and distribute freely.
* No warranty.
**/
#ifndef SYSCONF_H
#define SYSCONF_H
/*****************************************************************************/
/* Platform identifiers */
/* Detect Unix. */
#if defined(unix) || defined(__linux__) || defined(BSD) || defined(__CYGWIN__)
/* Add more systems here. */
# ifndef UNIX
# define UNIX
# endif
#endif
/* Detect MS-DOS. */
#if defined(__MSDOS__)
# ifndef MSDOS
# define MSDOS
# endif
#endif
/* TO DO: Detect OS/2. */
/* Detect Windows. */
#if defined(_WIN32) || defined(__WIN32__)
# ifndef WIN32
# define WIN32
# endif
#endif
#if defined(_WIN64)
# ifndef WIN64
# define WIN64
# endif
#endif
#if defined(_WINDOWS) || defined(WIN32) || defined(WIN64)
# ifndef WINDOWS
# define WINDOWS
# endif
#endif
/* Enable POSIX-friendly symbols on Microsoft (Visual) C. */
#ifdef _MSC_VER
# define _POSIX_
#endif
/*****************************************************************************/
/* Library access */
#if defined(UNIX)
# include <unistd.h>
#endif
#if defined(_POSIX_VERSION)
# include <fcntl.h>
# ifndef HAVE_ISATTY
# define HAVE_ISATTY
# endif
#endif
#if defined(MSDOS) || defined(OS2) || defined(WINDOWS) || defined(__CYGWIN__)
/* Add more systems here, e.g. MacOS 9 and earlier. */
# include <fcntl.h>
# include <io.h>
# ifndef HAVE_ISATTY
# define HAVE_ISATTY
# endif
# ifndef HAVE_SETMODE
# define HAVE_SETMODE
# endif
#endif
/* Standard I/O handles. */
#define STDIN 0
#define STDOUT 1
#define STDERR 2
/* Provide a placeholder for O_BINARY, if it doesn't exist. */
#ifndef O_BINARY
# define O_BINARY 0
#endif
#endif /* SYSCONF_H */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -1,209 +0,0 @@
/* zpipe.c: example of proper use of zlib's inflate() and deflate()
Not copyrighted -- provided to the public domain
Version 1.4 11 December 2005 Mark Adler */
/* Version history:
1.0 30 Oct 2004 First version
1.1 8 Nov 2004 Add void casting for unused return values
Use switch statement for inflate() return values
1.2 9 Nov 2004 Add assertions to document zlib guarantees
1.3 6 Apr 2005 Remove incorrect assertion in inf()
1.4 11 Dec 2005 Add hack to avoid MSDOS end-of-line conversions
Avoid some compiler warnings for input and output buffers
*/
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include "miniz.h"
#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__)
# include <fcntl.h>
# include <io.h>
# define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY)
#else
# define SET_BINARY_MODE(file)
#endif
#define CHUNK 16384
/* Compress from file source to file dest until EOF on source.
def() returns Z_OK on success, Z_MEM_ERROR if memory could not be
allocated for processing, Z_STREAM_ERROR if an invalid compression
level is supplied, Z_VERSION_ERROR if the version of zlib.h and the
version of the library linked do not match, or Z_ERRNO if there is
an error reading or writing the files. */
int def(FILE *source, FILE *dest, int level)
{
int ret, flush;
unsigned have;
z_stream strm;
unsigned char in[CHUNK];unsigned char out[CHUNK];
/* allocate deflate state */
strm.zalloc = Z_NULL;
strm.zfree = Z_NULL;
strm.opaque = Z_NULL;
ret = deflateInit(&strm, level);
if (ret != Z_OK)
return ret;
/* compress until end of file */
do {
strm.avail_in = fread(in, 1, CHUNK, source);
if (ferror(source)) {
(void)deflateEnd(&strm);
return Z_ERRNO;
}
flush = feof(source) ? Z_FINISH : Z_NO_FLUSH;
strm.next_in = in;
/* run deflate() on input until output buffer not full, finish
compression if all of source has been read in */
do {
strm.avail_out = CHUNK;
strm.next_out = out;
ret = deflate(&strm, flush); /* no bad return value */
assert(ret != Z_STREAM_ERROR); /* state not clobbered */
have = CHUNK - strm.avail_out;
if (fwrite(out, 1, have, dest) != have || ferror(dest)) {
(void)deflateEnd(&strm);
return Z_ERRNO;
}
} while (strm.avail_out == 0);
assert(strm.avail_in == 0); /* all input will be used */
/* done when last data in file processed */
} while (flush != Z_FINISH);
assert(ret == Z_STREAM_END); /* stream will be complete */
/* clean up and return */
(void)deflateEnd(&strm);
return Z_OK;
}
/* Decompress from file source to file dest until stream ends or EOF.
inf() returns Z_OK on success, Z_MEM_ERROR if memory could not be
allocated for processing, Z_DATA_ERROR if the deflate data is
invalid or incomplete, Z_VERSION_ERROR if the version of zlib.h and
the version of the library linked do not match, or Z_ERRNO if there
is an error reading or writing the files. */
int inf(FILE *source, FILE *dest)
{
int ret;
unsigned have;
z_stream strm;
unsigned char in[CHUNK];
unsigned char out[CHUNK];
/* allocate inflate state */
strm.zalloc = Z_NULL;
strm.zfree = Z_NULL;
strm.opaque = Z_NULL;
strm.avail_in = 0;
strm.next_in = Z_NULL;
ret = inflateInit(&strm);
if (ret != Z_OK)
return ret;
/* decompress until deflate stream ends or end of file */
do {
strm.avail_in = fread(in, 1, CHUNK, source);
if (ferror(source)) {
(void)inflateEnd(&strm);
return Z_ERRNO;
}
if (strm.avail_in == 0)
break;
strm.next_in = in;
/* run inflate() on input until output buffer not full */
do {
strm.avail_out = CHUNK;
strm.next_out = out;
ret = inflate(&strm, Z_NO_FLUSH);
assert(ret != Z_STREAM_ERROR); /* state not clobbered */
switch (ret) {
case Z_NEED_DICT:
ret = Z_DATA_ERROR; /* and fall through */
case Z_DATA_ERROR:
case Z_MEM_ERROR:
(void)inflateEnd(&strm);
return ret;
}
have = CHUNK - strm.avail_out;
if (fwrite(out, 1, have, dest) != have || ferror(dest)) {
(void)inflateEnd(&strm);
return Z_ERRNO;
}
} while (strm.avail_out == 0);
/* done when inflate() says it's done */
} while (ret != Z_STREAM_END);
/* clean up and return */
(void)inflateEnd(&strm);
return ret == Z_STREAM_END ? Z_OK : Z_DATA_ERROR;
}
/* report a zlib or i/o error */
void zerr(int ret)
{
fputs("zpipe: ", stderr);
switch (ret) {
case Z_ERRNO:
if (ferror(stdin))
fputs("error reading stdin\n", stderr);
if (ferror(stdout))
fputs("error writing stdout\n", stderr);
break;
case Z_STREAM_ERROR:
fputs("invalid compression level\n", stderr);
break;
case Z_DATA_ERROR:
fputs("invalid or incomplete deflate data\n", stderr);
break;
case Z_MEM_ERROR:
fputs("out of memory\n", stderr);
break;
case Z_VERSION_ERROR:
fputs("zlib version mismatch!\n", stderr);
}
}
/* compress or decompress from stdin to stdout */
int main(int argc, char **argv)
{
int ret;
/* avoid end-of-line conversions */
SET_BINARY_MODE(stdin);
SET_BINARY_MODE(stdout);
/* do compression if no arguments */
/* Warning: Not compatible with plain libz, dial it back down to
* 9 if this is required, uber-level is 10
* since we have everything crammed in miniz, we don't depend on
* libz at all.
*/
if (argc == 1) {
ret = def(stdin, stdout, MZ_UBER_COMPRESSION);
if (ret != Z_OK)
zerr(ret);
return ret;
}
/* do decompression if -d specified */
else if (argc == 2 && strcmp(argv[1], "-d") == 0) {
ret = inf(stdin, stdout);
if (ret != Z_OK)
zerr(ret);
return ret;
}
/* otherwise, report usage */
else {
fputs("zpipe usage: zpipe [-d] < source > dest\n", stderr);
return 1;
}
}

@ -1,17 +0,0 @@
# TUN/TAP driver v9 for Windows
in order to set up tunnels on Windows, you will need
to instal this driver.
* v9.9.2.3 is for Windows 2000/XP/2003 (NDIS 5.0-based)
* v9.21.2 is for Windows Vista/7/8.1 and 10 (NDIS 6.0, forward-compatible with NDIS 10.0)
to instal, extract the corresponding version of the driver for your
platform and run `%ARCH%/install_tap.cmd` in an elevated shell
to remove *ALL* virtual tunnel adapters, run `%ARCH%/del_tap.cmd` in an elevated shell. Use the
Device Manager snap-in to remove individual adapter instances.
Both are signed by OpenVPN Inc, and are available for 32- and 64-bit archs.
-despair86

@ -1,9 +0,0 @@
*.o
mbedtls/
*.a
*.dll
*.so
*.exe
cacert.pem
*.enc
*.bin*

@ -1,17 +0,0 @@
Copyright (c)2018-2019 Rick V. All rights reserved.
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.

@ -1,62 +0,0 @@
# makefile for libhttp
# requires mbedtls to be installed somewhere, for both host and target systems
# requires wget to be installed for ca bundle download
# to build:
# make prepare; make libhttp
# set this beforehand if you use clang
# make sure to preset CFLAGS if you use non-ix86 platform
# or non-GNU-compat C compilation system
# Uncomment these if you're on a 32-bit Linux?
# CC = cc
# CFLAGS = -Ofast -march=nocona -mfpmath=sse
# path to mbedtls headers/libs and system libs
# if you have local copies of libs in this folder,
# try LIBS=-L. (other stuff here)
#
# -lsocket -lnsl on Sun
# -lws2_32 on windows nt
#INCLUDE :=
#LIBS :=
.PHONY: download prepare all default
.c.o:
$(CC) $(INCLUDE) -fPIC -Iinclude $(CFLAGS) $< -c
zpipe: zpipe.c miniz.c
$(CC) $(INCLUDE) -Iinclude $(CFLAGS) $^ -s -static -o $@
base64enc: base64enc.c
$(CC) $(INCLUDE) -Iinclude $(CFLAGS) $^ -s -static -o $@ -lmbedx509 -lmbedtls -lmbedcrypto $(LIBS)
download:
wget -O ./cacert.pem https://curl.haxx.se/ca/cacert.pem
# I *think* this only work with GNU sed...
prepare: zpipe base64enc download
./zpipe < cacert.pem > data.enc
./base64enc < data.enc > out.bin
sed -ie "s/.\{76\}/&\n/g" out.bin
sed -i 's/.*/\"&\"/g' out.bin
sed -i '38,2228d' cacerts.c
echo ';' >> out.bin
sed -i '37r out.bin' cacerts.c
libhttp.dll: cacerts.o miniz.o libhttp.o uri.o internal.o
$(CC) -fPIC $(CFLAGS) $^ -s -shared -o $@ -static -lmbedx509 -lmbedtls -lmbedcrypto $(LIBS)
libhttp.so: cacerts.o miniz.o libhttp.o uri.o internal.o
$(CC) $^ -fPIC $(CFLAGS) -shared -o $@ $(LIBS) -lmbedx509 -lmbedtls -lmbedcrypto $(SYS_LIBS)
clean:
-@rm base64enc
-@rm zpipe
-@rm cacert.pem
-@rm data.enc
-@rm out.*
-@rm *.o
-@rm *.so
-@rm *.dll

@ -1,26 +0,0 @@
# liblokiweb (libhttp)
## Building
### requirements
- mbedtls 2.13.0 or later, for both host and target (if cross-compiling)
- wget for host (to download Netscape root certificate store from cURL website)
- Also included is a patch that can be applied to the mbedtls source to enable features like AES-NI in protected mode, plus some networking fixes for win32, see `../contrib/lokinet-bootstrap-winnt/mbedtls-win32.patch`
build:
$ make prepare; make libhttp.[so|dll]
## Useful build-time variables
- INCLUDE: path to mbedtls headers
- LIBS: path to mbedtls libraries
- SYS_LIBS: system-specific link libraries (`-lsocket -lnsl` on Sun systems, `-lws2_32` [or `-lwsock32` if IPv6 is disabled] on Windows)
## Usage
- include libhttp.h in your source
- link against libhttp.[so|dll]
-rick

@ -1,64 +0,0 @@
/*
* Copyright (c)2018-2019 Rick V. All rights reserved.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*/
/* this is a tiny build-time utility that base64 encodes up to 512K
* of text/binary data from stdin. (On UNIX, we'd use GNU's [g]base64(1)
* to encode the stream. Can't guarantee that a windows user will have cygwin
* installed, so we bootstrap these at build-time instead.)
*
* here, it is used to encode the compressed zlib-stream of the
* Netscape root certificate trust store on behalf of the lokinet
* for NT bootstrap stubs.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "sysconf.h"
#ifdef HAVE_SETMODE
# define SET_BINARY_MODE(handle) setmode(handle, O_BINARY)
#else
# define SET_BINARY_MODE(handle) ((void)0)
#endif
#include <mbedtls/base64.h>
#include <mbedtls/error.h>
main(argc, argv)
char** argv;
{
int size,r, inl;
unsigned char in[524288];
unsigned char out[1048576];
unsigned char err[1024];
memset(&in, 0, 524288);
memset(&out, 0, 1048576);
SET_BINARY_MODE(0);
/* Read up to 512K of data from stdin */
inl = fread(in, 1, 524288, stdin);
r = mbedtls_base64_encode(out, 1048576, &size, in, inl);
if (r)
{
mbedtls_strerror(r, err, 1024);
printf("error: %s\n", err);
return r;
}
fprintf(stdout, "%s", out);
return 0;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -1,95 +0,0 @@
/**
* sysconf.h -- system-dependent macros and settings
*
* Copyright (C) 2002-2004 Cosmin Truta.
* Permission to use and distribute freely.
* No warranty.
**/
#ifndef SYSCONF_H
#define SYSCONF_H
/*****************************************************************************/
/* Platform identifiers */
/* Detect Unix. */
#if defined(unix) || defined(__linux__) || defined(BSD) || defined(__CYGWIN__)
/* Add more systems here. */
# ifndef UNIX
# define UNIX
# endif
#endif
/* Detect MS-DOS. */
#if defined(__MSDOS__)
# ifndef MSDOS
# define MSDOS
# endif
#endif
/* TO DO: Detect OS/2. */
/* Detect Windows. */
#if defined(_WIN32) || defined(__WIN32__)
# ifndef WIN32
# define WIN32
# endif
#endif
#if defined(_WIN64)
# ifndef WIN64
# define WIN64
# endif
#endif
#if defined(_WINDOWS) || defined(WIN32) || defined(WIN64)
# ifndef WINDOWS
# define WINDOWS
# endif
#endif
/* Enable POSIX-friendly symbols on Microsoft (Visual) C. */
#ifdef _MSC_VER
# define _POSIX_
#endif
/*****************************************************************************/
/* Library access */
#if defined(UNIX)
# include <unistd.h>
#endif
#if defined(_POSIX_VERSION)
# include <fcntl.h>
# ifndef HAVE_ISATTY
# define HAVE_ISATTY
# endif
#endif
#if defined(MSDOS) || defined(OS2) || defined(WINDOWS) || defined(__CYGWIN__)
/* Add more systems here, e.g. MacOS 9 and earlier. */
# include <fcntl.h>
# include <io.h>
# ifndef HAVE_ISATTY
# define HAVE_ISATTY
# endif
# ifndef HAVE_SETMODE
# define HAVE_SETMODE
# endif
#endif
/* Standard I/O handles. */
#define STDIN 0
#define STDOUT 1
#define STDERR 2
/* Provide a placeholder for O_BINARY, if it doesn't exist. */
#ifndef O_BINARY
# define O_BINARY 0
#endif
#endif /* SYSCONF_H */

@ -1,39 +0,0 @@
/*
* Copyright (c)2018-2019 Rick V. All rights reserved.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*------------------------------------------------------------------------------
* internal utility functions for libhttp
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include "internal.h"
void *memncat(a, an, b, bn, s)
const void *a, *b;
size_t an, bn, s;
{
char *p = malloc(s * (an + bn));
memset(p, '\0', s * (an + bn));
memcpy(p, a, an*s);
memcpy(p + an*s, b, bn*s);
return p;
}

@ -1,84 +0,0 @@
/*
* Copyright (c)2018-2019 Rick V. All rights reserved.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*------------------------------------------------------------------------------
* this file contains internal definitions of libhttp data structures
* internal.h and libhttp.h are mutually exclusive as they define the same
* data structures, library clients must use libhttp.h
*
*/
#ifndef INTERNAL_H
#define INTERNAL_H
/* PolarSSL */
#include <mbedtls/ssl.h>
#include <mbedtls/entropy.h>
#include <mbedtls/ctr_drbg.h>
#include <mbedtls/net_sockets.h>
#include <mbedtls/error.h>
#include <mbedtls/certs.h>
#include <mbedtls/base64.h>
/* function declarations */
void free_parsed_url();
parse_url();
void *memncat();
typedef struct url_parser_url
{
char *protocol;
char *host;
int port;
char *path;
char *query_string;
int host_exists;
char *host_ip;
} url_t;
typedef struct
{
char *ua; /* platform-specific user-agent string */
char *request_uri; /* last uri requested, the response corresponds to this link */
struct responseBody
{
/* the raw_data and headers point to the same place */
/* the content is an offset into the raw_data */
union
{
char* raw_data;
char* headers;
};
char* content;
};
/* not a public field */
struct
{
mbedtls_net_context server_fd;
mbedtls_entropy_context entropy;
mbedtls_ctr_drbg_context ctr_drbg;
mbedtls_ssl_context ssl;
mbedtls_ssl_config conf;
mbedtls_x509_crt cacert;
bool TLSInit;
char seed[64];
} tls_state;
} http_state;
#endif

@ -1,301 +0,0 @@
/*
* Copyright (c)2018-2019 Rick V. All rights reserved.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*------------------------------------------------------------------------------
* libhttp, a really small HTTP 0-3 client library with TLS
*
* HTTPS only; why the hell would you serve semi-sensitive data over an
* unencrypted channel? In fact, the polarssl integration is intended to
* bypass limitations in the native TLS stack (no TLS 1.1+ on some older
* platforms, lack of high-encryption ciphersuites other than ARC4 or
* Triple-DES, etc)
* -rick
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#ifdef _WIN32
#include <windows.h>
#include <wincrypt.h>
#endif
#include "miniz.h"
#include "internal.h"
/* only decompress rootcerts once */
unsigned char* ca_certs = NULL;
/* netscape ca bundle */
const unsigned char *ca_cert_store_encoded;
/* imageboard ref just because */
static char userAgent[] = "NetRunner_Micro/0.1 PolarSSL/2.16.0;U;";
static void destroy_persistent_data()
{
free(ca_certs);
ca_certs = NULL;
}
static bool generateSeed(client)
http_state *client;
{
#ifdef _WIN32
HCRYPTPROV hprovider;
/* On Windows NT 4.0 or later, use CryptoAPI to grab 64 bytes of random data */
hprovider = 0;
CryptAcquireContext(&hprovider, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT);
CryptGenRandom(hprovider, 64, (BYTE*)&client->tls_state.seed);
CryptReleaseContext(hprovider, 0);
#endif
client->tls_state.seed[63] = '\0'; /* null-terminate for safety */
return true;
}
static bool initTLS(client)
http_state *client;
{
int inf_status,r;
size_t out;
unsigned long inf_len;
unsigned char* tmp;
char str[512];
mbedtls_net_init(&client->tls_state.server_fd);
mbedtls_ssl_init(&client->tls_state.ssl);
mbedtls_ssl_config_init(&client->tls_state.conf);
mbedtls_x509_crt_init(&client->tls_state.cacert);
mbedtls_entropy_init(&client->tls_state.entropy);
mbedtls_ctr_drbg_init(&client->tls_state.ctr_drbg);
/* only decompress once */
if (!ca_certs)
{
tmp = malloc(524288);
r = strlen(ca_cert_store_encoded) - 1;
r = mbedtls_base64_decode(tmp, 524288, &out, ca_cert_store_encoded, r);
if (r)
{
mbedtls_strerror(r, (char*)tmp, 524288);
printf("decoding failed: %s\n", tmp);
free(tmp);
return false;
}
/* inflate ca certs, they are still compressed */
ca_certs = malloc(524288);
inf_len = 524288;
inf_status = uncompress(ca_certs, &inf_len, tmp, out);
if (inf_status != Z_OK)
{
printf("decompression failed: %s\n", mz_error(inf_status));
free(tmp);
return false;
}
free(tmp);
}
if (!generateSeed())
return false;
if (mbedtls_ctr_drbg_seed(&client->tls_state.ctr_drbg, mbedtls_entropy_func, &client->tls_state.entropy, (const unsigned char*)client->tls_state.seed, 64)) {
return false;
}
r = mbedtls_x509_crt_parse(&client->tls_state.cacert, ca_certs, inf_len+1);
if (r < 0) {
mbedtls_strerror(r, str, 512);
printf("parse ca cert store failed\n ! mbedtls_x509_crt_parse returned: %s\n\n", str);
return false;
}
client->tls_state.TLSInit = true;
return true;
}
/* if false, library may be in an inconsistent state,
* call terminate_client()
*/
bool init_client(client)
http_state* client;
{
if (!ca_certs)
atexit(destroy_persistent_data);
if (!client)
client = calloc(1, sizeof(http_state));
initTLS(client);
return client->tls_state.TLSInit;
}
static void ua_string(client)
http_state *client;
{
/* fill in user-agent string */
#ifdef _WIN32
DWORD version, major, minor, build;
version = GetVersion();
major = (DWORD)(LOBYTE(LOWORD(version)));
minor = (DWORD)(HIBYTE(LOWORD(version)));
if (version < 0x80000000)
build = (DWORD)(HIWORD(version));
client->ua = malloc(512);
snprintf(client->ua, 512, "%sWindows NT %d.%d", userAgent, major, minor);
#endif
}
download_https_resource(client, uri)
http_state *client;
char *uri;
{
int r, len;
char buf[1024], port[8];
char *rq, *resp;
unsigned flags;
url_t *parsed_uri;
rq = malloc(4096);
/* this string gets readjusted each time we make a request */
client->request_uri = realloc(NULL, strlen(uri)+1);
parsed_uri = malloc(sizeof(url_t));
memset(parsed_uri, 0, sizeof(url_t));
r = parse_url(uri, false, parsed_uri);
if (r)
{
printf("Invalid URI pathspec\n");
return -1;
}
if (!client->tls_state.TLSInit)
{
printf("Failed to initialise polarssl\n");
return -1;
}
/* get host name, set port if blank */
if (!strcmp("https", parsed_uri->protocol) && !parsed_uri->port)
parsed_uri->port = 443;
printf("connecting to %s on port %d...",parsed_uri->host, parsed_uri->port);
sprintf(port, "%d", parsed_uri->port);
r = mbedtls_net_connect(&client->tls_state.server_fd, parsed_uri->host, port, MBEDTLS_NET_PROTO_TCP);
if (r)
{
printf("error - failed to connect to server: %d\n", r);
goto exit;
}
r = mbedtls_ssl_config_defaults(&client->tls_state.conf, MBEDTLS_SSL_IS_CLIENT, MBEDTLS_SSL_TRANSPORT_STREAM, MBEDTLS_SSL_PRESET_DEFAULT);
if (r)
{
printf("error - failed to set TLS options: %d\n", r);
goto exit;
}
mbedtls_ssl_conf_authmode(&client->tls_state.conf, MBEDTLS_SSL_VERIFY_REQUIRED);
mbedtls_ssl_conf_ca_chain(&client->tls_state.conf, &client->tls_state.cacert, NULL);
mbedtls_ssl_conf_rng(&client->tls_state.conf, mbedtls_ctr_drbg_random, &client->tls_state.ctr_drbg);
r = mbedtls_ssl_setup(&client->tls_state.ssl, &client->tls_state.conf);
if (r)
{
printf("error - failed to setup TLS session: %d\n", r);
goto exit;
}
r = mbedtls_ssl_set_hostname(&client->tls_state.ssl, parsed_uri->host);
if (r)
{
printf("error - failed to perform SNI: %d\n", r);
goto exit;
}
mbedtls_ssl_set_bio(&client->tls_state.ssl, &client->tls_state.server_fd, mbedtls_net_send, mbedtls_net_recv, NULL);
while ((r = mbedtls_ssl_handshake(&client->tls_state.ssl)) != 0)
{
if (r != MBEDTLS_ERR_SSL_WANT_READ && r != MBEDTLS_ERR_SSL_WANT_WRITE)
{
printf(" failed\n ! mbedtls_ssl_handshake returned -0x%x\n\n", -r);
goto exit;
}
}
if ((flags = mbedtls_ssl_get_verify_result(&client->tls_state.ssl)) != 0)
{
char vrfy_buf[512];
printf(" failed\n");
mbedtls_x509_crt_verify_info(vrfy_buf, sizeof(vrfy_buf), " ! ", flags);
printf("%s\n", vrfy_buf);
goto exit;
}
printf("\nDownloading %s...", &parsed_uri->path[1]);
snprintf(rq, 512, "GET %s HTTP/1.0\r\nHost: %s\r\nUser-Agent: %s\r\n\r\n", parsed_uri->path, parsed_uri->host, client->ua);
while ((r = mbedtls_ssl_write(&client->tls_state.ssl, (unsigned char*)rq, strlen(rq))) <= 0)
{
if (r != MBEDTLS_ERR_SSL_WANT_READ && r != MBEDTLS_ERR_SSL_WANT_WRITE)
{
printf("failed! error %d\n\n", r);
goto exit;
}
}
memset(rq, 0, 4096);
len = 0;
do {
r = mbedtls_ssl_read(&client->tls_state.ssl, (unsigned char*)buf, 1024);
if (r <= 0)
break;
else
{
rq = memncat(rq, len, buf, r, sizeof(char));
len += r;
}
} while (r);
printf("%d bytes downloaded to core.\n", len);
mbedtls_ssl_close_notify(&client->tls_state.ssl);
if (!strstr(rq, "200 OK"))
{
printf("An error occurred.\n");
printf("Server response:\n%s", rq);
goto exit;
}
/* Response body is in buf after processing */
resp = strstr(rq, "Content-Length");
r = strcspn(resp, "0123456789");
memcpy(buf, &resp[r], 4);
buf[3] = '\0';
r = atoi(buf);
resp = strstr(rq, "\r\n\r\n");
memcpy(buf, &resp[4], r);
r = 0;
exit:
free(rq);
free_parsed_url(parsed_uri);
return r;
}
void terminate_client(client)
http_state *client;
{
mbedtls_ssl_close_notify(&client->tls_state.ssl);
mbedtls_net_free(&client->tls_state.server_fd);
mbedtls_x509_crt_free(&client->tls_state.cacert);
mbedtls_ssl_free(&client->tls_state.ssl);
mbedtls_ssl_config_free(&client->tls_state.conf);
mbedtls_ctr_drbg_free(&client->tls_state.ctr_drbg);
mbedtls_entropy_free(&client->tls_state.entropy);
free(client->ua);
}

@ -1,59 +0,0 @@
/*
* Copyright (c)2018-2019 Rick V. All rights reserved.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*------------------------------------------------------------------------------
* libhttp, a really small HTTP 0-3 client library with TLS
* public API header
* do not include this file in any of the libhttp sources itself
*
* HTTPS only; why the hell would you serve semi-sensitive data over an
* unencrypted channel? In fact, the polarssl integration is intended to
* bypass limitations in the native TLS stack (no TLS 1.1+ on some older
* platforms, lack of high-encryption ciphersuites other than ARC4 or
* Triple-DES, etc)
* -rick
*/
#ifndef LIBHTTP_H
#define LIBHTTP_H
/* http client object */
typedef struct
{
char *ua; /* platform-specific user-agent string */
char *request_uri; /* last uri requested, the response corresponds to this link */
struct responseBody
{
/* the raw_data and headers point to the same place */
/* the content is an offset into the raw_data */
union
{
char* raw_data;
char* headers;
};
char* content;
};
/* anonymous field, do not poke */
void *reserved;
} http_state;
/* libhttp public API */
bool init_client(http_state*);
int download_https_resource(http_state*, char*);
void terminate_client(http_state*);
#endif

File diff suppressed because it is too large Load Diff

@ -1,138 +0,0 @@
/*
* Copyright (c)2018-2019 Rick V. All rights reserved.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*------------------------------------------------------------------------------
* uri parsing functions
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <assert.h>
#include "internal.h"
#ifdef _WIN32
#include <windows.h>
#include <wincrypt.h>
#else
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#endif
void free_parsed_url(url_parsed)
url_t *url_parsed;
{
if (url_parsed->protocol)
free(url_parsed->protocol);
if (url_parsed->host)
free(url_parsed->host);
if (url_parsed->path)
free(url_parsed->path);
if (url_parsed->query_string)
free(url_parsed->query_string);
free(url_parsed);
}
parse_url(url, verify_host, parsed_url)
char *url;
bool verify_host;
url_t *parsed_url;
{
char *local_url, *token, *token_host, *host_port, *host_ip, *token_ptr;
char *host_token_ptr, *path = NULL;
/* Copy our string */
local_url = strdup(url);
token = strtok_r(local_url, ":", &token_ptr);
parsed_url->protocol = strdup(token);
/* Host:Port */
token = strtok_r(NULL, "/", &token_ptr);
if (token)
host_port = strdup(token);
else
host_port = (char *) calloc(1, sizeof(char));
token_host = strtok_r(host_port, ":", &host_token_ptr);
parsed_url->host_ip = NULL;
if (token_host) {
parsed_url->host = strdup(token_host);
if (verify_host) {
struct hostent *host;
host = gethostbyname(parsed_url->host);
if (host != NULL) {
parsed_url->host_ip = inet_ntoa(* (struct in_addr *) host->h_addr);
parsed_url->host_exists = 1;
} else {
parsed_url->host_exists = 0;
}
} else {
parsed_url->host_exists = -1;
}
} else {
parsed_url->host_exists = -1;
parsed_url->host = NULL;
}
/* Port */
token_host = strtok_r(NULL, ":", &host_token_ptr);
if (token_host)
parsed_url->port = atoi(token_host);
else
parsed_url->port = 0;
token_host = strtok_r(NULL, ":", &host_token_ptr);
assert(token_host == NULL);
token = strtok_r(NULL, "?", &token_ptr);
parsed_url->path = NULL;
if (token) {
path = (char *) realloc(path, sizeof(char) * (strlen(token) + 2));
memset(path, 0, sizeof(char) * (strlen(token)+2));
strcpy(path, "/");
strcat(path, token);
parsed_url->path = strdup(path);
free(path);
} else {
parsed_url->path = (char *) malloc(sizeof(char) * 2);
strcpy(parsed_url->path, "/");
}
token = strtok_r(NULL, "?", &token_ptr);
if (token) {
parsed_url->query_string = (char *) malloc(sizeof(char) * (strlen(token) + 1));
strncpy(parsed_url->query_string, token, strlen(token));
} else {
parsed_url->query_string = NULL;
}
token = strtok_r(NULL, "?", &token_ptr);
assert(token == NULL);
free(local_url);
free(host_port);
return 0;
}

@ -1,209 +0,0 @@
/* zpipe.c: example of proper use of zlib's inflate() and deflate()
Not copyrighted -- provided to the public domain
Version 1.4 11 December 2005 Mark Adler */
/* Version history:
1.0 30 Oct 2004 First version
1.1 8 Nov 2004 Add void casting for unused return values
Use switch statement for inflate() return values
1.2 9 Nov 2004 Add assertions to document zlib guarantees
1.3 6 Apr 2005 Remove incorrect assertion in inf()
1.4 11 Dec 2005 Add hack to avoid MSDOS end-of-line conversions
Avoid some compiler warnings for input and output buffers
*/
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include "miniz.h"
#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__)
# include <fcntl.h>
# include <io.h>
# define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY)
#else
# define SET_BINARY_MODE(file)
#endif
#define CHUNK 16384
/* Compress from file source to file dest until EOF on source.
def() returns Z_OK on success, Z_MEM_ERROR if memory could not be
allocated for processing, Z_STREAM_ERROR if an invalid compression
level is supplied, Z_VERSION_ERROR if the version of zlib.h and the
version of the library linked do not match, or Z_ERRNO if there is
an error reading or writing the files. */
int def(FILE *source, FILE *dest, int level)
{
int ret, flush;
unsigned have;
z_stream strm;
unsigned char in[CHUNK];unsigned char out[CHUNK];
/* allocate deflate state */
strm.zalloc = Z_NULL;
strm.zfree = Z_NULL;
strm.opaque = Z_NULL;
ret = deflateInit(&strm, level);
if (ret != Z_OK)
return ret;
/* compress until end of file */
do {
strm.avail_in = fread(in, 1, CHUNK, source);
if (ferror(source)) {
(void)deflateEnd(&strm);
return Z_ERRNO;
}
flush = feof(source) ? Z_FINISH : Z_NO_FLUSH;
strm.next_in = in;
/* run deflate() on input until output buffer not full, finish
compression if all of source has been read in */
do {
strm.avail_out = CHUNK;
strm.next_out = out;
ret = deflate(&strm, flush); /* no bad return value */
assert(ret != Z_STREAM_ERROR); /* state not clobbered */
have = CHUNK - strm.avail_out;
if (fwrite(out, 1, have, dest) != have || ferror(dest)) {
(void)deflateEnd(&strm);
return Z_ERRNO;
}
} while (strm.avail_out == 0);
assert(strm.avail_in == 0); /* all input will be used */
/* done when last data in file processed */
} while (flush != Z_FINISH);
assert(ret == Z_STREAM_END); /* stream will be complete */
/* clean up and return */
(void)deflateEnd(&strm);
return Z_OK;
}
/* Decompress from file source to file dest until stream ends or EOF.
inf() returns Z_OK on success, Z_MEM_ERROR if memory could not be
allocated for processing, Z_DATA_ERROR if the deflate data is
invalid or incomplete, Z_VERSION_ERROR if the version of zlib.h and
the version of the library linked do not match, or Z_ERRNO if there
is an error reading or writing the files. */
int inf(FILE *source, FILE *dest)
{
int ret;
unsigned have;
z_stream strm;
unsigned char in[CHUNK];
unsigned char out[CHUNK];
/* allocate inflate state */
strm.zalloc = Z_NULL;
strm.zfree = Z_NULL;
strm.opaque = Z_NULL;
strm.avail_in = 0;
strm.next_in = Z_NULL;
ret = inflateInit(&strm);
if (ret != Z_OK)
return ret;
/* decompress until deflate stream ends or end of file */
do {
strm.avail_in = fread(in, 1, CHUNK, source);
if (ferror(source)) {
(void)inflateEnd(&strm);
return Z_ERRNO;
}
if (strm.avail_in == 0)
break;
strm.next_in = in;
/* run inflate() on input until output buffer not full */
do {
strm.avail_out = CHUNK;
strm.next_out = out;
ret = inflate(&strm, Z_NO_FLUSH);
assert(ret != Z_STREAM_ERROR); /* state not clobbered */
switch (ret) {
case Z_NEED_DICT:
ret = Z_DATA_ERROR; /* and fall through */
case Z_DATA_ERROR:
case Z_MEM_ERROR:
(void)inflateEnd(&strm);
return ret;
}
have = CHUNK - strm.avail_out;
if (fwrite(out, 1, have, dest) != have || ferror(dest)) {
(void)inflateEnd(&strm);
return Z_ERRNO;
}
} while (strm.avail_out == 0);
/* done when inflate() says it's done */
} while (ret != Z_STREAM_END);
/* clean up and return */
(void)inflateEnd(&strm);
return ret == Z_STREAM_END ? Z_OK : Z_DATA_ERROR;
}
/* report a zlib or i/o error */
void zerr(int ret)
{
fputs("zpipe: ", stderr);
switch (ret) {
case Z_ERRNO:
if (ferror(stdin))
fputs("error reading stdin\n", stderr);
if (ferror(stdout))
fputs("error writing stdout\n", stderr);
break;
case Z_STREAM_ERROR:
fputs("invalid compression level\n", stderr);
break;
case Z_DATA_ERROR:
fputs("invalid or incomplete deflate data\n", stderr);
break;
case Z_MEM_ERROR:
fputs("out of memory\n", stderr);
break;
case Z_VERSION_ERROR:
fputs("zlib version mismatch!\n", stderr);
}
}
/* compress or decompress from stdin to stdout */
int main(int argc, char **argv)
{
int ret;
/* avoid end-of-line conversions */
SET_BINARY_MODE(stdin);
SET_BINARY_MODE(stdout);
/* do compression if no arguments */
/* Warning: Not compatible with plain libz, dial it back down to
* 9 if this is required, uber-level is 10
* since we have everything crammed in miniz, we don't depend on
* libz at all.
*/
if (argc == 1) {
ret = def(stdin, stdout, MZ_UBER_COMPRESSION);
if (ret != Z_OK)
zerr(ret);
return ret;
}
/* do decompression if -d specified */
else if (argc == 2 && strcmp(argv[1], "-d") == 0) {
ret = inf(stdin, stdout);
if (ret != Z_OK)
zerr(ret);
return ret;
}
/* otherwise, report usage */
else {
fputs("zpipe usage: zpipe [-d] < source > dest\n", stderr);
return 1;
}
}

@ -865,9 +865,16 @@ namespace llarp
auto* mask = (sockaddr_in*)i->ifa_netmask;
nuint32_t ifaddr{addr->sin_addr.s_addr};
nuint32_t ifmask{mask->sin_addr.s_addr};
currentRanges.emplace_back(
IPRange{net::IPPacket::ExpandV4(xntohl(ifaddr)),
net::IPPacket::ExpandV4(xntohl(ifmask))});
#ifdef _WIN32
// do not delete, otherwise GCC will do horrible things to this lambda
LogDebug("found ", ifaddr, " with mask ", ifmask);
#endif
if(addr->sin_addr.s_addr)
// skip unconfig'd adapters (windows passes these through the unix-y
// wrapper)
currentRanges.emplace_back(
IPRange{net::IPPacket::ExpandV4(xntohl(ifaddr)),
net::IPPacket::ExpandV4(xntohl(ifmask))});
}
});
// try 10.x.0.0/16

@ -81,18 +81,18 @@ BEGIN
VALUE "CompanyName", "Loki Foundation"
VALUE "FileDescription", "LokiNET for Microsoft® Windows® NT™"
#ifdef LLARP_RELEASE_MOTTO
VALUE "FileVersion", VERSION_STRING(0.5.1, RELEASE_MOTTO, GIT_REV)
VALUE "FileVersion", VERSION_STRING(0.5.2, RELEASE_MOTTO, GIT_REV)
#else
VALUE "FileVersion", VERSION_STRING(0.5.1-dev-, GIT_REV)
VALUE "FileVersion", VERSION_STRING(0.5.2-dev-, GIT_REV)
#endif
VALUE "InternalName", "llarpd"
VALUE "LegalCopyright", "Copyright ©2018-2019 Jeff Becker, Rick V for the Loki Foundation. All rights reserved. This software is provided under the terms of the zlib-libpng licence; see the file LICENSE for details."
VALUE "OriginalFilename", "abyss-main.exe"
VALUE "ProductName", "LokiNET for Windows"
#ifdef LLARP_RELEASE_MOTTO
VALUE "ProductVersion", VERSION_STRING(0.5.1, RELEASE_MOTTO, GIT_REV)
VALUE "ProductVersion", VERSION_STRING(0.5.2, RELEASE_MOTTO, GIT_REV)
#else
VALUE "ProductVersion", VERSION_STRING(0.5.1-dev-, GIT_REV)
VALUE "ProductVersion", VERSION_STRING(0.5.2-dev-, GIT_REV)
#endif
END
END

@ -81,18 +81,18 @@ BEGIN
VALUE "CompanyName", "Loki Foundation"
VALUE "FileDescription", "LokiNET daemon for Microsoft® Windows® NT™"
#ifdef LLARP_RELEASE_MOTTO
VALUE "FileVersion", VERSION_STRING(0.5.0, RELEASE_MOTTO, GIT_REV)
VALUE "FileVersion", VERSION_STRING(0.5.2, RELEASE_MOTTO, GIT_REV)
#else
VALUE "FileVersion", VERSION_STRING(0.5.0-dev-, GIT_REV)
VALUE "FileVersion", VERSION_STRING(0.5.2-dev-, GIT_REV)
#endif
VALUE "InternalName", "llarpd"
VALUE "LegalCopyright", "Copyright ©2018-2019 Jeff Becker, Rick V for the Loki Foundation. All rights reserved. This software is provided under the terms of the zlib-libpng licence; see the file LICENSE for details."
VALUE "OriginalFilename", "llarpd.exe"
VALUE "ProductName", "LokiNET for Windows"
#ifdef LLARP_RELEASE_MOTTO
VALUE "ProductVersion", VERSION_STRING(0.5.0, RELEASE_MOTTO, GIT_REV)
VALUE "ProductVersion", VERSION_STRING(0.5.2, RELEASE_MOTTO, GIT_REV)
#else
VALUE "ProductVersion", VERSION_STRING(0.5.0-dev-, GIT_REV)
VALUE "ProductVersion", VERSION_STRING(0.5.2-dev-, GIT_REV)
#endif
END
END

Binary file not shown.

Binary file not shown.

@ -81,12 +81,12 @@ BEGIN
VALUE "CompanyName", "Loki Foundation"
VALUE "FileDescription", "LokiNET for Microsoft® Windows® NT™"
#ifdef LLARP_RELEASE_MOTTO
VALUE "FileVersion", VERSION_STRING(0.5.0, RELEASE_MOTTO, GIT_REV)
VALUE "FileVersion", VERSION_STRING(0.5.2, RELEASE_MOTTO, GIT_REV)
#else
#ifdef __GNUC__
VALUE "FileVersion", VERSION_STRING(0.5.0-dev-, GIT_REV)
VALUE "FileVersion", VERSION_STRING(0.5.2-dev-, GIT_REV)
#else
VALUE "FileVersion", "0.5.0-dev"
VALUE "FileVersion", "0.5.2-dev"
#endif
#endif
VALUE "InternalName", "llarpd"
@ -94,12 +94,12 @@ BEGIN
VALUE "OriginalFilename", "llarpd.exe"
VALUE "ProductName", "LokiNET for Windows"
#ifdef LLARP_RELEASE_MOTTO
VALUE "ProductVersion", VERSION_STRING(0.5.0, RELEASE_MOTTO, GIT_REV)
VALUE "ProductVersion", VERSION_STRING(0.5.2, RELEASE_MOTTO, GIT_REV)
#else
#ifdef __GNUC__
VALUE "ProductVersion", VERSION_STRING(0.5.0-dev-, GIT_REV)
VALUE "ProductVersion", VERSION_STRING(0.5.2-dev-, GIT_REV)
#else
VALUE "ProductVersion", "0.5.0-dev"
VALUE "ProductVersion", "0.5.2-dev"
#endif
#endif
END

@ -37,10 +37,10 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.5.0")]
[assembly: AssemblyFileVersion("0.5.0")]
[assembly: AssemblyVersion("0.5.2")]
[assembly: AssemblyFileVersion("0.5.2")]
#if DEBUG
[assembly: AssemblyInformationalVersion("0.5.0-dev-{chash:8}")]
[assembly: AssemblyInformationalVersion("0.5.2-dev-{chash:8}")]
#else
[assembly: AssemblyInformationalVersion("0.5.0 (RELEASE_CODENAME)")]
[assembly: AssemblyInformationalVersion("0.5.2 (RELEASE_CODENAME)")]
#endif

@ -1,5 +1,5 @@
using System;
using System.Diagnostics;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;
@ -58,54 +58,54 @@ namespace network.loki.lokinet.win32.ui
VisualSettings v = new VisualSettings();
v.ShowDialog();
v.Dispose();
}
private void BtnEditCfg_Click(object sender, EventArgs e)
{
try {
Process.Start(string.Format("{0}/lokinet.ini", config_path)); }
catch
{
MessageBox.Show("No existing config found");
BtnNewCfg_Click(sender, e);
}
}
private void BtnNewCfg_Click(object sender, EventArgs e)
{
if (File.Exists(string.Format("{0}/lokinet.ini", config_path)))
{
DialogResult resp = MessageBox.Show("WARNING: This will overwrite your existing config file, Continue?", "Lokinet", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
switch(resp)
{
case DialogResult.Yes:
File.Delete(string.Format("{0}/lokinet.ini", config_path));
break;
case DialogResult.No:
return;
}
}
string lokinetExeString;
if (Program.platform == PlatformID.Win32NT)
lokinetExeString = String.Format("{0}\\lokinet.exe", Directory.GetCurrentDirectory());
else
lokinetExeString = String.Format("{0}/lokinet", Directory.GetCurrentDirectory());
Process p = new Process();
p.StartInfo.FileName = lokinetExeString;
p.StartInfo.Arguments = "-g";
p.StartInfo.CreateNoWindow = true;
p.StartInfo.UseShellExecute = false;
p.EnableRaisingEvents = true;
p.Exited += new EventHandler(msg);
p.Start();
}
private void msg(object sender, EventArgs e)
{
MessageBox.Show(string.Format("Created new config file at {0}/lokinet.ini", config_path), "Success", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
}
private void BtnEditCfg_Click(object sender, EventArgs e)
{
try {
Process.Start(string.Format("{0}/lokinet.ini", config_path)); }
catch
{
MessageBox.Show("No existing config found");
BtnNewCfg_Click(sender, e);
}
}
private void BtnNewCfg_Click(object sender, EventArgs e)
{
if (File.Exists(string.Format("{0}/lokinet.ini", config_path)))
{
DialogResult resp = MessageBox.Show("WARNING: This will overwrite your existing config file, Continue?", "Lokinet", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
switch(resp)
{
case DialogResult.Yes:
File.Delete(string.Format("{0}/lokinet.ini", config_path));
break;
case DialogResult.No:
return;
}
}
string lokinetExeString;
if (Program.platform == PlatformID.Win32NT)
lokinetExeString = String.Format("{0}\\lokinet.exe", Directory.GetCurrentDirectory());
else
lokinetExeString = String.Format("{0}/lokinet", Directory.GetCurrentDirectory());
Process p = new Process();
p.StartInfo.FileName = lokinetExeString;
p.StartInfo.Arguments = "-g";
p.StartInfo.CreateNoWindow = true;
p.StartInfo.UseShellExecute = false;
p.EnableRaisingEvents = true;
p.Exited += new EventHandler(msg);
p.Start();
}
private void msg(object sender, EventArgs e)
{
MessageBox.Show(string.Format("Created new config file at {0}/lokinet.ini", config_path), "Success", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
}
}

@ -1,4 +1,6 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
@ -22,23 +24,45 @@ namespace network.loki.lokinet.win32.ui
private string default_path;
private void button1_Click(object sender, EventArgs e)
{
ServicePointManager.ServerCertificateValidationCallback += cert_check;
ServicePointManager.SecurityProtocol = (SecurityProtocolType)48 | 0 | (SecurityProtocolType)192 | (SecurityProtocolType)768 | (SecurityProtocolType)3072;
wc = new WebClient();
// add something more unique, this is the IE 5.0 default string
wc.Headers.Add("User-Agent","Mozilla/4.0 (compatible; MSIE 5.0; Windows NT 5.0)");
try
{
{
ServicePointManager.ServerCertificateValidationCallback += cert_check;
ServicePointManager.SecurityProtocol = (SecurityProtocolType)48 | 0 | (SecurityProtocolType)192 | (SecurityProtocolType)768 | (SecurityProtocolType)3072;
wc = new WebClient();
wc.Headers.Add("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT 5.0)");
wc.DownloadFile(uriBox.Text, default_path);
MessageBox.Show("LokiNET node bootstrapped", "LokiNET", MessageBoxButtons.OK, MessageBoxIcon.Information);
DialogResult = DialogResult.OK;
}
catch (Exception ex)
{
MessageBox.Show(string.Format("An error occured while downloading data. {0}", ex.Message), "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
DialogResult = DialogResult.Abort;
{
string lokinetExeString;
Process lokinet_bootstrap = new Process();
if (Program.platform == PlatformID.Win32NT)
lokinetExeString = String.Format("{0}\\lokinet-bootstrap.exe", Directory.GetCurrentDirectory());
else
lokinetExeString = String.Format("{0}/lokinet-bootstrap", Directory.GetCurrentDirectory());
lokinet_bootstrap.StartInfo.UseShellExecute = false;
lokinet_bootstrap.StartInfo.CreateNoWindow = true;
lokinet_bootstrap.StartInfo.WorkingDirectory = Directory.GetCurrentDirectory();
lokinet_bootstrap.StartInfo.FileName = lokinetExeString;
lokinet_bootstrap.StartInfo.Arguments = string.Format("--cacert rootcerts.pem -L {0} --output \"{1}\"", uriBox.Text, default_path);
lokinet_bootstrap.Start();
lokinet_bootstrap.WaitForExit();
if (lokinet_bootstrap.ExitCode == 0)
{
DialogResult = DialogResult.OK;
MessageBox.Show("LokiNET node bootstrapped", "LokiNET", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
MessageBox.Show(string.Format("An error occured while downloading data. {0}", ex.Message), "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
DialogResult = DialogResult.Abort;
}
}
wc.Dispose();
Close();
}

@ -0,0 +1,8 @@
mbedtls*.tgz*
mbedtls-*/
curl*.tar.xz*
curl-*/
include/
lib/
*.pem
LICENSE

Binary file not shown.

@ -0,0 +1,50 @@
# Makefile for windows install pkg and helper library
CC=i686-w64-mingw32-gcc
CXX=i686-w64-mingw32-g++
CFLAGS=-Ofast -march=nocona -mfpmath=sse
LIBS=-lws2_32
LDFLAGS=-static
ifndef RELEASE
all: regdbhelper.dll lokinet-bootstrap.exe
default: all
regdbhelper.dll:
i686-w64-mingw32-gcc regdb_helper.c -o $@ -shared -Os -s
mbedtls:
wget https://tls.mbed.org/download/mbedtls-2.16.3-apache.tgz
tar xvf mbedtls-2.16.3-apache.tgz
patch -p0 -d mbedtls-2.16.3 < mbedtls-win32.patch
$(MAKE) -j4 -C mbedtls-2.16.3/library CC=$(CC) CXX=$(CXX) CFLAGS="$(CFLAGS)" LDFLAGS=$(LIBS)
mkdir -p lib; mkdir -p include
cp mbedtls-2.16.3/library/*.a lib
cp -r mbedtls-2.16.3/include/mbedtls include
curl:
wget https://curl.haxx.se/download/curl-7.66.0.tar.xz
tar xvf curl-7.66.0.tar.xz
patch -p1 < curl-win32.patch
cd curl-7.66.0; ./configure --host=i686-w64-mingw32 --target=i686-w64-mingw32 CC=$(CC) CXX=$(CXX) CFLAGS="$(CFLAGS)" LIBS=$(LIBS) --disable-shared --without-zlib --without-ssl --with-mbedtls=$(PWD) --enable-optimize --enable-http --disable-ftp --disable-file --disable-ldap --disable-ldaps --disable-rtsp --enable-proxy --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --enable-manual
$(MAKE) -j4 -C curl-7.66.0
lokinet-bootstrap.exe: mbedtls curl
cp curl-7.66.0/src/curl.exe $@
wget -O rootcerts.pem https://curl.haxx.se/ca/cacert.pem
cp ../LICENSE .;unix2dos LICENSE LICENSE
else
all: regdbhelper.dll lokinet-bootstrap.exe
regdbhelper.dll:
scp despair@10.10.10.6:loki-network/win32-setup/*.dll .
lokinet-bootstrap.exe:
scp despair@10.10.10.6:loki-network/win32-setup/*.exe .
wget -O rootcerts.pem https://curl.haxx.se/ca/cacert.pem
cp ../LICENSE .;unix2dos LICENSE LICENSE
endif
clean:
-rm -rf curl-7* include lib mbedtls-2* *.exe *.dll *.pem

@ -0,0 +1,82 @@
diff --git a/curl-7.66.0/include/curl/curl.h b/curl-patched/include/curl/curl.h
index ff0c7749..4d3fdbb5 100644
--- a/curl-7.66.0/include/curl/curl.h
+++ b/curl-patched/include/curl/curl.h
@@ -65,6 +65,7 @@
included, since they can't co-exist without problems */
#include <winsock2.h>
#include <ws2tcpip.h>
+#include <wspiapi.h>
#endif
#endif
diff --git a/curl-7.66.0/include/curl/system.h b/curl-patched/include/curl/system.h
index cd37c2bf..b96cfd8c 100644
--- a/curl-7.66.0/include/curl/system.h
+++ b/curl-patched/include/curl/system.h
@@ -411,6 +411,7 @@
# include <winsock2.h>
# include <windows.h>
# include <ws2tcpip.h>
+# include <wspiapi.h>
#endif
/* CURL_PULL_SYS_TYPES_H is defined above when inclusion of header file */
diff --git a/curl-7.66.0/lib/curl_setup.h b/curl-patched/lib/curl_setup.h
index 13af8cde..a0408d5c 100644
--- a/curl-7.66.0/lib/curl_setup.h
+++ b/curl-patched/lib/curl_setup.h
@@ -255,6 +255,7 @@
# include <winsock2.h>
# ifdef HAVE_WS2TCPIP_H
# include <ws2tcpip.h>
+# include <wspiapi.h>
# endif
# else
# ifdef HAVE_WINSOCK_H
diff --git a/curl-7.66.0/lib/inet_pton.h b/curl-patched/lib/inet_pton.h
index 0209b9b7..67774fb9 100644
--- a/curl-7.66.0/lib/inet_pton.h
+++ b/curl-patched/lib/inet_pton.h
@@ -32,6 +32,7 @@ int Curl_inet_pton(int, const char *, void *);
#elif defined(HAVE_WS2TCPIP_H)
/* inet_pton() exists in Vista or later */
#include <ws2tcpip.h>
+#include <wspiapi.h>
#endif
#define Curl_inet_pton(x,y,z) inet_pton(x,y,z)
#endif
diff --git a/curl-7.66.0/src/tool_util.c b/curl-patched/src/tool_util.c
index 9990a463..8ea37f37 100644
--- a/curl-7.66.0/src/tool_util.c
+++ b/curl-patched/src/tool_util.c
@@ -40,12 +40,7 @@ struct timeval tvnow(void)
** is typically in the range of 10 milliseconds to 16 milliseconds.
*/
struct timeval now;
-#if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0600) && \
- (!defined(__MINGW32__) || defined(__MINGW64_VERSION_MAJOR))
- ULONGLONG milliseconds = GetTickCount64();
-#else
DWORD milliseconds = GetTickCount();
-#endif
now.tv_sec = (long)(milliseconds / 1000);
now.tv_usec = (long)((milliseconds % 1000) * 1000);
return now;
diff --git a/curl-7.66.0/tests/server/util.c b/curl-patched/tests/server/util.c
index b0613380..00d0b0c3 100644
--- a/curl-7.66.0/tests/server/util.c
+++ b/curl-patched/tests/server/util.c
@@ -415,12 +415,7 @@ static struct timeval tvnow(void)
** is typically in the range of 10 milliseconds to 16 milliseconds.
*/
struct timeval now;
-#if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0600) && \
- (!defined(__MINGW32__) || defined(__MINGW64_VERSION_MAJOR))
- ULONGLONG milliseconds = GetTickCount64();
-#else
DWORD milliseconds = GetTickCount();
-#endif
now.tv_sec = (long)(milliseconds / 1000);
now.tv_usec = (long)((milliseconds % 1000) * 1000);
return now;

Binary file not shown.

Binary file not shown.

@ -1,10 +1,10 @@
; Script generated by the Inno Script Studio Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "loki-network"
#define MyAppVersion "0.5.0"
#define MyAppName "Lokinet"
#define MyAppVersion "0.5.2"
#define MyAppPublisher "Loki Project"
#define MyAppURL "https://loki.network"
#define MyAppURL "https://lokinet.org"
#define MyAppExeName "lokinetui.exe"
; change this to avoid compiler errors -despair
#ifndef DevPath
@ -37,20 +37,20 @@ AllowNoIcons=yes
LicenseFile={#DevPath}LICENSE
OutputDir={#DevPath}win32-setup
OutputBaseFilename=lokinet-win32
Compression=lzma
Compression=lzma2/ultra64
SolidCompression=yes
VersionInfoVersion=0.5.0
VersionInfoVersion=0.5.2
VersionInfoCompany=Loki Project
VersionInfoDescription=LokiNET for Microsoft® Windows® NT™
#ifndef RELEASE
VersionInfoTextVersion=0.5.0-dev-{#VCSRev}
VersionInfoProductTextVersion=0.5.0-dev-{#VCSRev}
VersionInfoTextVersion=0.5.2-dev-{#VCSRev}
VersionInfoProductTextVersion=0.5.2-dev-{#VCSRev}
#else
VersionInfoTextVersion=0.5.0
VersionInfoProductTextVersion=0.5.0 ({#Codename})
VersionInfoTextVersion=0.5.2
VersionInfoProductTextVersion=0.5.2 ({#Codename})
#endif
VersionInfoProductName=LokiNET
VersionInfoProductVersion=0.5.0
VersionInfoProductVersion=0.5.2
InternalCompressLevel=ultra64
MinVersion=0,5.0
ArchitecturesInstallIn64BitMode=x64
@ -68,14 +68,14 @@ Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescrip
#ifdef SINGLE_ARCH
Source: "{#DevPath}build\lokinet.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#DevPath}build\liblokinet-shared.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "dbghelp64.dll"; DestName: "dbghelp.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{tmp}\dbghelp64.dll"; DestName: "dbghelp.dll"; DestDir: "{app}"; Flags: ignoreversion external
#else
Source: "{#DevPath}build\lokinet.exe"; DestDir: "{app}"; Flags: ignoreversion 32bit; Check: not IsWin64
Source: "{#DevPath}build\liblokinet-shared.dll"; DestDir: "{app}"; Flags: ignoreversion 32bit; Check: not IsWin64
Source: "dbghelp32.dll"; DestName: "dbghelp.dll"; DestDir: "{app}"; Flags: ignoreversion; Check: not IsWin64
Source: "{tmp}\dbghelp32.dll"; DestName: "dbghelp.dll"; DestDir: "{app}"; Flags: ignoreversion external; Check: not IsWin64
Source: "{#DevPath}build64\lokinet.exe"; DestDir: "{app}"; Flags: ignoreversion 64bit; Check: IsWin64
Source: "{#DevPath}build64\liblokinet-shared.dll"; DestDir: "{app}"; Flags: ignoreversion 64bit; Check: IsWin64
Source: "dbghelp64.dll"; DestDir: "{app}"; DestName: "dbghelp.dll"; Flags: ignoreversion; Check: IsWin64
Source: "{tmp}\dbghelp64.dll"; DestDir: "{app}"; DestName: "dbghelp.dll"; Flags: ignoreversion external; Check: IsWin64
#endif
; UI has landed!
#ifndef RELEASE
@ -90,11 +90,12 @@ Source: "{#DevPath}ui-win32\bin\release\lokinetui.pdb"; DestDir: "{app}"; Flags:
; eh, might as well ship the 32-bit port of everything else
Source: "{#DevPath}build\testAll.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#DevPath}build\lokinet-rcutil.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#DevPath}LICENSE"; DestDir: "{app}"; Flags: ignoreversion
Source: "LICENSE"; DestDir: "{app}"; Flags: ignoreversion
Source: "lokinet-bootstrap.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "rootcerts.pem"; DestDir: "{app}"; Flags: ignoreversion
; delet this after finishing setup, we only need it to extract the drivers
; and download an initial RC. The UI has its own bootstrap built-in!
Source: "{#DevPath}lokinet-bootstrap.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall
Source: "{#DevPath}win32-setup\7z.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall
Source: "{tmp}\7z.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall external
; if nonexistent, then inet6 was already installed
Source: "{tmp}\inet6.7z"; DestDir: "{app}"; Flags: ignoreversion external deleteafterinstall skipifsourcedoesntexist; MinVersion: 0,5.0; OnlyBelowVersion: 0,5.1
; Copy the correct tuntap driver for the selected platform
@ -103,6 +104,10 @@ Source: "{tmp}\tuntapv9_n6.7z"; DestDir: "{app}"; Flags: ignoreversion external
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
Source: "regdbhelper.dll"; Flags: dontcopy
; build only if we have the 32-bit bins as well
; (i.e. *not* a Travis CI build, travis isn't expected to have these around)
#ifndef SINGLE_ARCH
Source: "C:\Windows\Fonts\iosevka-term-bold.ttf"; DestDir: "{fonts}"; FontInstall: "Iosevka Term Bold"; Flags: onlyifdoesntexist uninsneveruninstall
Source: "C:\Windows\Fonts\iosevka-term-bolditalic.ttf"; DestDir: "{fonts}"; FontInstall: "Iosevka Term Bold Italic"; Flags: onlyifdoesntexist uninsneveruninstall
Source: "C:\Windows\Fonts\iosevka-term-boldoblique.ttf"; DestDir: "{fonts}"; FontInstall: "Iosevka Term Bold Oblique"; Flags: onlyifdoesntexist uninsneveruninstall
@ -124,6 +129,7 @@ Source: "C:\Windows\Fonts\iosevka-term-regular.ttf"; DestDir: "{fonts}"; FontIns
Source: "C:\Windows\Fonts\iosevka-term-thin.ttf"; DestDir: "{fonts}"; FontInstall: "Iosevka Term Thin"; Flags: onlyifdoesntexist uninsneveruninstall
Source: "C:\Windows\Fonts\iosevka-term-thinitalic.ttf"; DestDir: "{fonts}"; FontInstall: "Iosevka Term Thin Italic"; Flags: onlyifdoesntexist uninsneveruninstall
Source: "C:\Windows\Fonts\iosevka-term-thinoblique.ttf"; DestDir: "{fonts}"; FontInstall: "Iosevka Term Thin Oblique"; Flags: onlyifdoesntexist uninsneveruninstall
#endif
[UninstallDelete]
Type: filesandordirs; Name: "{app}\tap-windows*"
@ -192,15 +198,18 @@ begin
begin
// current versions of windows :-)
// (Arguably, one could pull this from any of the forks.)
idpAddFile('https://github.com/despair86/loki-network/raw/master/contrib/tuntapv9-ndis/tap-windows-9.21.2.7z', ExpandConstant('{tmp}\tuntapv9_n6.7z'));
idpAddFile('https://snowlight.net/loki/win32-dist/tap-windows-9.21.2.7z', ExpandConstant('{tmp}\tuntapv9_n6.7z'));
end;
// Windows 2000 only, we need to install inet6 separately
if (FileExists(ExpandConstant('{sys}\drivers\tcpip6.sys')) = false) and (Version.Major = 5) and (Version.Minor = 0) then
begin
idpAddFile('http://www.rvx86.net/files/inet6.7z', ExpandConstant('{tmp}\inet6.7z'));
end;
idpDownloadAfter(wpReady);
end;
idpAddFile('http://www.rvx86.net/files/7z.exe', ExpandConstant('{tmp}\7z.exe'));
idpAddFile('http://www.rvx86.net/files/dbghelp32.dll', ExpandConstant('{tmp}\dbghelp32.dll'));
idpAddFile('http://www.rvx86.net/files/dbghelp64.dll', ExpandConstant('{tmp}\dbghelp64.dll'));
idpDownloadAfter(wpReady);
end;
[Icons]
@ -217,7 +226,7 @@ Filename: "{app}\{#MyAppExeName}"; Flags: nowait postinstall skipifsilent; Descr
Filename: "{tmp}\7z.exe"; Parameters: "x tuntapv9.7z"; WorkingDir: "{app}"; Flags: runascurrentuser waituntilterminated skipifdoesntexist; Description: "extract TUN/TAP-v9 driver"; StatusMsg: "Extracting driver..."; OnlyBelowVersion: 0, 6.0
Filename: "{tmp}\7z.exe"; Parameters: "x tuntapv9_n6.7z"; WorkingDir: "{app}"; Flags: runascurrentuser waituntilterminated skipifdoesntexist; Description: "extract TUN/TAP-v9 driver"; StatusMsg: "Extracting driver..."; MinVersion: 0, 6.0
Filename: "{tmp}\7z.exe"; Parameters: "x inet6.7z"; WorkingDir: "{app}"; Flags: skipifdoesntexist runascurrentuser waituntilterminated skipifdoesntexist; Description: "extract inet6 driver"; StatusMsg: "Extracting IPv6 driver..."; MinVersion: 0, 5.0; OnlyBelowVersion: 0, 5.1
Filename: "{tmp}\lokinet-bootstrap.exe"; Parameters:"https://seed.lokinet.org/bootstrap.signed {userappdata}\.lokinet\bootstrap.signed"; WorkingDir: "{app}"; Flags: runascurrentuser waituntilterminated; Description: "bootstrap dht"; StatusMsg: "Downloading initial RC..."
Filename: "{app}\lokinet-bootstrap.exe"; Parameters:"-L https://seed.lokinet.org/bootstrap.signed --cacert rootcerts.pem -o ""{userappdata}\.lokinet\bootstrap.signed"""; WorkingDir: "{app}"; Flags: runascurrentuser waituntilterminated; Description: "bootstrap dht"; StatusMsg: "Downloading initial RC..."
; then ask to install drivers
Filename: "{app}\tap-windows-9.9.2\install.bat"; WorkingDir: "{app}\tap-windows-9.9.2\"; Flags: runascurrentuser waituntilterminated skipifdoesntexist; Description: "Install TUN/TAP-v9 driver"; StatusMsg: "Installing driver..."; OnlyBelowVersion: 0, 6.0; Check: not IsTapInstalled
Filename: "{app}\tap-windows-9.21.2\install.bat"; WorkingDir: "{app}\tap-windows-9.21.2\"; Flags: runascurrentuser waituntilterminated skipifdoesntexist; Description: "Install TUN/TAP-v9 driver"; StatusMsg: "Installing driver..."; MinVersion: 0, 6.0; Check: not IsTapInstalled

@ -1,6 +1,6 @@
diff -ruN polarssl-master/include/mbedtls/aesni.h polarssl/include/mbedtls/aesni.h
--- polarssl-master/include/mbedtls/aesni.h 2018-03-16 11:25:12.000000000 -0500
+++ polarssl/include/mbedtls/aesni.h 2018-04-17 15:47:59.320514100 -0500
diff -ruN include/mbedtls/aesni.h include/mbedtls/aesni.h
--- include/mbedtls/aesni.h 2018-03-16 11:25:12.000000000 -0500
+++ include/mbedtls/aesni.h 2018-04-17 15:47:59.320514100 -0500
@@ -26,17 +26,16 @@
#include "aes.h"
@ -33,9 +33,9 @@ diff -ruN polarssl-master/include/mbedtls/aesni.h polarssl/include/mbedtls/aesni
-#endif /* MBEDTLS_HAVE_X86_64 */
-
#endif /* MBEDTLS_AESNI_H */
diff -ruN polarssl-master/include/mbedtls/bn_mul.h polarssl/include/mbedtls/bn_mul.h
--- polarssl-master/include/mbedtls/bn_mul.h 2018-03-16 11:25:12.000000000 -0500
+++ polarssl/include/mbedtls/bn_mul.h 2018-04-17 15:42:09.045117300 -0500
diff -ruN include/mbedtls/bn_mul.h include/mbedtls/bn_mul.h
--- include/mbedtls/bn_mul.h 2018-03-16 11:25:12.000000000 -0500
+++ include/mbedtls/bn_mul.h 2018-04-17 15:42:09.045117300 -0500
@@ -754,7 +754,9 @@
#if defined(MBEDTLS_HAVE_SSE2)
@ -47,9 +47,9 @@ diff -ruN polarssl-master/include/mbedtls/bn_mul.h polarssl/include/mbedtls/bn_m
#define MULADDC_HUIT \
EMIT 0x0F EMIT 0x6E EMIT 0xC9 \
EMIT 0x0F EMIT 0x6E EMIT 0xC3 \
diff -ruN polarssl-master/include/mbedtls/config.h polarssl/include/mbedtls/config.h
--- polarssl-master/include/mbedtls/config.h 2018-03-16 11:25:12.000000000 -0500
+++ polarssl/include/mbedtls/config.h 2018-04-17 17:27:18.350938700 -0500
diff -ruN include/mbedtls/config.h include/mbedtls/config.h
--- include/mbedtls/config.h 2018-03-16 11:25:12.000000000 -0500
+++ include/mbedtls/config.h 2018-04-17 17:27:18.350938700 -0500
@@ -91,7 +91,7 @@
*
* Uncomment if the CPU supports SSE2 (IA-32 specific).
@ -86,9 +86,9 @@ diff -ruN polarssl-master/include/mbedtls/config.h polarssl/include/mbedtls/conf
/**
* \def MBEDTLS_HMAC_DRBG_C
diff -ruN polarssl-master/library/aes.c polarssl/library/aes.c
--- polarssl-master/library/aes.c 2018-03-16 11:25:12.000000000 -0500
+++ polarssl/library/aes.c 2018-04-17 16:51:37.098413400 -0500
diff -ruN library/aes.c library/aes.c
--- library/aes.c 2018-03-16 11:25:12.000000000 -0500
+++ library/aes.c 2018-04-17 16:51:37.098413400 -0500
@@ -514,7 +514,7 @@
#endif
ctx->rk = RK = ctx->buf;
@ -107,18 +107,18 @@ diff -ruN polarssl-master/library/aes.c polarssl/library/aes.c
if( mbedtls_aesni_has_support( MBEDTLS_AESNI_AES ) )
{
mbedtls_aesni_inverse_key( (unsigned char *) ctx->rk,
@@ -850,7 +850,7 @@
const unsigned char input[16],
unsigned char output[16] )
{
@@ -1016,7 +1016,7 @@
AES_VALIDATE_RET( mode == MBEDTLS_AES_ENCRYPT ||
mode == MBEDTLS_AES_DECRYPT );
-#if defined(MBEDTLS_AESNI_C) && defined(MBEDTLS_HAVE_X86_64)
+#if defined(MBEDTLS_AESNI_C)
if( mbedtls_aesni_has_support( MBEDTLS_AESNI_AES ) )
return( mbedtls_aesni_crypt_ecb( ctx, mode, input, output ) );
#endif
diff -ruN polarssl-master/library/aesni.c polarssl/library/aesni.c
--- polarssl-master/library/aesni.c 2018-03-16 11:25:12.000000000 -0500
+++ polarssl/library/aesni.c 2018-04-17 16:09:26.050605000 -0500
diff -ruN library/aesni.c library/aesni.c
--- library/aesni.c 2018-03-16 11:25:12.000000000 -0500
+++ library/aesni.c 2018-04-17 16:09:26.050605000 -0500
@@ -30,7 +30,16 @@
#include MBEDTLS_CONFIG_FILE
#endif
@ -153,9 +153,9 @@ diff -ruN polarssl-master/library/aesni.c polarssl/library/aesni.c
-#endif /* MBEDTLS_HAVE_X86_64 */
-
#endif /* MBEDTLS_AESNI_C */
diff -ruN polarssl-master/library/entropy_poll.c polarssl/library/entropy_poll.c
--- polarssl-master/library/entropy_poll.c 2018-03-16 11:25:12.000000000 -0500
+++ polarssl/library/entropy_poll.c 2018-04-17 15:52:13.013004200 -0500
diff -ruN library/entropy_poll.c library/entropy_poll.c
--- library/entropy_poll.c 2018-03-16 11:25:12.000000000 -0500
+++ library/entropy_poll.c 2018-04-17 15:52:13.013004200 -0500
@@ -56,6 +56,12 @@
#include <windows.h>
#include <wincrypt.h>
@ -169,9 +169,9 @@ diff -ruN polarssl-master/library/entropy_poll.c polarssl/library/entropy_poll.c
int mbedtls_platform_entropy_poll( void *data, unsigned char *output, size_t len,
size_t *olen )
{
diff -ruN polarssl-master/library/gcm.c polarssl/library/gcm.c
--- polarssl-master/library/gcm.c 2018-03-16 11:25:12.000000000 -0500
+++ polarssl/library/gcm.c 2018-04-17 16:53:18.630262400 -0500
diff -ruN library/gcm.c library/gcm.c
--- library/gcm.c 2018-03-16 11:25:12.000000000 -0500
+++ library/gcm.c 2018-04-17 16:53:18.630262400 -0500
@@ -126,7 +126,7 @@
ctx->HL[8] = vl;
ctx->HH[8] = vh;
@ -190,9 +190,9 @@ diff -ruN polarssl-master/library/gcm.c polarssl/library/gcm.c
if( mbedtls_aesni_has_support( MBEDTLS_AESNI_CLMUL ) ) {
unsigned char h[16];
diff -ruN polarssl-master/library/net_sockets.c polarssl/library/net_sockets.c
--- polarssl-master/library/net_sockets.c 2018-03-16 11:25:12.000000000 -0500
+++ polarssl/library/net_sockets.c 2018-04-17 15:50:08.118440600 -0500
diff -ruN library/net_sockets.c library/net_sockets.c
--- library/net_sockets.c 2018-03-16 11:25:12.000000000 -0500
+++ library/net_sockets.c 2018-04-17 15:50:08.118440600 -0500
@@ -51,7 +51,8 @@
/* Enables getaddrinfo() & Co */
#define _WIN32_WINNT 0x0501

Binary file not shown.
Loading…
Cancel
Save