mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-31 19:24:42 +02:00
46
configure.ac
46
configure.ac
@@ -2638,10 +2638,18 @@ fi
|
||||
LIB_SOCKET_NSL
|
||||
AX_HARDEN_CC_COMPILER_FLAGS
|
||||
|
||||
# link to ws2_32 if on mingw
|
||||
# if mingw then link to ws2_32 for sockets
|
||||
case $host_os in
|
||||
*mingw32)
|
||||
LDFLAGS="$LDFLAGS -lws2_32" ;;
|
||||
mingw*)
|
||||
LDFLAGS="$LDFLAGS -lws2_32"
|
||||
if test "$enable_shared" = "yes"
|
||||
then
|
||||
AC_DEFINE([WOLFSSL_DLL], [1], [Use __declspec(dllexport) when building library])
|
||||
if test "$enable_static" = "yes"
|
||||
then
|
||||
MINGW_LIB_WARNING="yes"
|
||||
fi
|
||||
fi ;;
|
||||
esac
|
||||
|
||||
# add user C_EXTRA_FLAGS back
|
||||
@@ -2717,7 +2725,7 @@ for option in $OPTION_FLAGS; do
|
||||
noequalsign=`echo $defonly | sed 's/=/ /'`
|
||||
if test "$noequalsign" = "NDEBUG" || test "$noequalsign" = "DEBUG"
|
||||
then
|
||||
echo "not outputing (N)DEBUG to $OPTION_FILE"
|
||||
echo "not outputting (N)DEBUG to $OPTION_FILE"
|
||||
continue
|
||||
fi
|
||||
|
||||
@@ -2767,8 +2775,16 @@ done < $OPTION_FILE
|
||||
|
||||
# switch ifdef protection in cyassl/option.h to CYASSL_OPTONS_H, remove bak
|
||||
sed -i.bak 's/WOLFSSL_OPTIONS_H/CYASSL_OPTIONS_H/g' cyassl/options.h
|
||||
|
||||
# workaround for mingw sed that may get "Permission denied" trying to preserver permissions
|
||||
case $host_os in
|
||||
mingw*)
|
||||
chmod u+w cyassl/options.h ;;
|
||||
esac
|
||||
|
||||
rm cyassl/options.h.bak
|
||||
|
||||
|
||||
# output config summary
|
||||
echo "---"
|
||||
echo "Configuration summary for $PACKAGE_NAME version $VERSION"
|
||||
@@ -2878,8 +2894,30 @@ echo " * Async Crypto: $ENABLED_ASYNCCRYPT"
|
||||
echo ""
|
||||
echo "---"
|
||||
|
||||
################################################################################
|
||||
# Show warnings at bottom so they are noticed
|
||||
################################################################################
|
||||
|
||||
if test "$ENABLED_ASYNCCRYPT" = "yes"
|
||||
then
|
||||
AC_MSG_WARN([Make sure real async files are loaded. Contact wolfSSL for details on using the asynccrypt option.])
|
||||
fi
|
||||
|
||||
# MinGW static vs shared library
|
||||
# Reference URL from libtool for MinGW is located at
|
||||
# http://www.gnu.org/software/libtool/manual/libtool.html#Cygwin-to-MinGW-Cross
|
||||
# this allows for not even having dllimport/dllexport on functions
|
||||
# with recent libtools, only requiring it with global variables.
|
||||
#
|
||||
# The following warning is displayed here because if not using "contemporary GNU
|
||||
# tools" there is the possibility of export/import issues.
|
||||
# wolfSSL uses __declspec(dllexport) and "contemporary GNU tools" handle the
|
||||
# case where both static and shared libraries are built.
|
||||
#
|
||||
# More can be found about the MinGW linker at
|
||||
# https://sourceware.org/binutils/docs/ld/WIN32.html
|
||||
if test "$MINGW_LIB_WARNING" = "yes"
|
||||
then
|
||||
AC_MSG_WARN([Building with shared and static library at the same time on this system may cause export/import problems when using non contemporary GNU tools.])
|
||||
fi
|
||||
|
||||
|
@@ -84,7 +84,7 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args)
|
||||
int outCreated = 0;
|
||||
int shutDown = 0;
|
||||
int useAnyAddr = 0;
|
||||
word16 port = wolfSSLPort;
|
||||
word16 port;
|
||||
int argc = ((func_args*)args)->argc;
|
||||
char** argv = ((func_args*)args)->argv;
|
||||
|
||||
@@ -114,14 +114,21 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args)
|
||||
doPSK = 1;
|
||||
#endif
|
||||
|
||||
#if defined(NO_MAIN_DRIVER) && !defined(USE_WINDOWS_API) && \
|
||||
!defined(CYASSL_SNIFFER) && !defined(WOLFSSL_MDK_SHELL) && \
|
||||
!defined(CYASSL_TIRTOS)
|
||||
port = 0;
|
||||
#endif
|
||||
#if defined(USE_ANY_ADDR)
|
||||
useAnyAddr = 1;
|
||||
#endif
|
||||
#if defined(USE_WINDOWS_API)
|
||||
/* Generate random port for testing */
|
||||
port = GetRandomPort();
|
||||
#elif defined(NO_MAIN_DRIVER) && !defined(CYASSL_SNIFFER) && \
|
||||
!defined(WOLFSSL_MDK_SHELL) && !defined(CYASSL_TIRTOS)
|
||||
/* Let tcp_listen assign port */
|
||||
port = 0;
|
||||
#else
|
||||
/* Use default port */
|
||||
port = wolfSSLPort;
|
||||
#endif
|
||||
|
||||
#if defined(USE_ANY_ADDR)
|
||||
useAnyAddr = 1;
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_TIRTOS
|
||||
fdOpenSession(Task_self());
|
||||
|
@@ -398,10 +398,6 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
|
||||
case 'p' :
|
||||
port = (word16)atoi(myoptarg);
|
||||
#if defined(USE_WINDOWS_API)
|
||||
if (port == 0)
|
||||
err_sys("port number cannot be 0");
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 'w' :
|
||||
@@ -730,6 +726,13 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
err_sys("UseSNI failed");
|
||||
#endif
|
||||
|
||||
#ifdef USE_WINDOWS_API
|
||||
if (port == 0) {
|
||||
/* Generate random port for testing */
|
||||
port = GetRandomPort();
|
||||
}
|
||||
#endif /* USE_WINDOWS_API */
|
||||
|
||||
while (1) {
|
||||
/* allow resume option */
|
||||
if(resumeCount > 1) {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
# visibility.m4 serial 4 (gettext-0.18.2)
|
||||
dnl Copyright (C) 2005, 2008, 2010-2011 Free Software Foundation, Inc.
|
||||
# visibility.m4 serial 5 (gettext-0.18.2)
|
||||
dnl Copyright (C) 2005, 2008, 2010-2014 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
@@ -12,7 +12,7 @@ dnl __attribute__((__visibility__("hidden"))) and
|
||||
dnl __attribute__((__visibility__("default"))).
|
||||
dnl Does *not* test for __visibility__("protected") - which has tricky
|
||||
dnl semantics (see the 'vismain' test in glibc) and does not exist e.g. on
|
||||
dnl MacOS X.
|
||||
dnl Mac OS X.
|
||||
dnl Does *not* test for __visibility__("internal") - which has processor
|
||||
dnl dependent semantics.
|
||||
dnl Does *not* test for #pragma GCC visibility push(hidden) - which is
|
||||
@@ -58,7 +58,7 @@ AC_DEFUN([gl_VISIBILITY],
|
||||
extern __attribute__((__visibility__("default"))) int exportedvar;
|
||||
extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void);
|
||||
extern __attribute__((__visibility__("default"))) int exportedfunc (void);
|
||||
void dummyfunc (void) {}
|
||||
int hiddenfunc (void) { return 0; }
|
||||
]],
|
||||
[[]])],
|
||||
[gl_cv_cc_visibility=yes],
|
||||
|
@@ -16,9 +16,9 @@ else
|
||||
fi
|
||||
|
||||
# is our desired server there?
|
||||
ping -c 2 $server
|
||||
./scripts/ping.test $server 2
|
||||
RESULT=$?
|
||||
[ $RESULT -ne 0 ] && echo -e "\n\nCouldn't find $server, skipping" && exit 0
|
||||
[ $RESULT -ne 0 ] && exit 0
|
||||
|
||||
# client test against the server
|
||||
./examples/client/client -X -C -h $server -p 443 -g -A $ca
|
||||
|
@@ -7,9 +7,9 @@ server=www.google.com
|
||||
[ ! -x ./examples/client/client ] && echo -e "\n\nClient doesn't exist" && exit 1
|
||||
|
||||
# is our desired server there?
|
||||
ping -c 2 $server
|
||||
./scripts/ping.test $server 2
|
||||
RESULT=$?
|
||||
[ $RESULT -ne 0 ] && echo -e "\n\nCouldn't find $server, skipping" && exit 0
|
||||
[ $RESULT -ne 0 ] && exit 0
|
||||
|
||||
# client test against the server
|
||||
./examples/client/client -X -C -h $server -p 443 -g -d
|
||||
|
@@ -57,6 +57,8 @@ dist_noinst_SCRIPTS+= scripts/google.test
|
||||
endif
|
||||
endif
|
||||
|
||||
EXTRA_DIST += scripts/testsuite.pcap
|
||||
EXTRA_DIST += scripts/testsuite.pcap \
|
||||
scripts/ping.test
|
||||
|
||||
# leave openssl.test as extra until non bash works
|
||||
EXTRA_DIST += scripts/openssl.test
|
||||
|
@@ -10,9 +10,7 @@ ca=certs/external/ca-verisign-g5.pem
|
||||
[ ! -x ./examples/client/client ] && echo -e "\n\nClient doesn't exist" && exit 1
|
||||
|
||||
# is our desired server there? - login.live.com doesn't answers PING
|
||||
# ping -c 2 $server
|
||||
# RESULT=$?
|
||||
# [ $RESULT -ne 0 ] && echo -e "\n\nCouldn't find $server, skipping" && exit 0
|
||||
#./scripts/ping.test $server 2
|
||||
|
||||
# client test against the server
|
||||
./examples/client/client -X -C -h $server -p 443 -A $ca -g -W 1
|
||||
|
@@ -8,9 +8,9 @@ ca=certs/external/ca-globalsign-root-r2.pem
|
||||
[ ! -x ./examples/client/client ] && echo -e "\n\nClient doesn't exist" && exit 1
|
||||
|
||||
# is our desired server there?
|
||||
ping -c 2 $server
|
||||
./scripts/ping.test $server 2
|
||||
RESULT=$?
|
||||
[ $RESULT -ne 0 ] && echo -e "\n\nCouldn't find $server, skipping" && exit 0
|
||||
[ $RESULT -ne 0 ] && exit 0
|
||||
|
||||
# client test against the server
|
||||
./examples/client/client -X -C -h $server -p 443 -A $ca -g -o
|
||||
|
29
scripts/ping.test
Executable file
29
scripts/ping.test
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/bin/sh
|
||||
|
||||
# ping.test
|
||||
|
||||
# defaults
|
||||
server=www.wolfssl.com
|
||||
tries=2
|
||||
|
||||
# populate args
|
||||
if [ "$#" -gt 1 ]; then
|
||||
tries=$2
|
||||
fi
|
||||
if [ "$#" -gt 0 ]; then
|
||||
server=$1
|
||||
fi
|
||||
|
||||
# determine os
|
||||
OS="`uname`"
|
||||
case $OS in
|
||||
MINGW* | MSYS*) PINGSW=-n ;;
|
||||
*) PINGSW=-c ;;
|
||||
esac
|
||||
|
||||
# is our desired server there?
|
||||
ping $PINGSW $tries $server
|
||||
RESULT=$?
|
||||
[ $RESULT -ne 0 ] && echo -e "\n\nCouldn't find $server, skipping" && exit 1
|
||||
|
||||
exit 0
|
36
tests/api.c
36
tests/api.c
@@ -58,7 +58,13 @@ static const char* passed = "passed";
|
||||
static const char* failed = "failed";
|
||||
|
||||
#if !defined(NO_FILESYSTEM) && !defined(NO_CERTS)
|
||||
static const char* bogusFile = "/dev/null";
|
||||
static const char* bogusFile =
|
||||
#ifdef _WIN32
|
||||
"NUL"
|
||||
#else
|
||||
"/dev/null"
|
||||
#endif
|
||||
;
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
@@ -485,7 +491,7 @@ static THREAD_RETURN WOLFSSL_THREAD test_server_nofail(void* args)
|
||||
{
|
||||
SOCKET_T sockfd = 0;
|
||||
SOCKET_T clientfd = 0;
|
||||
word16 port = wolfSSLPort;
|
||||
word16 port;
|
||||
|
||||
WOLFSSL_METHOD* method = 0;
|
||||
WOLFSSL_CTX* ctx = 0;
|
||||
@@ -503,10 +509,16 @@ static THREAD_RETURN WOLFSSL_THREAD test_server_nofail(void* args)
|
||||
method = wolfSSLv23_server_method();
|
||||
ctx = wolfSSL_CTX_new(method);
|
||||
|
||||
#if defined(NO_MAIN_DRIVER) && !defined(USE_WINDOWS_API) && \
|
||||
!defined(WOLFSSL_SNIFFER) && !defined(WOLFSSL_MDK_SHELL) && \
|
||||
!defined(WOLFSSL_TIRTOS)
|
||||
#if defined(USE_WINDOWS_API)
|
||||
/* Generate random port for testing */
|
||||
port = GetRandomPort();
|
||||
#elif defined(NO_MAIN_DRIVER) && !defined(WOLFSSL_SNIFFER) && \
|
||||
!defined(WOLFSSL_MDK_SHELL) && !defined(WOLFSSL_TIRTOS)
|
||||
/* Let tcp_listen assign port */
|
||||
port = 0;
|
||||
#else
|
||||
/* Use default port */
|
||||
port = wolfSSLPort;
|
||||
#endif
|
||||
|
||||
wolfSSL_CTX_set_verify(ctx,
|
||||
@@ -704,7 +716,7 @@ static THREAD_RETURN WOLFSSL_THREAD run_wolfssl_server(void* args)
|
||||
WOLFSSL* ssl = NULL;
|
||||
SOCKET_T sfd = 0;
|
||||
SOCKET_T cfd = 0;
|
||||
word16 port = wolfSSLPort;
|
||||
word16 port;
|
||||
|
||||
char msg[] = "I hear you fa shizzle!";
|
||||
int len = (int) XSTRLEN(msg);
|
||||
@@ -716,10 +728,16 @@ static THREAD_RETURN WOLFSSL_THREAD run_wolfssl_server(void* args)
|
||||
#endif
|
||||
((func_args*)args)->return_code = TEST_FAIL;
|
||||
|
||||
#if defined(NO_MAIN_DRIVER) && !defined(USE_WINDOWS_API) && \
|
||||
!defined(WOLFSSL_SNIFFER) && !defined(WOLFSSL_MDK_SHELL) && \
|
||||
!defined(WOLFSSL_TIRTOS)
|
||||
#if defined(USE_WINDOWS_API)
|
||||
/* Generate random port for testing */
|
||||
port = GetRandomPort();
|
||||
#elif defined(NO_MAIN_DRIVER) && !defined(WOLFSSL_SNIFFER) && \
|
||||
!defined(WOLFSSL_MDK_SHELL) && !defined(WOLFSSL_TIRTOS)
|
||||
/* Let tcp_listen assign port */
|
||||
port = 0;
|
||||
#else
|
||||
/* Use default port */
|
||||
port = wolfSSLPort;
|
||||
#endif
|
||||
|
||||
wolfSSL_CTX_set_verify(ctx,
|
||||
|
@@ -152,6 +152,7 @@ void join_thread(THREAD_TYPE thread)
|
||||
assert(res == WAIT_OBJECT_0);
|
||||
res = CloseHandle((HANDLE)thread);
|
||||
assert(res);
|
||||
(void)res; /* Suppress un-used variable warning */
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@@ -332,6 +332,7 @@ void join_thread(THREAD_TYPE thread)
|
||||
assert(res == WAIT_OBJECT_0);
|
||||
res = CloseHandle((HANDLE)thread);
|
||||
assert(res);
|
||||
(void)res; /* Suppress un-used variable warning */
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@@ -7093,7 +7093,7 @@ static int WriteCertBody(DerCert* der, byte* buffer)
|
||||
if (der->extensionsSz) {
|
||||
/* extensions */
|
||||
XMEMCPY(buffer + idx, der->extensions, min(der->extensionsSz,
|
||||
sizeof(der->extensions)));
|
||||
(int)sizeof(der->extensions)));
|
||||
idx += der->extensionsSz;
|
||||
}
|
||||
|
||||
|
@@ -347,7 +347,7 @@ int wc_DsaSign(const byte* digest, byte* out, DsaKey* key, WC_RNG* rng)
|
||||
int ret, sz;
|
||||
byte buffer[DSA_HALF_SIZE];
|
||||
|
||||
sz = min(sizeof(buffer), mp_unsigned_bin_size(&key->q));
|
||||
sz = min((int)sizeof(buffer), mp_unsigned_bin_size(&key->q));
|
||||
|
||||
/* generate k */
|
||||
ret = wc_RNG_GenerateBlock(rng, buffer, sz);
|
||||
|
@@ -1925,4 +1925,18 @@ static INLINE const char* mymktemp(char *tempfn, int len, int num)
|
||||
}
|
||||
#endif
|
||||
|
||||
static INLINE word16 GetRandomPort(void)
|
||||
{
|
||||
word16 port = 0;
|
||||
|
||||
/* Generate random port for testing */
|
||||
WC_RNG rng;
|
||||
if (wc_InitRng(&rng) == 0) {
|
||||
wc_RNG_GenerateBlock(&rng, (byte*)&port, sizeof(port));
|
||||
port |= 0xC000; /* Make sure its in the 49152 - 65535 range */
|
||||
wc_FreeRng(&rng);
|
||||
}
|
||||
return port;
|
||||
}
|
||||
|
||||
#endif /* wolfSSL_TEST_H */
|
||||
|
@@ -223,6 +223,13 @@
|
||||
#define XSTRTOK strtok_r
|
||||
#else
|
||||
#define XSTRTOK strtok_s
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic warning "-Wcpp"
|
||||
#warning "MinGW may be missing strtok_s. You can find a public domain implementation here: https://github.com/fletcher/MultiMarkdown-4/blob/master/strtok.c"
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
@@ -46,8 +46,8 @@
|
||||
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
|
||||
#define WOLFSSL_API __global
|
||||
#define WOLFSSL_LOCAL __hidden
|
||||
#elif defined(_MSC_VER)
|
||||
#ifdef WOLFSSL_DLL
|
||||
#elif defined(_MSC_VER) || defined(__MINGW32__)
|
||||
#if defined(WOLFSSL_DLL)
|
||||
#define WOLFSSL_API __declspec(dllexport)
|
||||
#else
|
||||
#define WOLFSSL_API
|
||||
@@ -58,8 +58,8 @@
|
||||
#define WOLFSSL_LOCAL
|
||||
#endif /* HAVE_VISIBILITY */
|
||||
#else /* BUILDING_WOLFSSL */
|
||||
#if defined(_MSC_VER)
|
||||
#ifdef WOLFSSL_DLL
|
||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||
#if defined(WOLFSSL_DLL)
|
||||
#define WOLFSSL_API __declspec(dllimport)
|
||||
#else
|
||||
#define WOLFSSL_API
|
||||
|
Reference in New Issue
Block a user