summaryrefslogtreecommitdiffstats
path: root/crypto/async (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Move Makefiles to Makefile.inRich Salz2016-01-122-128/+81
| | | | | | | | | | Create Makefile's from Makefile.in Rename Makefile.org to Makefile.in Rename Makefiles to Makefile.in Address review feedback from Viktor and Richard Reviewed-by: Viktor Dukhovni <viktor@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
* Rename DECLARE*STACK_OF to DEFINE*STACK_OFDr. Stephen Henson2016-01-071-1/+1
| | | | | | | | | | Applications wishing to include their own stacks now just need to include DEFINE_STACK_OF(foo) in a header file. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Fix build on SolarisMatt Caswell2015-12-161-0/+4
| | | | | | | | | | | Solaris builds were failing during async compilation because the .o files created from compiling the corresponding .c files held in async/arch were ending up in the top level async directory. Consequently the link fails because it can't find the .o files. Thanks to Richard Levitte for pointing me in the right direction on this. Reviewed-by: Richard Levitte <levitte@openssl.org>
* make updateDr. Stephen Henson2015-12-151-6/+6
| | | | Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
* Fix compile failure with no-threadsMatt Caswell2015-12-121-1/+1
| | | | | | The async code was causing a compile failure if no-threads was used. Reviewed-by: Kurt Roeckx <kurt@openssl.org>
* make updateMatt Caswell2015-12-101-6/+6
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* "make update" after async merge.Rich Salz2015-11-231-2/+10
| | | | Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
* Async error handling and MacOS/X fixesViktor Dukhovni2015-11-227-50/+50
| | | | | | | | | | | | | | | | | | | In the async code for MacOS/X define _XOPEN_SOURCE (if not already defined) as early as possible. We must do this before including any header files, because on MacOS/X <stlib.h> includes <signal.h> which includes <ucontext.h>. If we delay defining _XOPEN_SOURCE and include <ucontext.h> after various system headers are included, we are very likely to end up with the wrong (truncated) definition of ucontext_t. Also, better error handling and some code cleanup in POSIX fibre construction and destruction. We make sure that async_fibre_makecontext() always initializes the fibre to a state that can be freed. For all implementations, check for error returns from async_fibre_makecontext(). Reviewed-by: Matt Caswell <matt@openssl.org>
* Implement windows async thread local variable supportMatt Caswell2015-11-217-17/+124
| | | | | | | Implements Thread Local Storage in the windows async port. This also has some knock on effects to the posix and null implementations. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Convert __thread to pthreads for Thread Local StorageMatt Caswell2015-11-216-24/+62
| | | | | | | | | | | | 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>
* Simplify async pool handlingMatt Caswell2015-11-219-176/+96
| | | | | | | | A lot of the pool handling code was in the arch specific files, but was actually boiler plate and the same across the implementations. This commit moves as much code as possible out of the arch specific files. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Swap to using proper windows pipesMatt Caswell2015-11-215-21/+25
| | | | | | | | | | 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>
* Fix some style issuesMatt Caswell2015-11-213-35/+38
| | | | | | | There were a number of places where the async code did not conform to the OpenSSL coding style. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Add ASYNC_block_pause and ASYNC_unblock_pauseMatt Caswell2015-11-212-3/+32
| | | | | | | | | 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>
* Further OS-X deprecated warnings tweakMatt Caswell2015-11-211-1/+3
| | | | | | | | | | Even with _XOPEN_SOURCE defined OS-X still displays warnings that makecontext and friends are deprecated. This isn't a problem until you try and build with --strict-warnings, and the build fails. This change suppresses the warnings. We know they are deprecated but there is no alternative! Reviewed-by: Rich Salz <rsalz@openssl.org>
* Fix bug in async_fibre_makecontext for POSIXMatt Caswell2015-11-211-2/+2
| | | | | | | | | | async_fibre_makecontext was initialise the fibre first and then calling getcontext(). It should be the other way around because the getcontext call may overwrite some of the things we just initialised. This didn't cause an issue on Linux and so the problem went unnoticed. On OS-X it causes a crash. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Fix compilation error on OS-XMatt Caswell2015-11-211-0/+6
| | | | | | OS-X complains if we don't have _XOPEN_SOURCE defined. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Fix clang errorsMatt Caswell2015-11-211-13/+17
| | | | | | Make clang build without errors in the async code Reviewed-by: Rich Salz <rsalz@openssl.org>
* Swap to using _longjmp/_setjmp instead of longjmp/setjmpMatt Caswell2015-11-211-2/+2
| | | | | | | | _longjmp/_setjmp do not manipulate the signal mask whilst longjmp/setjmp may do. Online sources suggest this could result in a significant speed up in the context switching. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Fix Linux crashMatt Caswell2015-11-211-0/+8
| | | | | | | | | | | | | If config'd without -d (--debug), asynctest was crashing with: *** longjmp causes uninitialized stack frame *** This is because gcc will add certain checks for some functions (including longjmp). The checks assume you can only longjmp down the stack not up. However, if we are actually jumping to a different fibre then it can appear as if we are going up the stack when we are not really. This change disables the check. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Tweak async documentation based on feedbackMatt Caswell2015-11-211-3/+3
| | | | | | | | | | Add some clarifications to the async documentation. Also changed ASYNC_pause_job() so that it returns success if you are not within the context of a job. This is so that engines can be used either asynchronously or synchronously and can treat an error from ASYNC_pause_job() as a real error. Reviewed-by: Rich Salz <rsalz@openssl.org>
* make updateMatt Caswell2015-11-211-1/+9
| | | | Reviewed-by: Rich Salz <rsalz@openssl.org>
* Add ASYNC error codesMatt Caswell2015-11-213-10/+131
| | | | | | | Add ASYNCerr support to give some meaningful error message in the event of a failure. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Normalise ASYNC namingMatt Caswell2015-11-217-99/+98
| | | | | | Tidied up the naming of functions and structures to be consistent Reviewed-by: Rich Salz <rsalz@openssl.org>
* Fix windows compilation warningsMatt Caswell2015-11-214-7/+18
| | | | | | Fix some warnings in the async code when compiling on windows. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Optimise ASYNC_CTX handlingMatt Caswell2015-11-211-8/+4
| | | | | | | | Don't recreate a new ASYNC_CTX every time we call ASYNC_start_job() - the same one can be used for the life of the thread. Instead we only free it up when we call ASYNC_free_pool(). Reviewed-by: Rich Salz <rsalz@openssl.org>
* Fix ASYNC null implementationMatt Caswell2015-11-213-2/+111
| | | | | | | 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>
* Remove ASYNC_in_job()Matt Caswell2015-11-211-8/+0
| | | | | | | The ASYNC_in_job() function is redundant. The same effect can be achieved by using ASYNC_get_current_job(). Reviewed-by: Rich Salz <rsalz@openssl.org>
* Implement windows async pool and notify supportMatt Caswell2015-11-216-13/+121
| | | | | | Port the async pool and notify code to windows. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Implement local thread poolsMatt Caswell2015-11-214-21/+73
| | | | | | | Implement the ASYNC_JOB as a local thread pool. Remove the API support for global pools. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Initial Async notify code changesMatt Caswell2015-11-214-0/+77
| | | | | | | | | | | | Initial API implemented for notifying applications that an ASYNC_JOB has completed. Currently only s_server is using this. The Dummy Async engine "cheats" in that it notifies that it has completed *before* it pauses the job. A normal async engine would not do that. Only the posix version of this has been implemented so far, so it will probably fail to compile on Windows at the moment. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Add ASYNC_JOB poolsMatt Caswell2015-11-211-19/+107
| | | | | | | | It is expensive to create the ASYNC_JOB objects due to the "makecontext" call. This change adds support for pools of ASYNC_JOB objects so that we don't have to create a new ASYNC_JOB every time we want to use one. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Use longjmp at setjmp where possibleMatt Caswell2015-11-213-12/+28
| | | | | | | Where we can we should use longjmp and setjmp in preference to swapcontext/ setcontext as they seem to be more performant. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Async clean upsMatt Caswell2015-11-211-5/+3
| | | | | | | | | Removed the function ASYNC_job_is_waiting() as it was redundant. The only time user code has a handle on a job is when one is waiting, so all they need to do is check whether the job is NULL. Also did some cleanups to make sure the job really is NULL after it has been freed! Reviewed-by: Rich Salz <rsalz@openssl.org>
* Increase stack sizeMatt Caswell2015-11-211-2/+4
| | | | | | Some assembler code puts a lot of stuff on the stack, so up the stack size. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Add null async implementationMatt Caswell2015-11-214-11/+86
| | | | | | | Create a "null" async implementation for platforms that lack support. This just does nothing when called and therefore performs synchronously. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Async port to windowsMatt Caswell2015-11-217-106/+515
| | | | Reviewed-by: Rich Salz <rsalz@openssl.org>
* Add async sub-library to libcryptoMatt Caswell2015-11-212-0/+358
Provides support for running asynchronous jobs. Currently this is completely stand alone. Future commits will integrate this into libssl and s_server/ s_client. An asynchronous capable engine will be required to see any benefit from this capability. Reviewed-by: Rich Salz <rsalz@openssl.org>