Martin Willi
7659f67af3
windows: Provide POSIX supplement errno values missing in MinGW
...
MinGW headers do not define these values, but Windows system headers do.
Windows defines them for POSIX compatibility, we do the same locally.
2014-06-04 15:53:12 +02:00
Martin Willi
2162e50004
windows: Provide shutdown(2) operation aliases mapping to those on Windows
2014-06-04 15:53:12 +02:00
Martin Willi
c079c098c4
x509: Check return value when signing attribute certificates
...
In addition that this lets AC generation fail properly if private key signing
fails, it also fixes an issue when compiling on Windows with MinGW 4.8.1, where
for some reason the attributeCertificateInfo got encoded incorrectly.
2014-06-04 15:53:12 +02:00
Martin Willi
0c34c1b3af
unit-tests: Support testable functions on Windows, avoid weak GCC symbols
...
Instead of using weak symbols, we use dlsym() on Windows to find an arbitrary
symbol in libtest to detect its linkage. Instead of creating the associated
hashtable in the test runner, we maintain it in libstrongswan, making it
significantly simpler.
2014-06-04 15:53:12 +02:00
Martin Willi
460adb5d09
unit-tests: Seed chunk_hash() only once, but before creating any hashtables
...
Due to the removal of pthread_once, we manually create the seed for
chunk_hash(). With the new testable functions interface, this won't work for
the hashtable initiated using __attribute__((constructor)). Enforce seeding
before creating that hashtable.
2014-06-04 15:53:11 +02:00
Martin Willi
d34d800c6c
openssl: Don't re-enter FIPS mode if we are already using it
...
If FIPS mode has been enabled by other means, under some environments it can't
be entered again. It fails with "FIPS mode already set". To avoid it, we first
check the mode before changing it.
2014-06-04 15:53:11 +02:00
Martin Willi
549502bcb2
unit-tests: Force a CET/CEST timezone Windows understands
...
As it is currently unclear what the "three-letter-timezone" for CEST is, we
use the German timezone, which actually is CET/CEST. SetEnvironmentVariable()
"TZ" does not seem to affect localtime(), so we use _putenv() instead.
2014-06-04 15:53:11 +02:00
Martin Willi
66c0801dc7
utils: Add a wait_sigint() function to wait for SIGINT or equivalent
2014-06-04 15:53:11 +02:00
Martin Willi
1309cb7b1a
chunk: On Windows, use binary mode in chunk_write()
2014-06-04 15:53:10 +02:00
Martin Willi
93168c5f1d
openssl: Be less verbose about FIPS mode when not running as daemon
...
While this is valuable information, printing it for pki and other tools is
annoying.
2014-06-04 15:53:09 +02:00
Martin Willi
74e14ea547
unit-tests: Adapt settings tests for Windows
2014-06-04 15:53:09 +02:00
Martin Willi
bc9fd3735d
parser-helper: Detect absolute pathnames and concatenate paths on Windows
2014-06-04 15:53:09 +02:00
Martin Willi
67b3bcd13d
utils: Provide a path_absolute() function to check path for non-relativeness
...
The usually used trivial '/' check won't work on Windows platforms.
2014-06-04 15:53:09 +02:00
Martin Willi
2496eaffde
utils: Return plain drive letter as base/pathname for drive letters on Windows
2014-06-04 15:53:08 +02:00
Martin Willi
8182631bc3
utils: Support Windows path separators in path_basename/dirname
2014-06-04 15:53:08 +02:00
Martin Willi
a43f1e5631
utils: Define a platform directory separator character used in paths
2014-06-04 15:53:08 +02:00
Martin Willi
41bb8ba5d2
windows: Provide a getpass() implementation
2014-06-04 15:53:08 +02:00
Martin Willi
c5447bc2f5
chunk: On Windows, chunk_map() opens files in binary mode
2014-06-04 15:53:08 +02:00
Martin Willi
89e46c41f1
windows: Include for Vista instead of defining CondVar/SRWLock functions ourself
2014-06-04 15:53:05 +02:00
Martin Willi
8120b3c339
windows: Don't redeclare inet_ntop/pton if already defined
2014-06-04 15:53:05 +02:00
Martin Willi
1f3bf4175d
windows: Check for existence of error codes before defining them
2014-06-04 15:53:05 +02:00
Martin Willi
89c3ff6d2c
windows: Check for clock_gettime() function itself as well
...
CLOCK_THREAD_CPUTIME_ID seems to be defined sometimes even if clock_gettime() is
missing.
2014-06-04 15:53:05 +02:00
Martin Willi
3d50dd47ef
windows: Overload sleep() cancellable when it is defined in <unistd.h>
2014-06-04 15:53:04 +02:00
Martin Willi
9df2a04a93
sqlite: Avoid name clash when building on Windows
2014-06-04 15:53:04 +02:00
Martin Willi
8e1c0d15a9
mysql: Add Windows support
...
As the mysql_config script is not available for Windows, we use a hardcoded
library name and no additional CFLAGS. This builds fine against the binary
MySQL Connector/C distribution.
2014-06-04 15:53:04 +02:00
Martin Willi
efcf249aeb
windows: Provide a close(2) that can close both file handles and sockets
2014-06-04 15:53:04 +02:00
Martin Willi
740404d481
chunk: Fallback to recv() on Windows chunk_from_fd() when operating on socket
2014-06-04 15:53:04 +02:00
Martin Willi
9ff1716029
windows: Don't use function macros to overload send/recv() and friends
...
While the macro versions would not catch non-function invocations, we actually
have to use catch all to support the sender_t.send() function.
2014-06-04 15:53:03 +02:00
Martin Willi
06c33ebf6a
openssl: Fix includes to prevent <winsock2.h> to complain about include order
2014-06-04 15:53:03 +02:00
Martin Willi
4f310a2e75
openssl: Undef OpenSSLs X509_NAME defined by <wincrypt.h>
2014-06-04 15:53:02 +02:00
Martin Willi
b7a4d44bd0
openssl: Check and link against libeay32 instead of libcrypto on Windows
...
Most Windows OpenSSL builds come with the crypto library named libeay32.
2014-06-04 15:53:02 +02:00
Martin Willi
f3c809e615
windows: Provide a strndup(3) replacement
2014-06-04 15:53:02 +02:00
Martin Willi
8f3a3656d3
sha1: Include <library.h> instead of directly including <arpa/inet.h>
...
On Windows we don't have <arpa/inet.h>
2014-06-04 15:53:02 +02:00
Martin Willi
2dbb719b76
x509: Undef OCSP_RESPONSE from <wincrypt.h> before using it
2014-06-04 15:53:02 +02:00
Martin Willi
4163421f91
plugins: Don't link with -rdynamic on Windows
2014-06-04 15:53:02 +02:00
Martin Willi
110e42361e
unit-tests: Uninline dlopen() and friends, make more dynamic, fix dlerror()
...
As the error string contains a newline, we have to remove that before
returning the string.
2014-06-04 15:53:02 +02:00
Martin Willi
204098a752
thread-value: Immediately cleanup all Windows TLS values on destroy
2014-06-04 15:53:02 +02:00
Martin Willi
9dec601f30
windows: Prevent queueing of multiple thread cancel APCs
...
This avoids any races during cleanup invocation if multiple cancel() requests
come in.
2014-06-04 15:53:01 +02:00
Martin Willi
0fa9c95811
windows: Provide a complete native Windows threading backend
2014-06-04 15:53:01 +02:00
Martin Willi
a48570a046
windows: Provide a cancellable usleep(), but with ms resolution only
2014-06-04 15:53:01 +02:00
Martin Willi
986a577097
windows: Add a sleep function acting as cancellation point
2014-06-04 15:53:01 +02:00
Martin Willi
266ee0a190
windows: Provide a sched_yield() implementation
2014-06-04 15:53:01 +02:00
Martin Willi
4de7401a98
windows: Provide a time_monotonic() based on GetTickCount64()
2014-06-04 15:53:01 +02:00
Martin Willi
965e846cc3
library: Change init/deinit order to allow utils to depend on threading
2014-06-04 15:53:01 +02:00
Martin Willi
c46cee6f6d
chunk: Don't depend on pthread directly
2014-06-04 15:53:00 +02:00
Martin Willi
f1c9653e04
utils: Don't directly depend on pthread
2014-06-04 15:53:00 +02:00
Martin Willi
eb94f58595
strerror: Don't directly depend on pthread
2014-06-04 15:53:00 +02:00
Martin Willi
a506b922f3
windows: Provide a strdup variant safe when passing zero-length strings
2014-06-04 15:53:00 +02:00
Martin Willi
d8e56dfe32
unit-tests: Don't test Unix socket stream/services on Windows
2014-06-04 15:53:00 +02:00
Martin Willi
adaa9f3942
unit-tests: Use send/recv on socket in watcher tests
...
Windows does not support read/write on sockets.
2014-06-04 15:53:00 +02:00