summaryrefslogtreecommitdiffstats
path: root/test/asynctest.c
AgeCommit message (Collapse)Author
2017-02-13Add test to show wrong behavior of ASYNC_WAIT_CTXAndrea Grandi
This happens when a fd is added and then immediately removed from the ASYNC_WAIT_CTX before pausing the job. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2581)
2016-07-20Fix a few if(, for(, while( inside code.FdaSilvaYY
Fix some indentation at the same time Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1292)
2016-07-08include/openssl: don't include <windows.h> in public headers.Andy Polyakov
If application uses any of Windows-specific interfaces, make it application developer's respondibility to include <windows.h>. Rationale is that <windows.h> is quite "toxic" and is sensitive to inclusion order (most notably in relation to <winsock2.h>). It's only natural to give complete control to the application developer. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
2016-05-17Copyright consolidation 02/10Rich Salz
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-03-16Some platforms provide getcontext() but it does not workMatt Caswell
Some platforms claim to be POSIX but their getcontext() implementation does not work. Therefore we update the ASYNC_is_capable() function to test for this. RT#4366 Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-02-29Fix use before init warnings in asynctestMatt Caswell
If the tests fail early before an ASYNC_WAIT_CTX is created then there can be a use before init problem in asynctest. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-02-29Refactor the async wait fd logicMatt Caswell
Implementation experience has shown that the original plan for async wait fds was too simplistic. Originally the async logic created a pipe internally and user/engine code could then get access to it via API calls. It is more flexible if the engine is able to create its own fd and provide it to the async code. Another issue is that there can be a lot of churn in the fd value within the context of (say) a single SSL connection leading to continually adding and removing fds from (say) epoll. It is better if we can provide some stability of the fd value across a whole SSL connection. This is problematic because an engine has no concept of an SSL connection. This commit refactors things to introduce an ASYNC_WAIT_CTX which acts as a proxy for an SSL connection down at the engine layer. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-02-09Auto init/deinit libcryptoMatt Caswell
This builds on the previous commit to auto initialise/deinitialise libcrypto. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-01-26Remove /* foo.c */ commentsRich Salz
This was done by the following find . -name '*.[ch]' | /tmp/pl where /tmp/pl is the following three-line script: print unless $. == 1 && m@/\* .*\.[ch] \*/@; close ARGV if eof; # Close file to reset $. And then some hand-editing of other files. Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
2016-01-18Use POSIX functions on Cygwin, not Win32 functionCorinna Vinschen
Signed-off-by: Corinna Vinschen <vinschen@redhat.com> Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-01-07mem functions cleanupRich Salz
Only two macros CRYPTO_MDEBUG and CRYPTO_MDEBUG_ABORT to control this. If CRYPTO_MDEBUG is not set, #ifdef out the whole debug machinery. (Thanks to Jakob Bohm for the suggestion!) Make the "change wrapper functions" be the only paradigm. Wrote documentation! Format the 'set func' functions so their paramlists are legible. Format some multi-line comments. Remove ability to get/set the "memory debug" functions at runtme. Remove MemCheck_* and CRYPTO_malloc_debug_init macros. Add CRYPTO_mem_debug(int flag) function. Add test/memleaktest. Rename CRYPTO_malloc_init to OPENSSL_malloc_init; remove needless calls. Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-11-20Convert __thread to pthreads for Thread Local StorageMatt Caswell
In theory the pthreads approach for Thread Local Storage should be more portable. This also changes some APIs in order to accommodate this change. In particular ASYNC_init_pool is renamed ASYNC_init_thread and ASYNC_free_pool is renamed ASYNC_cleanup_thread. Also introduced ASYNC_init and ASYNC_cleanup. Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-11-20Swap to using proper windows pipesMatt Caswell
We were using _pipe to create a pipe on windows. This uses the "int" type for its file descriptor for compatibility. However most windows functions expect to use a "HANDLE". Probably we could get away with just casting but it seems more robust to use the proper type and main stream windows functions. Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-11-20Add ASYNC_block_pause and ASYNC_unblock_pauseMatt Caswell
There are potential deadlock situations that can occur if code executing within the context of a job aquires a lock, and then pauses the job. This adds an ability to temporarily block pauses from occuring whilst performing work and holding a lock. Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-11-20Fix ASYNC null implementationMatt Caswell
The ASYNC null implementation has not kept pace with the rest of the async development and so was failing to compile. Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-11-20Add ASYNC testsMatt Caswell
Add a suite of tests for the ASYNC_* functions Reviewed-by: Rich Salz <rsalz@openssl.org>