[openssl-commits] [openssl] master update

Matt Caswell matt at openssl.org
Sat Nov 21 09:12:26 UTC 2015


The branch master has been updated
       via  22a34c2fab39c38cac4a22a0e15ab9a1fd98f57c (commit)
       via  68487a9b0631d27be9a1f4565e7e652ae9cb6aad (commit)
       via  27949c353e68825f119410f8fd73ae1d667581c7 (commit)
       via  2b2c78d4f0a73498739cfc0879299d7325c35160 (commit)
       via  e38565f536b7674ef507564b5c646712b1d7eed4 (commit)
       via  625146d9fbb74651e6158af7db0e76b899c39c9e (commit)
       via  e8dfb5bf8e525c9799820d01b2df5fde098a9c4c (commit)
       via  f4511d4897f56a18a2a681e2ade8063658ff2cbb (commit)
       via  03dc77e07bf0f60a39872946405f1188daad3604 (commit)
       via  90fa7296c22583a0a42203b078979bbfb2fcb11d (commit)
       via  7fecbf6f2150394bea7a3435b22cea129d05c9a9 (commit)
       via  46a283c01c825ab5b8d9020767383b7087e0cb5b (commit)
       via  8227255006f3a7e5091e1637f8b5cc904355f045 (commit)
       via  000cc411b9281120030a970221e26c8358b0ca76 (commit)
       via  d7e404c27bba9384f346c28931c747bba880204a (commit)
       via  06b9ff06cc7fdd8f51abb92aaac39d3988a7090e (commit)
       via  4abc76811a74b45c8bab1bbe3add4b58b374a04b (commit)
       via  05a6347fec744bd11ef94dd2ac9f68b4f679de8e (commit)
       via  add2f5ca6dd174154bf2f2b63e3cfd8bf5ce5109 (commit)
       via  c742f56e94176d4274bb31e796e9ea9eb084f60f (commit)
       via  079a1a9014b89661f0a612a5a9724ad9c77f21a3 (commit)
       via  9c8dc051d0a1293279bbf289b5f324824a02405b (commit)
       via  e1b9840ed7c52346e4e203470210f7821158f708 (commit)
       via  9920a58eb20dcf33abf231e8c9439953ace3c936 (commit)
       via  bc8857bf70f5428bc2f0d26162ed59e3abb11fb1 (commit)
       via  636ca4ff64d0c512b5f9e01ddc644e5f7661849e (commit)
       via  134b28f883b0a24c625600b328f4c5750c849a24 (commit)
       via  9f078e1961d4fc798c356fa185df083f2abdb054 (commit)
       via  7240557b7d6a06cd7e4cd50e52fb1e62d0a750e0 (commit)
       via  5705e05037938623f701092ec84dae90d191091c (commit)
       via  44a27ac282ec2a419027383ce0ac6c7f304b1490 (commit)
       via  c00793da995b6e2d52ac4423dc8d5a8607852ff8 (commit)
       via  4f70d04593951905fa560719ae7aaa032aca14ca (commit)
       via  d63de0ebff88c4ef1d93065c4e531fdf5ed894fe (commit)
       via  5e6f9775a9db38b50c2f5487f126b58f7bfff78e (commit)
       via  64c07bd2d8fd162147a75ff885165bc31388bfa7 (commit)
       via  0ff2b9ac0b8b9cd62e20cd65bf4922b34f57a8c1 (commit)
       via  f4da39d200a8c2068595b8d5bd5efb78af4224e1 (commit)
       via  252d6d3aa62dccf0dc826644b7da0b6bafa3831b (commit)
       via  7070e5ca2fa41940d56599bf016a45cb1c0e03f0 (commit)
       via  4cfa6204e8740a3e89b96fac3f1ac49d137e9dc9 (commit)
       via  826760945de655d2d2d387cac3a3646ced80977e (commit)
       via  06754949e4317f5ba7e318a8841b78a7d622053f (commit)
       via  9ec1e03194568630a2e58232d56e9d37dd13ed7d (commit)
       via  501083049590455b1862edd7573fd51bb37bb037 (commit)
       via  38148a234c6ed7a9d78dc5fb3de0ac4d79402e6f (commit)
       via  7e25dd6da17eefb3c0c31ac4ad436b70f6d39f86 (commit)
       via  07bbc92ccb96d48044220d2ed2cf818323baeb26 (commit)
       via  a14e9ff713cbe7dbbba2aa667466490291cffc68 (commit)
       via  a3667c316ae60ef454fb804221c3ca44af30a9aa (commit)
      from  757d14905e3877abaa9f258f3dd0694ae3c7c270 (commit)


- Log -----------------------------------------------------------------
commit 22a34c2fab39c38cac4a22a0e15ab9a1fd98f57c
Author: Matt Caswell <matt at openssl.org>
Date:   Thu Nov 19 21:44:13 2015 +0000

    Implement windows async thread local variable support
    
    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 at openssl.org>

commit 68487a9b0631d27be9a1f4565e7e652ae9cb6aad
Author: Matt Caswell <matt at openssl.org>
Date:   Fri Nov 13 23:54:44 2015 +0000

    Convert __thread to pthreads for Thread Local Storage
    
    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 at openssl.org>

commit 27949c353e68825f119410f8fd73ae1d667581c7
Author: Matt Caswell <matt at openssl.org>
Date:   Fri Nov 13 15:21:20 2015 +0000

    Simplify async pool handling
    
    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 at openssl.org>

commit 2b2c78d4f0a73498739cfc0879299d7325c35160
Author: Matt Caswell <matt at openssl.org>
Date:   Fri Nov 13 11:22:21 2015 +0000

    Swap to using proper windows pipes
    
    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 at openssl.org>

commit e38565f536b7674ef507564b5c646712b1d7eed4
Author: Matt Caswell <matt at openssl.org>
Date:   Thu Nov 12 11:50:38 2015 +0000

    Fix some style issues
    
    There were a number of places where the async code did not conform to the
    OpenSSL coding style.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 625146d9fbb74651e6158af7db0e76b899c39c9e
Author: Matt Caswell <matt at openssl.org>
Date:   Thu Nov 12 10:52:30 2015 +0000

    Fix async deadlock problem
    
    The rand code can aquire locks and then attempt crypto operations. This
    can end up in a deadlock if we are using an async engine, because control
    returns back to the user code whilst still holding the lock. We need to
    force synchronous operation for these sections of code.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit e8dfb5bf8e525c9799820d01b2df5fde098a9c4c
Author: Matt Caswell <matt at openssl.org>
Date:   Thu Nov 12 10:42:08 2015 +0000

    Add ASYNC_block_pause and ASYNC_unblock_pause
    
    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 at openssl.org>

commit f4511d4897f56a18a2a681e2ade8063658ff2cbb
Author: Matt Caswell <matt at openssl.org>
Date:   Thu Oct 15 15:33:57 2015 +0100

    Remove ASYNC NOEXIST functions from libeay.num
    
    During development some functions got added and then later taken away.
    Since these will never appear in a production version there is no reason
    for them to appear in libeay.num flagged as "NOEXIST".
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 03dc77e07bf0f60a39872946405f1188daad3604
Author: Matt Caswell <matt at openssl.org>
Date:   Sun Oct 11 16:59:08 2015 +0100

    Further OS-X deprecated warnings tweak
    
    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 at openssl.org>

commit 90fa7296c22583a0a42203b078979bbfb2fcb11d
Author: Matt Caswell <matt at openssl.org>
Date:   Sun Oct 11 16:17:27 2015 +0100

    Fix bug in async_fibre_makecontext for POSIX
    
    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 at openssl.org>

commit 7fecbf6f2150394bea7a3435b22cea129d05c9a9
Author: Matt Caswell <matt at openssl.org>
Date:   Fri Oct 9 16:47:43 2015 +0100

    Rename start_async_job to ssl_start_async_job
    
    Make it clear that this function is ssl specific.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 46a283c01c825ab5b8d9020767383b7087e0cb5b
Author: Matt Caswell <matt at openssl.org>
Date:   Fri Oct 9 16:45:25 2015 +0100

    Rename some daysnc functions for consistency
    
    For some reason the dasync sha1 functions did not start with the
    dasync prefix like all of the other functions do. Changed for
    consistency.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 8227255006f3a7e5091e1637f8b5cc904355f045
Author: Matt Caswell <matt at openssl.org>
Date:   Fri Oct 9 16:39:35 2015 +0100

    Add clarification to docs on ASYNC_free_pool()
    
    Clarify that you must only call this after all async jobs have
    completed - otherwise you could get memory leaks.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 000cc411b9281120030a970221e26c8358b0ca76
Author: Matt Caswell <matt at openssl.org>
Date:   Fri Oct 9 16:32:07 2015 +0100

    Fix compilation error on OS-X
    
    OS-X complains if we don't have _XOPEN_SOURCE defined.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit d7e404c27bba9384f346c28931c747bba880204a
Author: Matt Caswell <matt at openssl.org>
Date:   Fri Oct 9 16:23:55 2015 +0100

    Fix clang errors
    
    Make clang build without errors in the async code
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 06b9ff06cc7fdd8f51abb92aaac39d3988a7090e
Author: Matt Caswell <matt at openssl.org>
Date:   Fri Oct 9 15:55:01 2015 +0100

    Swap to using _longjmp/_setjmp instead of longjmp/setjmp
    
    _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 at openssl.org>

commit 4abc76811a74b45c8bab1bbe3add4b58b374a04b
Author: Matt Caswell <matt at openssl.org>
Date:   Fri Oct 9 15:48:30 2015 +0100

    Fix Linux crash
    
    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 at openssl.org>

commit 05a6347fec744bd11ef94dd2ac9f68b4f679de8e
Author: Matt Caswell <matt at openssl.org>
Date:   Wed Oct 7 10:00:22 2015 +0100

    Tweak async documentation based on feedback
    
    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 at openssl.org>

commit add2f5ca6dd174154bf2f2b63e3cfd8bf5ce5109
Author: Matt Caswell <matt at openssl.org>
Date:   Tue Oct 6 15:57:50 2015 +0100

    Clean up libssl async calls
    
    Tidy up the libssl async calls and make sure all IO functions are covered.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit c742f56e94176d4274bb31e796e9ea9eb084f60f
Author: Matt Caswell <matt at openssl.org>
Date:   Tue Oct 6 14:51:19 2015 +0100

    make update
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 079a1a9014b89661f0a612a5a9724ad9c77f21a3
Author: Matt Caswell <matt at openssl.org>
Date:   Tue Oct 6 14:47:00 2015 +0100

    Add ASYNC error codes
    
    Add ASYNCerr support to give some meaningful error message in the event of
    a failure.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 9c8dc051d0a1293279bbf289b5f324824a02405b
Author: Matt Caswell <matt at openssl.org>
Date:   Tue Oct 6 14:26:28 2015 +0100

    Update CHANGES
    
    Add a CHANGES entry for the new async code.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit e1b9840ed7c52346e4e203470210f7821158f708
Author: Matt Caswell <matt at openssl.org>
Date:   Tue Oct 6 14:04:11 2015 +0100

    Add s_client support for waiting for async
    
    s_server already had the ability to wait on an async file descriptor. This
    adds it to s_client too.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 9920a58eb20dcf33abf231e8c9439953ace3c936
Author: Matt Caswell <matt at openssl.org>
Date:   Tue Oct 6 13:49:16 2015 +0100

    Fix the error code for SSL_get_async_wait_fd()
    
    0 is a valid file descriptor so SSL_get_async_wait_fd should instead return
    -1 on error.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit bc8857bf70f5428bc2f0d26162ed59e3abb11fb1
Author: Matt Caswell <matt at openssl.org>
Date:   Tue Oct 6 13:48:43 2015 +0100

    More async documentation
    
    Document the libssl and command line application aspects of async.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 636ca4ff64d0c512b5f9e01ddc644e5f7661849e
Author: Matt Caswell <matt at openssl.org>
Date:   Tue Oct 6 11:25:16 2015 +0100

    Normalise ASYNC naming
    
    Tidied up the naming of functions and structures to be consistent
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 134b28f883b0a24c625600b328f4c5750c849a24
Author: Matt Caswell <matt at openssl.org>
Date:   Tue Oct 6 10:52:04 2015 +0100

    Fix windows compilation warnings
    
    Fix some warnings in the async code when compiling on windows.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 9f078e1961d4fc798c356fa185df083f2abdb054
Author: Matt Caswell <matt at openssl.org>
Date:   Tue Oct 6 10:25:21 2015 +0100

    Optimise ASYNC_CTX handling
    
    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 at openssl.org>

commit 7240557b7d6a06cd7e4cd50e52fb1e62d0a750e0
Author: Matt Caswell <matt at openssl.org>
Date:   Mon Oct 5 22:58:01 2015 +0100

    Fix ASYNC null implementation
    
    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 at openssl.org>

commit 5705e05037938623f701092ec84dae90d191091c
Author: Matt Caswell <matt at openssl.org>
Date:   Mon Oct 5 19:41:58 2015 +0100

    Add ASYNC tests
    
    Add a suite of tests for the ASYNC_* functions
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 44a27ac282ec2a419027383ce0ac6c7f304b1490
Author: Matt Caswell <matt at openssl.org>
Date:   Wed Sep 23 23:12:36 2015 +0100

    Remove ASYNC_in_job()
    
    The ASYNC_in_job() function is redundant. The same effect can be achieved by
    using ASYNC_get_current_job().
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit c00793da995b6e2d52ac4423dc8d5a8607852ff8
Author: Matt Caswell <matt at openssl.org>
Date:   Wed Sep 23 13:51:58 2015 +0100

    Document async capabilities
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 4f70d04593951905fa560719ae7aaa032aca14ca
Author: Matt Caswell <matt at openssl.org>
Date:   Thu Sep 17 09:46:55 2015 +0100

    make update
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit d63de0ebff88c4ef1d93065c4e531fdf5ed894fe
Author: Matt Caswell <matt at openssl.org>
Date:   Wed Sep 16 23:43:45 2015 +0100

    Implement windows async pool and notify support
    
    Port the async pool and notify code to windows.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 5e6f9775a9db38b50c2f5487f126b58f7bfff78e
Author: Matt Caswell <matt at openssl.org>
Date:   Wed Sep 16 23:09:15 2015 +0100

    Fix pools for s_client
    
    s_client was not freeing up the async pool if async mode was enabled.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 64c07bd2d8fd162147a75ff885165bc31388bfa7
Author: Matt Caswell <matt at openssl.org>
Date:   Wed Sep 16 22:54:54 2015 +0100

    Fix s_server bug
    
    If an async event occurs during a renegotiation in SSL_read then s_server
    was looping around, detecting we were in init and calling
    init_ssl_connection instead of re-calling SSL_read.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 0ff2b9ac0b8b9cd62e20cd65bf4922b34f57a8c1
Author: Matt Caswell <matt at openssl.org>
Date:   Wed Sep 16 17:01:58 2015 +0100

    Implement local thread pools
    
    Implement the ASYNC_JOB as a local thread pool. Remove the API support
    for global pools.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit f4da39d200a8c2068595b8d5bd5efb78af4224e1
Author: Matt Caswell <matt at openssl.org>
Date:   Fri Jul 24 08:15:31 2015 +0100

    Initial Async notify code changes
    
    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 at openssl.org>

commit 252d6d3aa62dccf0dc826644b7da0b6bafa3831b
Author: Matt Caswell <matt at openssl.org>
Date:   Wed Jul 22 17:50:51 2015 +0100

    Add ASYNC_JOB pools
    
    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 at openssl.org>

commit 7070e5ca2fa41940d56599bf016a45cb1c0e03f0
Author: Matt Caswell <matt at openssl.org>
Date:   Tue May 5 15:08:39 2015 +0100

    Use longjmp at setjmp where possible
    
    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 at openssl.org>

commit 4cfa6204e8740a3e89b96fac3f1ac49d137e9dc9
Author: Matt Caswell <matt at openssl.org>
Date:   Fri Mar 27 15:20:24 2015 +0000

    Fix s_server -WWW with -async
    
    The s_server option -WWW was not async aware, and therefore was not
    handling SSL_ERROR_WANT_ASYNC conditions. This commit fixes that.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 826760945de655d2d2d387cac3a3646ced80977e
Author: Matt Caswell <matt at openssl.org>
Date:   Thu Mar 26 10:15:59 2015 +0000

    Async clean ups
    
    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 at openssl.org>

commit 06754949e4317f5ba7e318a8841b78a7d622053f
Author: Matt Caswell <matt at openssl.org>
Date:   Wed Mar 25 16:08:44 2015 +0000

    Increase stack size
    
    Some assembler code puts a lot of stuff on the stack, so up the stack size.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 9ec1e03194568630a2e58232d56e9d37dd13ed7d
Author: Matt Caswell <matt at openssl.org>
Date:   Tue Feb 17 14:14:36 2015 +0000

    Add null async implementation
    
    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 at openssl.org>

commit 501083049590455b1862edd7573fd51bb37bb037
Author: Matt Caswell <matt at openssl.org>
Date:   Tue Feb 17 13:30:22 2015 +0000

    Async port to windows
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 38148a234c6ed7a9d78dc5fb3de0ac4d79402e6f
Author: Matt Caswell <matt at openssl.org>
Date:   Tue Feb 17 13:29:01 2015 +0000

    Various windows build fixes to prepare for windows port
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 7e25dd6da17eefb3c0c31ac4ad436b70f6d39f86
Author: Matt Caswell <matt at openssl.org>
Date:   Fri Feb 13 23:33:12 2015 +0000

    Add s_server and s_client async support
    
    A new -async option is added which activates SSL_MODE_ASYNC. Also
    SSL_WANT_ASYNC errors are handled appropriately.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 07bbc92ccb96d48044220d2ed2cf818323baeb26
Author: Matt Caswell <matt at openssl.org>
Date:   Fri Feb 13 23:28:49 2015 +0000

    Make libssl async aware
    
    The following entry points have been made async aware:
    SSL_accept
    SSL_read
    SSL_write
    
    Also added is a new mode - SSL_MODE_ASYNC. Calling the above functions with
    the async mode enabled will initiate a new async job. If an async pause is
    encountered whilst executing the job (such as for example if using SHA1/RSA
    with the Dummy Async engine), then the above functions return with
    SSL_WANT_ASYNC. Calling the functions again (with exactly the same args
    as per non-blocking IO), will resume the job where it left off.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit a14e9ff713cbe7dbbba2aa667466490291cffc68
Author: Matt Caswell <matt at openssl.org>
Date:   Fri Feb 13 23:25:33 2015 +0000

    Add the Dummy Async engine (dasync)
    
    This engine is for developers of async aware applications. It simulates
    asynchronous activity with external hardware. This initial version supports
    SHA1 and RSA. Certain operations using those algorithms have async job
    "pauses" in them - using the new libcrypto async capability.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit a3667c316ae60ef454fb804221c3ca44af30a9aa
Author: Matt Caswell <matt at openssl.org>
Date:   Wed Sep 16 12:28:03 2015 +0100

    Add async sub-library to libcrypto
    
    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 at openssl.org>

-----------------------------------------------------------------------

Summary of changes:
 CHANGES                                            |   10 +
 Makefile.org                                       |    2 +-
 apps/Makefile                                      |   90 +-
 apps/apps.c                                        |   14 +
 apps/apps.h                                        |    1 +
 apps/s_client.c                                    |   29 +
 apps/s_server.c                                    |   86 +-
 crypto/async/Makefile                              |  116 ++
 .../{pkcs7/bio_pk7.c => async/arch/async_null.c}   |   58 +-
 .../cmac.h => crypto/async/arch/async_null.h       |   48 +-
 .../pbelutest.c => crypto/async/arch/async_posix.c |  129 +-
 .../pbelutest.c => crypto/async/arch/async_posix.h |   92 +-
 crypto/async/arch/async_win.c                      |  209 ++++
 crypto/{cmac/cm_ameth.c => async/arch/async_win.h} |   62 +-
 crypto/async/async.c                               |  487 ++++++++
 crypto/{comp/comp_err.c => async/async_err.c}      |   39 +-
 crypto/{conf/conf_mall.c => async/async_locl.h}    |   73 +-
 crypto/ct/Makefile                                 |    3 +-
 crypto/err/Makefile                                |   42 +-
 crypto/err/err.c                                   |    1 +
 crypto/err/err_all.c                               |    2 +
 crypto/err/openssl.ec                              |    1 +
 crypto/rand/md_rand.c                              |   17 +
 doc/apps/s_client.pod                              |    8 +
 doc/apps/s_server.pod                              |    8 +
 doc/crypto/ASYNC_start_job.pod                     |  277 +++++
 doc/ssl/SSL_CTX_set_mode.pod                       |   13 +-
 doc/ssl/SSL_get_async_wait_fd.pod                  |   45 +
 doc/ssl/SSL_get_error.pod                          |   16 +
 engines/Makefile                                   |   24 +-
 engines/e_dasync.c                                 |  334 +++++
 engines/e_dasync.ec                                |    1 +
 engines/{e_ossltest_err.c => e_dasync_err.c}       |  120 +-
 engines/{e_ossltest_err.h => e_dasync_err.h}       |   31 +-
 include/openssl/{comp.h => async.h}                |   88 +-
 include/openssl/engine.h                           |    1 +
 include/openssl/err.h                              |    2 +
 include/openssl/safestack.h                        |   23 +
 include/openssl/ssl.h                              |   20 +-
 ssl/Makefile                                       | 1277 ++++++++++----------
 ssl/ssl_err.c                                      |    3 +
 ssl/ssl_lib.c                                      |  154 ++-
 ssl/ssl_locl.h                                     |    4 +
 test/Makefile                                      |   77 +-
 test/asynctest.c                                   |  299 +++++
 test/recipes/90-test_async.t                       |    5 +
 util/indent.pro                                    |    3 +
 util/libeay.num                                    |   14 +
 util/mkdef.pl                                      |    1 +
 util/mkfiles.pl                                    |    1 +
 util/ssleay.num                                    |    2 +
 51 files changed, 3394 insertions(+), 1068 deletions(-)
 create mode 100644 crypto/async/Makefile
 copy crypto/{pkcs7/bio_pk7.c => async/arch/async_null.c} (78%)
 copy include/openssl/cmac.h => crypto/async/arch/async_null.h (75%)
 copy test/pbelutest.c => crypto/async/arch/async_posix.c (60%)
 copy test/pbelutest.c => crypto/async/arch/async_posix.h (59%)
 create mode 100644 crypto/async/arch/async_win.c
 copy crypto/{cmac/cm_ameth.c => async/arch/async_win.h} (69%)
 create mode 100644 crypto/async/async.c
 copy crypto/{comp/comp_err.c => async/async_err.c} (70%)
 copy crypto/{conf/conf_mall.c => async/async_locl.h} (68%)
 create mode 100644 doc/crypto/ASYNC_start_job.pod
 create mode 100644 doc/ssl/SSL_get_async_wait_fd.pod
 create mode 100644 engines/e_dasync.c
 create mode 100644 engines/e_dasync.ec
 copy engines/{e_ossltest_err.c => e_dasync_err.c} (57%)
 copy engines/{e_ossltest_err.h => e_dasync_err.h} (76%)
 copy include/openssl/{comp.h => async.h} (57%)
 create mode 100644 test/asynctest.c
 create mode 100644 test/recipes/90-test_async.t

diff --git a/CHANGES b/CHANGES
index 17241a5..6b501ee 100644
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,15 @@
 
  Changes between 1.0.2 and 1.1.0  [xx XXX xxxx]
 
+  *) Added ASYNC support. Libcrypto now includes the async sub-library to enable
+     cryptographic operations to be performed asynchronously as long as an
+     asynchronous capable engine is used. See the ASYNC_start_job() man page for
+     further details. Libssl has also had this capability integrated with the
+     introduction of the new mode SSL_MODE_ASYNC and associated error
+     SSL_ERROR_WANT_ASYNC. See the SSL_CTX_set_mode() and SSL_get_error() man
+     pages. This work was developed in partnership with Intel Corp.
+     [Matt Caswell]
+
   *) State machine rewrite. The state machine code has been significantly
      refactored in order to remove much duplication of code and solve issues
      with the old code (see ssl/statem/README for further details). This change
@@ -59,6 +68,7 @@
      though the change is mostly in the more lenient direction, and
      legacy behaviour is preserved as much as possible.
      [Emilia Käsper]
+
   *) Fix no-stdio build.
     [ David Woodhouse <David.Woodhouse at intel.com> and also
       Ivan Nestlerode <ivan.nestlerode at sonos.com> ]
diff --git a/Makefile.org b/Makefile.org
index 629cdae..1c4fd98 100644
--- a/Makefile.org
+++ b/Makefile.org
@@ -143,7 +143,7 @@ SDIRS=  \
 	bn ec rsa dsa ecdsa dh ecdh dso engine \
 	buffer bio stack lhash rand err \
 	evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui \
-	cms pqueue ts jpake srp store cmac ct
+	cms pqueue ts jpake srp store cmac ct async
 # keep in mind that the above list is adjusted by ./Configure
 # according to no-xxx arguments...
 
diff --git a/apps/Makefile b/apps/Makefile
index 932f615..58c3d00 100644
--- a/apps/Makefile
+++ b/apps/Makefile
@@ -780,51 +780,51 @@ s_cb.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
 s_cb.o: ../include/openssl/tls1.h ../include/openssl/txt_db.h
 s_cb.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
 s_cb.o: ../include/openssl/x509v3.h apps.h progs.h s_apps.h s_cb.c
-s_client.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-s_client.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-s_client.o: ../include/openssl/comp.h ../include/openssl/conf.h
-s_client.o: ../include/openssl/crypto.h ../include/openssl/dtls1.h
-s_client.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-s_client.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-s_client.o: ../include/openssl/engine.h ../include/openssl/err.h
-s_client.o: ../include/openssl/evp.h ../include/openssl/hmac.h
-s_client.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-s_client.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
-s_client.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-s_client.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-s_client.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-s_client.o: ../include/openssl/rand.h ../include/openssl/safestack.h
-s_client.o: ../include/openssl/sha.h ../include/openssl/srp.h
-s_client.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
-s_client.o: ../include/openssl/ssl2.h ../include/openssl/ssl3.h
-s_client.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-s_client.o: ../include/openssl/tls1.h ../include/openssl/txt_db.h
-s_client.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-s_client.o: ../include/openssl/x509v3.h apps.h progs.h s_apps.h s_client.c
-s_client.o: timeouts.h
-s_server.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-s_server.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-s_server.o: ../include/openssl/comp.h ../include/openssl/conf.h
-s_server.o: ../include/openssl/crypto.h ../include/openssl/dh.h
-s_server.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
-s_server.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
-s_server.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
-s_server.o: ../include/openssl/err.h ../include/openssl/evp.h
-s_server.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
-s_server.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-s_server.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
-s_server.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-s_server.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-s_server.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
-s_server.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-s_server.o: ../include/openssl/sha.h ../include/openssl/srp.h
-s_server.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
-s_server.o: ../include/openssl/ssl2.h ../include/openssl/ssl3.h
-s_server.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-s_server.o: ../include/openssl/tls1.h ../include/openssl/txt_db.h
-s_server.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-s_server.o: ../include/openssl/x509v3.h apps.h progs.h s_apps.h s_server.c
-s_server.o: timeouts.h
+s_client.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+s_client.o: ../include/openssl/bio.h ../include/openssl/bn.h
+s_client.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+s_client.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+s_client.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+s_client.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+s_client.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
+s_client.o: ../include/openssl/err.h ../include/openssl/evp.h
+s_client.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
+s_client.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+s_client.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
+s_client.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+s_client.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+s_client.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
+s_client.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+s_client.o: ../include/openssl/srp.h ../include/openssl/srtp.h
+s_client.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+s_client.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
+s_client.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
+s_client.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+s_client.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h
+s_client.o: progs.h s_apps.h s_client.c timeouts.h
+s_server.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+s_server.o: ../include/openssl/bio.h ../include/openssl/bn.h
+s_server.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+s_server.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+s_server.o: ../include/openssl/dh.h ../include/openssl/dtls1.h
+s_server.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+s_server.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
+s_server.o: ../include/openssl/engine.h ../include/openssl/err.h
+s_server.o: ../include/openssl/evp.h ../include/openssl/hmac.h
+s_server.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+s_server.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
+s_server.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+s_server.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+s_server.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+s_server.o: ../include/openssl/rand.h ../include/openssl/rsa.h
+s_server.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+s_server.o: ../include/openssl/srp.h ../include/openssl/srtp.h
+s_server.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+s_server.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
+s_server.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
+s_server.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+s_server.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h apps.h
+s_server.o: progs.h s_apps.h s_server.c timeouts.h
 s_socket.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
 s_socket.o: ../include/openssl/buffer.h ../include/openssl/comp.h
 s_socket.o: ../include/openssl/conf.h ../include/openssl/crypto.h
diff --git a/apps/apps.c b/apps/apps.c
index 89f4340..c6b70d6 100644
--- a/apps/apps.c
+++ b/apps/apps.c
@@ -2884,3 +2884,17 @@ BIO *bio_open_default_quiet(const char *filename, char mode, int format)
     return bio_open_default_(filename, mode, format, 1);
 }
 
+void wait_for_async(SSL *s)
+{
+    int width, fd;
+    fd_set asyncfds;
+
+    fd = SSL_get_async_wait_fd(s);
+    if (fd < 0)
+        return;
+
+    width = fd + 1;
+    FD_ZERO(&asyncfds);
+    openssl_fdset(fd, &asyncfds);
+    select(width, (void *)&asyncfds, NULL, NULL, NULL);
+}
diff --git a/apps/apps.h b/apps/apps.h
index 185ac24..e259658 100644
--- a/apps/apps.h
+++ b/apps/apps.h
@@ -162,6 +162,7 @@ CONF *app_load_config(const char *filename);
 CONF *app_load_config_quiet(const char *filename);
 int app_load_modules(const CONF *config);
 void unbuffer(FILE *fp);
+void wait_for_async(SSL *s);
 
 /*
  * Common verification options.
diff --git a/apps/s_client.c b/apps/s_client.c
index 94f2a94..d90124d 100644
--- a/apps/s_client.c
+++ b/apps/s_client.c
@@ -160,6 +160,7 @@ typedef unsigned int u_int;
 #include <openssl/rand.h>
 #include <openssl/ocsp.h>
 #include <openssl/bn.h>
+#include <openssl/async.h>
 #ifndef OPENSSL_NO_SRP
 # include <openssl/srp.h>
 #endif
@@ -182,6 +183,7 @@ extern int verify_error;
 extern int verify_return_error;
 extern int verify_quiet;
 
+static int async = 0;
 static int c_nbio = 0;
 static int c_tlsextdebug = 0;
 static int c_status_req = 0;
@@ -472,6 +474,7 @@ typedef enum OPTION_choice {
     OPT_CHAINCAFILE, OPT_VERIFYCAFILE, OPT_NEXTPROTONEG, OPT_ALPN,
     OPT_SERVERINFO, OPT_STARTTLS, OPT_SERVERNAME, OPT_JPAKE,
     OPT_USE_SRTP, OPT_KEYMATEXPORT, OPT_KEYMATEXPORTLEN, OPT_SMTPHOST,
+    OPT_ASYNC,
     OPT_V_ENUM,
     OPT_X_ENUM,
     OPT_S_ENUM,
@@ -557,6 +560,7 @@ OPTIONS s_client_options[] = {
      "types  Send empty ClientHello extensions (comma-separated numbers)"},
     {"alpn", OPT_ALPN, 's',
      "Enable ALPN extension, considering named protocols supported (comma-separated list)"},
+    {"async", OPT_ASYNC, '-', "Support asynchronous operation"},
     OPT_S_OPTIONS,
     OPT_V_OPTIONS,
     OPT_X_OPTIONS,
@@ -1061,6 +1065,9 @@ int s_client_main(int argc, char **argv)
         case OPT_KEYMATEXPORTLEN:
             keymatexportlen = atoi(opt_arg());
             break;
+        case OPT_ASYNC:
+            async = 1;
+            break;
         }
     }
     argc = opt_num_rest();
@@ -1199,6 +1206,11 @@ int s_client_main(int argc, char **argv)
         goto end;
     }
 
+    if (async) {
+        SSL_CTX_set_mode(ctx, SSL_MODE_ASYNC);
+        ASYNC_init(1, 0, 0);
+    }
+
     if (!config_ctx(cctx, ssl_args, ctx, 1, jpake_secret == NULL))
         goto end;
 
@@ -1883,6 +1895,12 @@ int s_client_main(int argc, char **argv)
                 write_ssl = 1;
                 read_tty = 0;
                 break;
+            case SSL_ERROR_WANT_ASYNC:
+                BIO_printf(bio_c_out, "write A BLOCK\n");
+                wait_for_async(con);
+                write_ssl = 1;
+                read_tty = 0;
+                break;
             case SSL_ERROR_WANT_READ:
                 BIO_printf(bio_c_out, "write R BLOCK\n");
                 write_tty = 0;
@@ -1965,6 +1983,14 @@ int s_client_main(int argc, char **argv)
                 read_ssl = 0;
                 write_tty = 1;
                 break;
+            case SSL_ERROR_WANT_ASYNC:
+                BIO_printf(bio_c_out, "read A BLOCK\n");
+                wait_for_async(con);
+                write_tty = 0;
+                read_ssl = 1;
+                if ((read_tty == 0) && (write_ssl == 0))
+                    write_ssl = 1;
+                break;
             case SSL_ERROR_WANT_WRITE:
                 BIO_printf(bio_c_out, "read W BLOCK\n");
                 write_ssl = 1;
@@ -2075,6 +2101,9 @@ int s_client_main(int argc, char **argv)
             print_stuff(bio_c_out, con, 1);
         SSL_free(con);
     }
+    if (async) {
+        ASYNC_cleanup(1);
+    }
 #if !defined(OPENSSL_NO_NEXTPROTONEG)
     OPENSSL_free(next_proto.data);
 #endif
diff --git a/apps/s_server.c b/apps/s_server.c
index 33f7dc9..fd8035d 100644
--- a/apps/s_server.c
+++ b/apps/s_server.c
@@ -143,6 +143,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <openssl/async.h>
 
 #include <openssl/e_os2.h>
 
@@ -252,6 +253,8 @@ static int s_brief = 0;
 static char *keymatexportlabel = NULL;
 static int keymatexportlen = 20;
 
+static int async = 0;
+
 #ifndef OPENSSL_NO_ENGINE
 static char *engine_id = NULL;
 #endif
@@ -402,6 +405,7 @@ static void s_server_init(void)
     s_msg = 0;
     s_quiet = 0;
     s_brief = 0;
+    async = 0;
 #ifndef OPENSSL_NO_ENGINE
     engine_id = NULL;
 #endif
@@ -805,7 +809,7 @@ typedef enum OPTION_choice {
     OPT_SECURITY_DEBUG, OPT_SECURITY_DEBUG_VERBOSE, OPT_STATE, OPT_CRLF,
     OPT_QUIET, OPT_BRIEF, OPT_NO_TMP_RSA, OPT_NO_DHE, OPT_NO_ECDHE,
     OPT_NO_RESUME_EPHEMERAL, OPT_PSK_HINT, OPT_PSK, OPT_SRPVFILE,
-    OPT_SRPUSERSEED, OPT_REV, OPT_WWW, OPT_UPPER_WWW, OPT_HTTP,
+    OPT_SRPUSERSEED, OPT_REV, OPT_WWW, OPT_UPPER_WWW, OPT_HTTP, OPT_ASYNC,
     OPT_SSL3,
     OPT_TLS1_2, OPT_TLS1_1, OPT_TLS1, OPT_DTLS, OPT_DTLS1,
     OPT_DTLS1_2, OPT_TIMEOUT, OPT_MTU, OPT_CHAIN, OPT_LISTEN,
@@ -914,6 +918,7 @@ OPTIONS s_server_options[] = {
     {"security_debug_verbose", OPT_SECURITY_DEBUG_VERBOSE, '-'},
     {"brief", OPT_BRIEF, '-'},
     {"rev", OPT_REV, '-'},
+    {"async", OPT_ASYNC, '-', "Operate in asynchronous mode"},
     OPT_S_OPTIONS,
     OPT_V_OPTIONS,
     OPT_X_OPTIONS,
@@ -1438,6 +1443,9 @@ int s_server_main(int argc, char *argv[])
         case OPT_KEYMATEXPORTLEN:
             keymatexportlen = atoi(opt_arg());
             break;
+        case OPT_ASYNC:
+            async = 1;
+            break;
         }
     }
     argc = opt_num_rest();
@@ -1650,6 +1658,11 @@ int s_server_main(int argc, char *argv[])
     else
         SSL_CTX_sess_set_cache_size(ctx, 128);
 
+    if (async) {
+        SSL_CTX_set_mode(ctx, SSL_MODE_ASYNC);
+        ASYNC_init(1, 0, 0);
+    }
+
 #ifndef OPENSSL_NO_SRTP
     if (srtp_profiles != NULL) {
         /* Returns 0 on success! */
@@ -1721,6 +1734,9 @@ int s_server_main(int argc, char *argv[])
         else
             SSL_CTX_sess_set_cache_size(ctx2, 128);
 
+        if (async)
+            SSL_CTX_set_mode(ctx2, SSL_MODE_ASYNC);
+
         if ((!SSL_CTX_load_verify_locations(ctx2, CAfile, CApath)) ||
             (!SSL_CTX_set_default_verify_paths(ctx2))) {
             ERR_print_errors(bio_err);
@@ -1957,6 +1973,9 @@ int s_server_main(int argc, char *argv[])
     bio_s_out = NULL;
     BIO_free(bio_s_msg);
     bio_s_msg = NULL;
+    if (async) {
+        ASYNC_cleanup(1);
+    }
     return (ret);
 }
 
@@ -2117,7 +2136,8 @@ static int sv_body(char *hostname, int s, int stype, unsigned char *context)
         int read_from_sslcon;
 
         read_from_terminal = 0;
-        read_from_sslcon = SSL_pending(con);
+        read_from_sslcon = SSL_pending(con)
+                           || (async && SSL_waiting_for_async(con));
 
         if (!read_from_sslcon) {
             FD_ZERO(&readfds);
@@ -2281,6 +2301,10 @@ static int sv_body(char *hostname, int s, int stype, unsigned char *context)
                 switch (SSL_get_error(con, k)) {
                 case SSL_ERROR_NONE:
                     break;
+                case SSL_ERROR_WANT_ASYNC:
+                    BIO_printf(bio_s_out, "Write BLOCK (Async)\n");
+                    wait_for_async(con);
+                    break;
                 case SSL_ERROR_WANT_WRITE:
                 case SSL_ERROR_WANT_READ:
                 case SSL_ERROR_WANT_X509_LOOKUP:
@@ -2309,7 +2333,13 @@ static int sv_body(char *hostname, int s, int stype, unsigned char *context)
             }
         }
         if (read_from_sslcon) {
-            if (!SSL_is_init_finished(con)) {
+            /*
+             * init_ssl_connection handles all async events itself so if we're
+             * waiting for async then we shouldn't go back into
+             * init_ssl_connection
+             */
+            if ((!async || !SSL_waiting_for_async(con))
+                    && !SSL_is_init_finished(con)) {
                 i = init_ssl_connection(con);
 
                 if (i < 0) {
@@ -2345,6 +2375,10 @@ static int sv_body(char *hostname, int s, int stype, unsigned char *context)
                     if (SSL_pending(con))
                         goto again;
                     break;
+                case SSL_ERROR_WANT_ASYNC:
+                    BIO_printf(bio_s_out, "Read BLOCK (Async)\n");
+                    wait_for_async(con);
+                    break;
                 case SSL_ERROR_WANT_WRITE:
                 case SSL_ERROR_WANT_READ:
                     BIO_printf(bio_s_out, "Read BLOCK\n");
@@ -2423,33 +2457,37 @@ static int init_ssl_connection(SSL *con)
         }
     } else
 #endif
+
+    do {
         i = SSL_accept(con);
 
 #ifdef CERT_CB_TEST_RETRY
-    {
-        while (i <= 0 && SSL_get_error(con, i) == SSL_ERROR_WANT_X509_LOOKUP
-               && SSL_get_state(con) == TLS_ST_SR_CLNT_HELLO) {
-            BIO_printf(bio_err,
+        {
+            while (i <= 0 && SSL_get_error(con, i) == SSL_ERROR_WANT_X509_LOOKUP
+                    && SSL_get_state(con) == TLS_ST_SR_CLNT_HELLO) {
+                BIO_printf(bio_err,
                        "LOOKUP from certificate callback during accept\n");
-            i = SSL_accept(con);
+                i = SSL_accept(con);
+            }
         }
-    }
 #endif
+
 #ifndef OPENSSL_NO_SRP
-    while (i <= 0 && SSL_get_error(con, i) == SSL_ERROR_WANT_X509_LOOKUP) {
-        BIO_printf(bio_s_out, "LOOKUP during accept %s\n",
-                   srp_callback_parm.login);
-        srp_callback_parm.user =
-            SRP_VBASE_get_by_user(srp_callback_parm.vb,
-                                  srp_callback_parm.login);
-        if (srp_callback_parm.user)
-            BIO_printf(bio_s_out, "LOOKUP done %s\n",
-                       srp_callback_parm.user->info);
-        else
-            BIO_printf(bio_s_out, "LOOKUP not successful\n");
-        i = SSL_accept(con);
-    }
+        while (i <= 0 && SSL_get_error(con, i) == SSL_ERROR_WANT_X509_LOOKUP) {
+            BIO_printf(bio_s_out, "LOOKUP during accept %s\n",
+                       srp_callback_parm.login);
+            srp_callback_parm.user =
+                SRP_VBASE_get_by_user(srp_callback_parm.vb,
+                                      srp_callback_parm.login);
+            if (srp_callback_parm.user)
+                BIO_printf(bio_s_out, "LOOKUP done %s\n",
+                           srp_callback_parm.user->info);
+            else
+                BIO_printf(bio_s_out, "LOOKUP not successful\n");
+            i = SSL_accept(con);
+        }
 #endif
+    } while (i < 0 && SSL_waiting_for_async(con));
 
     if (i <= 0) {
         if ((dtlslisten && i == 0)
@@ -2641,7 +2679,7 @@ static int www_body(char *hostname, int s, int stype, unsigned char *context)
     for (;;) {
         i = BIO_gets(io, buf, bufsize - 1);
         if (i < 0) {            /* error */
-            if (!BIO_should_retry(io)) {
+            if (!BIO_should_retry(io) && !SSL_waiting_for_async(con)) {
                 if (!s_quiet)
                     ERR_print_errors(bio_err);
                 goto err;
@@ -2908,7 +2946,7 @@ static int www_body(char *hostname, int s, int stype, unsigned char *context)
 #endif
                     k = BIO_write(io, &(buf[j]), i - j);
                     if (k <= 0) {
-                        if (!BIO_should_retry(io))
+                        if (!BIO_should_retry(io)  && !SSL_waiting_for_async(con))
                             goto write_error;
                         else {
                             BIO_printf(bio_s_out, "rwrite W BLOCK\n");
diff --git a/crypto/async/Makefile b/crypto/async/Makefile
new file mode 100644
index 0000000..2589b1a
--- /dev/null
+++ b/crypto/async/Makefile
@@ -0,0 +1,116 @@
+#
+# OpenSSL/crypto/async/Makefile
+#
+
+DIR=	async
+TOP=	../..
+CC=	cc
+INCLUDES=
+CFLAG=-g
+MAKEFILE=	Makefile
+AR=		ar r
+
+CFLAGS= $(INCLUDES) $(CFLAG)
+
+GENERAL=Makefile
+TEST=
+APPS=
+
+LIB=$(TOP)/libcrypto.a
+LIBSRC=async.c async_err.c arch/async_posix.c arch/async_win.c arch/async_null.c
+LIBOBJ=async.o async_err.o arch/async_posix.o arch/async_win.o arch/async_null.o
+
+SRC= $(LIBSRC)
+
+HEADER=	async_locl.h arch/async_posix.h arch/async_win.h arch/async_null.h
+
+ALL=    $(GENERAL) $(SRC) $(HEADER)
+
+top:
+	(cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
+
+all:	lib
+
+lib:	$(LIBOBJ)
+	$(AR) $(LIB) $(LIBOBJ)
+	$(RANLIB) $(LIB) || echo Never mind.
+	@touch lib
+
+files:
+	$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
+
+links:
+	@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
+	@$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
+	@$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
+
+install:
+	@[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
+	@headerlist="$(EXHEADER)"; for i in $$headerlist ; \
+	do  \
+	(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+	chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
+	done;
+
+tags:
+	ctags $(SRC)
+
+tests:
+
+lint:
+	lint -DLINT $(INCLUDES) $(SRC)>fluff
+
+update: depend
+
+depend:
+	@[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
+	$(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
+
+dclean:
+	$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
+	mv -f Makefile.new $(MAKEFILE)
+
+clean:
+	rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
+	rm -f arch/*.o arch/*.obj arch/lib arch/tags arch/core arch/.pure arch/.nfs* arch/*.old arch/*.bak arch/fluff
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.
+
+arch/async_null.o: ../../e_os.h ../../include/openssl/async.h
+arch/async_null.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+arch/async_null.o: ../../include/openssl/opensslconf.h
+arch/async_null.o: ../../include/openssl/opensslv.h
+arch/async_null.o: ../../include/openssl/ossl_typ.h
+arch/async_null.o: ../../include/openssl/safestack.h
+arch/async_null.o: ../../include/openssl/stack.h
+arch/async_null.o: ../../include/openssl/symhacks.h arch/../arch/async_null.h
+arch/async_null.o: arch/../arch/async_posix.h arch/../arch/async_win.h
+arch/async_null.o: arch/../async_locl.h arch/async_null.c
+arch/async_posix.o: ../../e_os.h ../../include/openssl/async.h
+arch/async_posix.o: ../../include/openssl/crypto.h
+arch/async_posix.o: ../../include/openssl/e_os2.h
+arch/async_posix.o: ../../include/openssl/opensslconf.h
+arch/async_posix.o: ../../include/openssl/opensslv.h
+arch/async_posix.o: ../../include/openssl/ossl_typ.h
+arch/async_posix.o: ../../include/openssl/safestack.h
+arch/async_posix.o: ../../include/openssl/stack.h
+arch/async_posix.o: ../../include/openssl/symhacks.h arch/../arch/async_null.h
+arch/async_posix.o: arch/../arch/async_posix.h arch/../arch/async_win.h
+arch/async_posix.o: arch/../async_locl.h arch/async_posix.c
+arch/async_win.o: ../../include/openssl/async.h arch/async_win.c
+arch/async_win.o: arch/async_win.h
+async.o: ../../e_os.h ../../include/openssl/async.h ../../include/openssl/bio.h
+async.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+async.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
+async.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
+async.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
+async.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+async.o: arch/async_null.h arch/async_posix.h arch/async_win.h async.c
+async.o: async_locl.h
+async_err.o: ../../include/openssl/async.h ../../include/openssl/bio.h
+async_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+async_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
+async_err.o: ../../include/openssl/opensslconf.h
+async_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+async_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+async_err.o: ../../include/openssl/symhacks.h async_err.c
diff --git a/crypto/pkcs7/bio_pk7.c b/crypto/async/arch/async_null.c
similarity index 78%
copy from crypto/pkcs7/bio_pk7.c
copy to crypto/async/arch/async_null.c
index 31aef83..b2dbfee 100644
--- a/crypto/pkcs7/bio_pk7.c
+++ b/crypto/async/arch/async_null.c
@@ -1,10 +1,9 @@
-/* bio_pk7.c */
+/* crypto/async/arch/async_null.c */
 /*
- * Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
- * project.
+ * Written by Matt Caswell (matt at openssl.org) for the OpenSSL project.
  */
 /* ====================================================================
- * Copyright (c) 2008 The OpenSSL Project.  All rights reserved.
+ * Copyright (c) 2015 The OpenSSL Project.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -50,21 +49,50 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  * OF THE POSSIBILITY OF SUCH DAMAGE.
  * ====================================================================
- *
  */
 
-#include <openssl/asn1.h>
-#include <openssl/pkcs7.h>
-#include <openssl/bio.h>
+#include "../async_locl.h"
+#include <openssl/async.h>
 
-#if !defined(OPENSSL_SYS_NETWARE) && !defined(OPENSSL_SYS_VXWORKS)
-# include <memory.h>
-#endif
-#include <stdio.h>
+#ifdef ASYNC_NULL
 
-/* Streaming encode support for PKCS#7 */
+int async_pipe(OSSL_ASYNC_FD *pipefds)
+{
+    return -1;
+}
+
+int async_close_fd(OSSL_ASYNC_FD fd)
+{
+    return 0;
+}
+
+int async_write1(OSSL_ASYNC_FD fd, const void *buf)
+{
+    return -1;
+}
+
+int async_read1(OSSL_ASYNC_FD fd, void *buf)
+{
+    return -1;
+}
 
-BIO *BIO_new_PKCS7(BIO *out, PKCS7 *p7)
+int async_global_init(void)
 {
-    return BIO_new_NDEF(out, (ASN1_VALUE *)p7, ASN1_ITEM_rptr(PKCS7));
+    return 0;
 }
+
+int async_local_init(void)
+{
+    return 0;
+}
+
+void async_local_cleanup(void)
+{
+}
+
+void async_global_cleanup(void)
+{
+}
+
+#endif
+
diff --git a/include/openssl/cmac.h b/crypto/async/arch/async_null.h
similarity index 75%
copy from include/openssl/cmac.h
copy to crypto/async/arch/async_null.h
index 175be83..684e373 100644
--- a/include/openssl/cmac.h
+++ b/crypto/async/arch/async_null.h
@@ -1,10 +1,9 @@
-/* crypto/cmac/cmac.h */
+/* crypto/async/arch/async_null.h */
 /*
- * Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL
- * project.
+ * Written by Matt Caswell (matt at openssl.org) for the OpenSSL project.
  */
 /* ====================================================================
- * Copyright (c) 2010 The OpenSSL Project.  All rights reserved.
+ * Copyright (c) 2015 The OpenSSL Project.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -52,31 +51,28 @@
  * ====================================================================
  */
 
-#ifndef HEADER_CMAC_H
-# define HEADER_CMAC_H
+#include <openssl/async.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-# include <openssl/evp.h>
+/*
+ * If we haven't managed to detect any other async architecture then we default
+ * to NULL.
+ */
+#ifndef ASYNC_ARCH
+# define ASYNC_NULL
+# define ASYNC_ARCH
 
-/* Opaque */
-typedef struct CMAC_CTX_st CMAC_CTX;
+typedef struct async_fibre_st {
+    int dummy;
+} async_fibre;
 
-CMAC_CTX *CMAC_CTX_new(void);
-void CMAC_CTX_cleanup(CMAC_CTX *ctx);
-void CMAC_CTX_free(CMAC_CTX *ctx);
-EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx);
-int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in);
 
-int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen,
-              const EVP_CIPHER *cipher, ENGINE *impl);
-int CMAC_Update(CMAC_CTX *ctx, const void *data, size_t dlen);
-int CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen);
-int CMAC_resume(CMAC_CTX *ctx);
+# define async_set_ctx(nctx)                    0
+# define async_get_ctx()                        ((async_ctx *)NULL)
+# define async_fibre_swapcontext(o,n,r)         0
+# define async_fibre_makecontext(c)
+# define async_fibre_free(f)
+# define async_fibre_init_dispatcher(f)
+# define async_get_pool()                       NULL
+# define async_set_pool(p)                      0
 
-#ifdef  __cplusplus
-}
-#endif
 #endif
diff --git a/test/pbelutest.c b/crypto/async/arch/async_posix.c
similarity index 60%
copy from test/pbelutest.c
copy to crypto/async/arch/async_posix.c
index dafae78..77a2c33 100644
--- a/test/pbelutest.c
+++ b/crypto/async/arch/async_posix.c
@@ -1,3 +1,7 @@
+/* crypto/async/arch/async_posix.c */
+/*
+ * Written by Matt Caswell (matt at openssl.org) for the OpenSSL project.
+ */
 /* ====================================================================
  * Copyright (c) 2015 The OpenSSL Project.  All rights reserved.
  *
@@ -45,48 +49,101 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  * OF THE POSSIBILITY OF SUCH DAMAGE.
  * ====================================================================
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com).  This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
  */
 
-#include <openssl/evp.h>
-#include <stdio.h>
-#include <string.h>
+#include "../async_locl.h"
+#include <openssl/async.h>
 
-/*
- * Password based encryption (PBE) table ordering test.
- * Attempt to look up all supported algorithms.
- */
+#ifdef ASYNC_POSIX
+# include <stddef.h>
+# include <ucontext.h>
+# include <unistd.h>
+# include <openssl/crypto.h>
+# include <openssl/async.h>
+
+pthread_key_t posixctx;
+pthread_key_t posixpool;
 
-int main(int argc, char **argv)
+#define STACKSIZE       32768
+
+int async_global_init(void)
 {
-    size_t i;
-    int rv = 0;
-    int pbe_type, pbe_nid;
-    int last_type = -1, last_nid = -1;
-    for (i = 0; EVP_PBE_get(&pbe_type, &pbe_nid, i) != 0; i++) {
-        if (EVP_PBE_find(pbe_type, pbe_nid, NULL, NULL, 0) == 0) {
-            rv = 1;
-            break;
-        }
-    }
-    if (rv == 0)
+    if (pthread_key_create(&posixctx, NULL) != 0
+            || pthread_key_create(&posixpool, NULL) != 0)
+        return 0;
+
+    return 1;
+}
+
+int async_local_init(void)
+{
+    if (!async_set_ctx(NULL) || ! async_set_pool(NULL))
+        return 0;
+
+    return 1;
+}
+
+void async_local_cleanup(void)
+{
+}
+
+void async_global_cleanup(void)
+{
+}
+
+int async_fibre_init(async_fibre *fibre)
+{
+    void *stack = NULL;
+
+    stack = OPENSSL_malloc(STACKSIZE);
+    if (stack == NULL) {
         return 0;
-    /* Error: print out whole table */
-    for (i = 0; EVP_PBE_get(&pbe_type, &pbe_nid, i) != 0; i++) {
-        if (pbe_type > last_type)
-            rv = 0;
-        else if (pbe_type < last_type || pbe_nid < last_nid)
-            rv = 1;
-        else
-            rv = 0;
-        fprintf(stderr, "PBE type=%d %d (%s): %s\n", pbe_type, pbe_nid,
-                OBJ_nid2sn(pbe_nid), rv ? "ERROR" : "OK");
-        last_type = pbe_type;
-        last_nid = pbe_nid;
     }
+
+    fibre->fibre.uc_stack.ss_sp = stack;
+    fibre->fibre.uc_stack.ss_size = STACKSIZE;
+    fibre->fibre.uc_link = NULL;
+    fibre->env_init = 0;
+
+    return 1;
+}
+
+void async_fibre_free(async_fibre *fibre)
+{
+    if (fibre->fibre.uc_stack.ss_sp)
+        OPENSSL_free(fibre->fibre.uc_stack.ss_sp);
+}
+
+int async_pipe(OSSL_ASYNC_FD *pipefds)
+{
+    if (pipe(pipefds) == 0)
+        return 1;
+
+    return 0;
+}
+
+int async_close_fd(OSSL_ASYNC_FD fd)
+{
+    if (close(fd) != 0)
+        return 0;
+
     return 1;
 }
+
+int async_write1(OSSL_ASYNC_FD fd, const void *buf)
+{
+    if (write(fd, buf, 1) > 0)
+        return 1;
+
+    return 0;
+}
+
+int async_read1(OSSL_ASYNC_FD fd, void *buf)
+{
+    if (read(fd, buf, 1) > 0)
+        return 1;
+
+    return 0;
+}
+
+#endif
diff --git a/test/pbelutest.c b/crypto/async/arch/async_posix.h
similarity index 59%
copy from test/pbelutest.c
copy to crypto/async/arch/async_posix.h
index dafae78..36fae24 100644
--- a/test/pbelutest.c
+++ b/crypto/async/arch/async_posix.h
@@ -1,3 +1,7 @@
+/* crypto/async/arch/async_posix.h */
+/*
+ * Written by Matt Caswell (matt at openssl.org) for the OpenSSL project.
+ */
 /* ====================================================================
  * Copyright (c) 2015 The OpenSSL Project.  All rights reserved.
  *
@@ -45,48 +49,68 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  * OF THE POSSIBILITY OF SUCH DAMAGE.
  * ====================================================================
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com).  This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
  */
+#include <openssl/e_os2.h>
+
+#if defined(OPENSSL_SYS_UNIX) && defined(OPENSSL_THREADS)
 
-#include <openssl/evp.h>
-#include <stdio.h>
-#include <string.h>
+# include <unistd.h>
+
+# if _POSIX_VERSION >= 200112L
+
+# include <pthread.h>
+
+#  define ASYNC_POSIX
+#  define ASYNC_ARCH
 
 /*
- * Password based encryption (PBE) table ordering test.
- * Attempt to look up all supported algorithms.
+ * Some platforms complain (e.g. OS-X) that setcontext/getcontext/makecontext
+ * are deprecated without the following defined. We know its deprecated but
+ * there is no alternative.
  */
+#  define _XOPEN_SOURCE
+#  pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
+#  include <ucontext.h>
+#  include <setjmp.h>
+#  include "e_os.h"
 
-int main(int argc, char **argv)
+extern pthread_key_t posixctx;
+extern pthread_key_t posixpool;
+
+typedef struct async_fibre_st {
+    ucontext_t fibre;
+    jmp_buf env;
+    int env_init;
+} async_fibre;
+
+#  define async_set_ctx(nctx)  (pthread_setspecific(posixctx , (nctx)) == 0)
+#  define async_get_ctx()      ((async_ctx *)pthread_getspecific(posixctx))
+#  define async_set_pool(p)    (pthread_setspecific(posixpool , (p)) == 0)
+#  define async_get_pool()     ((async_pool *)pthread_getspecific(posixpool))
+
+static inline int async_fibre_swapcontext(async_fibre *o, async_fibre *n, int r)
 {
-    size_t i;
-    int rv = 0;
-    int pbe_type, pbe_nid;
-    int last_type = -1, last_nid = -1;
-    for (i = 0; EVP_PBE_get(&pbe_type, &pbe_nid, i) != 0; i++) {
-        if (EVP_PBE_find(pbe_type, pbe_nid, NULL, NULL, 0) == 0) {
-            rv = 1;
-            break;
-        }
-    }
-    if (rv == 0)
-        return 0;
-    /* Error: print out whole table */
-    for (i = 0; EVP_PBE_get(&pbe_type, &pbe_nid, i) != 0; i++) {
-        if (pbe_type > last_type)
-            rv = 0;
-        else if (pbe_type < last_type || pbe_nid < last_nid)
-            rv = 1;
+    o->env_init = 1;
+
+    if (!r || !_setjmp(o->env)) {
+        if (n->env_init)
+            _longjmp(n->env, 1);
         else
-            rv = 0;
-        fprintf(stderr, "PBE type=%d %d (%s): %s\n", pbe_type, pbe_nid,
-                OBJ_nid2sn(pbe_nid), rv ? "ERROR" : "OK");
-        last_type = pbe_type;
-        last_nid = pbe_nid;
+            setcontext(&n->fibre);
     }
+
     return 1;
 }
+
+#  define async_fibre_makecontext(c) \
+            (!getcontext(&(c)->fibre) \
+            && async_fibre_init(c) \
+            && (makecontext(&(c)->fibre, async_start_func, 0), 1))
+#  define async_fibre_init_dispatcher(d)
+
+int async_fibre_init(async_fibre *fibre);
+void async_fibre_free(async_fibre *fibre);
+
+# endif
+#endif
diff --git a/crypto/async/arch/async_win.c b/crypto/async/arch/async_win.c
new file mode 100644
index 0000000..20c8a09
--- /dev/null
+++ b/crypto/async/arch/async_win.c
@@ -0,0 +1,209 @@
+/* crypto/async/arch/async_win.c */
+/*
+ * Written by Matt Caswell (matt at openssl.org) for the OpenSSL project.
+ */
+/* ====================================================================
+ * Copyright (c) 2015 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ */
+
+#include "../async_locl.h"
+
+#ifdef ASYNC_WIN
+
+# include <windows.h>
+# include "internal/cryptlib.h"
+
+struct winpool {
+    STACK_OF(ASYNC_JOB) *pool;
+    size_t curr_size;
+    size_t max_size;
+};
+
+static DWORD asyncwinpool = 0;
+static DWORD asyncwinctx = 0;
+static DWORD asyncwindispatch = 0;
+
+
+void async_start_func(void);
+
+int async_global_init(void)
+{
+    asyncwinpool = TlsAlloc();
+    asyncwinctx = TlsAlloc();
+    asyncwindispatch = TlsAlloc();
+    if (asyncwinpool == TLS_OUT_OF_INDEXES || asyncwinctx == TLS_OUT_OF_INDEXES
+            || asyncwindispatch == TLS_OUT_OF_INDEXES) {
+        if (asyncwinpool != TLS_OUT_OF_INDEXES) {
+            TlsFree(asyncwinpool);
+        }
+        if (asyncwinctx != TLS_OUT_OF_INDEXES) {
+            TlsFree(asyncwinctx);
+        }
+        if (asyncwindispatch != TLS_OUT_OF_INDEXES) {
+            TlsFree(asyncwindispatch);
+        }
+        return 0;
+    }
+    return 1;
+}
+
+int async_local_init(void)
+{
+    return (TlsSetValue(asyncwinpool, NULL) != 0)
+        && (TlsSetValue(asyncwinctx, NULL) != 0)
+        && (TlsSetValue(asyncwindispatch, NULL) != 0);
+}
+
+void async_local_cleanup(void)
+{
+    async_ctx *ctx = async_get_ctx();
+    if (ctx != NULL) {
+        async_fibre *fibre = &ctx->dispatcher;
+        if(fibre != NULL && fibre->fibre != NULL && fibre->converted) {
+            ConvertFiberToThread();
+            fibre->fibre = NULL;
+        }
+    }
+}
+
+void async_global_cleanup(void)
+{
+    TlsFree(asyncwinpool);
+    TlsFree(asyncwinctx);
+    TlsFree(asyncwindispatch);
+    asyncwinpool = 0;
+    asyncwinctx = 0;
+    asyncwindispatch = 0;
+}
+
+int async_fibre_init_dispatcher(async_fibre *fibre)
+{
+    LPVOID dispatcher;
+
+    dispatcher = (LPVOID)TlsGetValue(asyncwindispatch);
+    if (dispatcher == NULL) {
+        fibre->fibre = ConvertThreadToFiber(NULL);
+        if (fibre->fibre == NULL) {
+            fibre->converted = 0;
+            fibre->fibre = GetCurrentFiber();
+            if (fibre->fibre == NULL)
+                return 0;
+        } else {
+            fibre->converted = 1;
+        }
+        if (TlsSetValue(asyncwindispatch, (LPVOID)fibre->fibre) == 0)
+            return 0;
+    } else {
+        fibre->fibre = dispatcher;
+    }
+    return 1;
+}
+
+VOID CALLBACK async_start_func_win(PVOID unused)
+{
+    async_start_func();
+}
+
+int async_pipe(OSSL_ASYNC_FD *pipefds)
+{
+    if (CreatePipe(&pipefds[0], &pipefds[1], NULL, 256) == 0)
+        return 0;
+
+    return 1;
+}
+
+int async_close_fd(OSSL_ASYNC_FD fd)
+{
+    if (CloseHandle(fd) == 0)
+        return 0;
+
+    return 1;
+}
+
+int async_write1(OSSL_ASYNC_FD fd, const void *buf)
+{
+    DWORD numwritten = 0;
+
+    if (WriteFile(fd, buf, 1, &numwritten, NULL) && numwritten == 1)
+        return 1;
+
+    return 0;
+}
+
+int async_read1(OSSL_ASYNC_FD fd, void *buf)
+{
+    DWORD numread = 0;
+
+    if (ReadFile(fd, buf, 1, &numread, NULL) && numread == 1)
+        return 1;
+
+    return 0;
+}
+
+async_pool *async_get_pool(void)
+{
+    return (async_pool *)TlsGetValue(asyncwinpool);
+}
+
+
+int async_set_pool(async_pool *pool)
+{
+    return TlsSetValue(asyncwinpool, (LPVOID)pool) != 0;
+}
+
+async_ctx *async_get_ctx(void)
+{
+    return (async_ctx *)TlsGetValue(asyncwinctx);
+}
+
+int async_set_ctx(async_ctx *ctx)
+{
+    return TlsSetValue(asyncwinctx, (LPVOID)ctx) != 0;
+}
+
+#endif
diff --git a/crypto/cmac/cm_ameth.c b/crypto/async/arch/async_win.h
similarity index 69%
copy from crypto/cmac/cm_ameth.c
copy to crypto/async/arch/async_win.h
index 223631c..77e41e4 100644
--- a/crypto/cmac/cm_ameth.c
+++ b/crypto/async/arch/async_win.h
@@ -1,9 +1,9 @@
+/* crypto/async/arch/async_win.h */
 /*
- * Written by Dr Stephen N Henson (steve at openssl.org) for the OpenSSL project
- * 2010.
+ * Written by Matt Caswell (matt at openssl.org) for the OpenSSL project.
  */
 /* ====================================================================
- * Copyright (c) 2010 The OpenSSL Project.  All rights reserved.
+ * Copyright (c) 2015 The OpenSSL Project.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -51,45 +51,37 @@
  * ====================================================================
  */
 
-#include <stdio.h>
-#include "internal/cryptlib.h"
-#include <openssl/evp.h>
-#include <openssl/cmac.h>
-#include "internal/asn1_int.h"
+#include <openssl/async.h>
 
 /*
- * CMAC "ASN1" method. This is just here to indicate the maximum CMAC output
- * length and to free up a CMAC key.
+ * This is the same detection used in cryptlib to set up the thread local
+ * storage that we depend on, so just copy that
  */
+#if defined(_WIN32) || defined(__CYGWIN__)
+# define ASYNC_WIN
+# define ASYNC_ARCH
 
-static int cmac_size(const EVP_PKEY *pkey)
-{
-    return EVP_MAX_BLOCK_LENGTH;
-}
+# include <windows.h>
+# include "internal/cryptlib.h"
 
-static void cmac_key_free(EVP_PKEY *pkey)
-{
-    CMAC_CTX *cmctx = (CMAC_CTX *)pkey->pkey.ptr;
-    CMAC_CTX_free(cmctx);
-}
+typedef struct async_fibre_st {
+    LPVOID fibre;
+    int converted;
+} async_fibre;
 
-const EVP_PKEY_ASN1_METHOD cmac_asn1_meth = {
-    EVP_PKEY_CMAC,
-    EVP_PKEY_CMAC,
-    0,
+# define async_fibre_swapcontext(o,n,r) \
+        (SwitchToFiber((n)->fibre), 1)
+# define async_fibre_makecontext(c) \
+        ((c)->fibre = CreateFiber(0, async_start_func_win, 0))
+# define async_fibre_free(f)             (DeleteFiber((f)->fibre))
 
-    "CMAC",
-    "OpenSSL CMAC method",
+async_ctx *async_get_ctx(void);
+int async_set_ctx(async_ctx *ctx);
 
-    0, 0, 0, 0,
+int async_fibre_init_dispatcher(async_fibre *fibre);
+VOID CALLBACK async_start_func_win(PVOID unused);
 
-    0, 0, 0,
+async_pool *async_get_pool(void);
+int async_set_pool(async_pool *pool);
 
-    cmac_size,
-    0, 0,
-    0, 0, 0, 0, 0, 0, 0,
-
-    cmac_key_free,
-    0,
-    0, 0
-};
+#endif
diff --git a/crypto/async/async.c b/crypto/async/async.c
new file mode 100644
index 0000000..5664d99
--- /dev/null
+++ b/crypto/async/async.c
@@ -0,0 +1,487 @@
+/* crypto/async/async.c */
+/*
+ * Written by Matt Caswell (matt at openssl.org) for the OpenSSL project.
+ */
+/* ====================================================================
+ * Copyright (c) 2015 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ */
+
+/*
+ * Without this we start getting longjmp crashes because it thinks we're jumping
+ * up the stack when in fact we are jumping to an entirely different stack. The
+ * cost of this is not having certain buffer overrun/underrun checks etc for
+ * this source file :-(
+ */
+#undef _FORTIFY_SOURCE
+
+#include <openssl/err.h>
+#include <openssl/async.h>
+#include <string.h>
+#include "async_locl.h"
+
+#define ASYNC_JOB_RUNNING   0
+#define ASYNC_JOB_PAUSING   1
+#define ASYNC_JOB_PAUSED    2
+#define ASYNC_JOB_STOPPING  3
+
+static void async_free_pool_internal(async_pool *pool);
+
+static async_ctx *async_ctx_new(void)
+{
+    async_ctx *nctx = NULL;
+
+    nctx = OPENSSL_malloc(sizeof (async_ctx));
+    if (nctx == NULL) {
+        ASYNCerr(ASYNC_F_ASYNC_CTX_NEW, ERR_R_MALLOC_FAILURE);
+        goto err;
+    }
+
+    async_fibre_init_dispatcher(&nctx->dispatcher);
+    nctx->currjob = NULL;
+    nctx->blocked = 0;
+    if (!async_set_ctx(nctx))
+        goto err;
+
+    return nctx;
+err:
+    OPENSSL_free(nctx);
+
+    return NULL;
+}
+
+static int async_ctx_free(void)
+{
+    async_ctx *ctx;
+
+    ctx = async_get_ctx();
+
+    if (!async_set_ctx(NULL))
+        return 0;
+
+    OPENSSL_free(ctx);
+
+    return 1;
+}
+
+static ASYNC_JOB *async_job_new(void)
+{
+    ASYNC_JOB *job = NULL;
+    OSSL_ASYNC_FD pipefds[2];
+
+    job = OPENSSL_malloc(sizeof (ASYNC_JOB));
+    if (job == NULL) {
+        ASYNCerr(ASYNC_F_ASYNC_JOB_NEW, ERR_R_MALLOC_FAILURE);
+        return NULL;
+    }
+
+    if (!async_pipe(pipefds)) {
+        OPENSSL_free(job);
+        ASYNCerr(ASYNC_F_ASYNC_JOB_NEW, ASYNC_R_CANNOT_CREATE_WAIT_PIPE);
+        return NULL;
+    }
+
+    job->wake_set = 0;
+    job->wait_fd = pipefds[0];
+    job->wake_fd = pipefds[1];
+
+    job->status = ASYNC_JOB_RUNNING;
+    job->funcargs = NULL;
+
+    return job;
+}
+
+static void async_job_free(ASYNC_JOB *job)
+{
+    if (job != NULL) {
+        OPENSSL_free(job->funcargs);
+        async_fibre_free(&job->fibrectx);
+        async_close_fd(job->wait_fd);
+        async_close_fd(job->wake_fd);
+        OPENSSL_free(job);
+    }
+}
+
+static ASYNC_JOB *async_get_pool_job(void) {
+    ASYNC_JOB *job;
+    async_pool *pool;
+
+    pool = async_get_pool();
+    if (pool == NULL) {
+        /*
+         * Pool has not been initialised, so init with the defaults, i.e.
+         * no max size and no pre-created jobs
+         */
+        if (ASYNC_init_thread(0, 0) == 0)
+            return NULL;
+        pool = async_get_pool();
+    }
+
+    job = sk_ASYNC_JOB_pop(pool->jobs);
+    if (job == NULL) {
+        /* Pool is empty */
+        if ((pool->max_size != 0) && (pool->curr_size >= pool->max_size))
+            return NULL;
+
+        job = async_job_new();
+        if (job) {
+            async_fibre_makecontext(&job->fibrectx);
+            pool->curr_size++;
+        }
+    }
+    return job;
+}
+
+static void async_release_job(ASYNC_JOB *job) {
+    async_pool *pool;
+
+    pool = async_get_pool();
+    OPENSSL_free(job->funcargs);
+    job->funcargs = NULL;
+    sk_ASYNC_JOB_push(pool->jobs, job);
+}
+
+void async_start_func(void)
+{
+    ASYNC_JOB *job;
+
+    while (1) {
+        /* Run the job */
+        job = async_get_ctx()->currjob;
+        job->ret = job->func(job->funcargs);
+
+        /* Stop the job */
+        job->status = ASYNC_JOB_STOPPING;
+        if (!async_fibre_swapcontext(&job->fibrectx,
+                                     &async_get_ctx()->dispatcher, 1)) {
+            /*
+             * Should not happen. Getting here will close the thread...can't do
+             * much about it
+             */
+            ASYNCerr(ASYNC_F_ASYNC_START_FUNC, ASYNC_R_FAILED_TO_SWAP_CONTEXT);
+        }
+    }
+}
+
+int ASYNC_start_job(ASYNC_JOB **job, int *ret, int (*func)(void *),
+                         void *args, size_t size)
+{
+    if (async_get_ctx() == NULL && async_ctx_new() == NULL) {
+        return ASYNC_ERR;
+    }
+
+    if (*job) {
+        async_get_ctx()->currjob = *job;
+    }
+
+    for (;;) {
+        if (async_get_ctx()->currjob != NULL) {
+            if (async_get_ctx()->currjob->status == ASYNC_JOB_STOPPING) {
+                *ret = async_get_ctx()->currjob->ret;
+                async_release_job(async_get_ctx()->currjob);
+                async_get_ctx()->currjob = NULL;
+                *job = NULL;
+                return ASYNC_FINISH;
+            }
+
+            if (async_get_ctx()->currjob->status == ASYNC_JOB_PAUSING) {
+                *job = async_get_ctx()->currjob;
+                async_get_ctx()->currjob->status = ASYNC_JOB_PAUSED;
+                async_get_ctx()->currjob = NULL;
+                return ASYNC_PAUSE;
+            }
+
+            if (async_get_ctx()->currjob->status == ASYNC_JOB_PAUSED) {
+                async_get_ctx()->currjob = *job;
+                /* Resume previous job */
+                if (!async_fibre_swapcontext(&async_get_ctx()->dispatcher,
+                        &async_get_ctx()->currjob->fibrectx, 1)) {
+                    ASYNCerr(ASYNC_F_ASYNC_START_JOB,
+                             ASYNC_R_FAILED_TO_SWAP_CONTEXT);
+                    goto err;
+                }
+                continue;
+            }
+
+            /* Should not happen */
+            ASYNCerr(ASYNC_F_ASYNC_START_JOB, ERR_R_INTERNAL_ERROR);
+            async_release_job(async_get_ctx()->currjob);
+            async_get_ctx()->currjob = NULL;
+            *job = NULL;
+            return ASYNC_ERR;
+        }
+
+        /* Start a new job */
+        if ((async_get_ctx()->currjob = async_get_pool_job()) == NULL) {
+            return ASYNC_NO_JOBS;
+        }
+
+        if (args != NULL) {
+            async_get_ctx()->currjob->funcargs = OPENSSL_malloc(size);
+            if (async_get_ctx()->currjob->funcargs == NULL) {
+                ASYNCerr(ASYNC_F_ASYNC_START_JOB, ERR_R_MALLOC_FAILURE);
+                async_release_job(async_get_ctx()->currjob);
+                async_get_ctx()->currjob = NULL;
+                return ASYNC_ERR;
+            }
+            memcpy(async_get_ctx()->currjob->funcargs, args, size);
+        } else {
+            async_get_ctx()->currjob->funcargs = NULL;
+        }
+
+        async_get_ctx()->currjob->func = func;
+        if (!async_fibre_swapcontext(&async_get_ctx()->dispatcher,
+                &async_get_ctx()->currjob->fibrectx, 1)) {
+            ASYNCerr(ASYNC_F_ASYNC_START_JOB, ASYNC_R_FAILED_TO_SWAP_CONTEXT);
+            goto err;
+        }
+    }
+
+err:
+    async_release_job(async_get_ctx()->currjob);
+    async_get_ctx()->currjob = NULL;
+    *job = NULL;
+    return ASYNC_ERR;
+}
+
+
+int ASYNC_pause_job(void)
+{
+    ASYNC_JOB *job;
+
+    if (async_get_ctx() == NULL
+            || async_get_ctx()->currjob == NULL
+            || async_get_ctx()->blocked) {
+        /*
+         * Could be we've deliberately not been started within a job so this is
+         * counted as success.
+         */
+        return 1;
+    }
+
+    job = async_get_ctx()->currjob;
+    job->status = ASYNC_JOB_PAUSING;
+
+    if (!async_fibre_swapcontext(&job->fibrectx,
+                                 &async_get_ctx()->dispatcher, 1)) {
+        ASYNCerr(ASYNC_F_ASYNC_PAUSE_JOB, ASYNC_R_FAILED_TO_SWAP_CONTEXT);
+        return 0;
+    }
+
+    return 1;
+}
+
+static void async_empty_pool(async_pool *pool)
+{
+    ASYNC_JOB *job;
+
+    if (!pool || !pool->jobs)
+        return;
+
+    do {
+        job = sk_ASYNC_JOB_pop(pool->jobs);
+        async_job_free(job);
+    } while (job);
+}
+
+int ASYNC_init(int init_thread, size_t max_size, size_t init_size)
+{
+    if (!async_global_init())
+        return 0;
+
+    if (init_thread)
+        return ASYNC_init_thread(max_size, init_size);
+
+    return 1;
+}
+
+int ASYNC_init_thread(size_t max_size, size_t init_size)
+{
+    async_pool *pool;
+    size_t curr_size = 0;
+
+    if (init_size > max_size) {
+        ASYNCerr(ASYNC_F_ASYNC_INIT_THREAD, ASYNC_R_INVALID_POOL_SIZE);
+        return 0;
+    }
+
+    if (!async_local_init()) {
+        ASYNCerr(ASYNC_F_ASYNC_INIT_THREAD, ASYNC_R_INIT_FAILED);
+        return 0;
+    }
+    pool = OPENSSL_zalloc(sizeof *pool);
+    if (pool == NULL) {
+        ASYNCerr(ASYNC_F_ASYNC_INIT_THREAD, ERR_R_MALLOC_FAILURE);
+        return 0;
+    }
+
+    pool->jobs = sk_ASYNC_JOB_new_null();
+    if (pool->jobs == NULL) {
+        ASYNCerr(ASYNC_F_ASYNC_INIT_THREAD, ERR_R_MALLOC_FAILURE);
+        OPENSSL_free(pool);
+        return 0;
+    }
+
+    pool->max_size = max_size;
+
+    /* Pre-create jobs as required */
+    while (init_size) {
+        ASYNC_JOB *job;
+        job = async_job_new();
+        if (job) {
+            async_fibre_makecontext(&job->fibrectx);
+            job->funcargs = NULL;
+            sk_ASYNC_JOB_push(pool->jobs, job);
+            curr_size++;
+            init_size--;
+        } else {
+            /*
+             * Not actually fatal because we already created the pool, just skip
+             * creation of any more jobs
+             */
+            init_size = 0;
+        }
+    }
+    pool->curr_size = curr_size;
+    if (!async_set_pool(pool)) {
+        ASYNCerr(ASYNC_F_ASYNC_INIT_THREAD, ASYNC_R_FAILED_TO_SET_POOL);
+        goto err;
+    }
+
+    return 1;
+err:
+    async_free_pool_internal(pool);
+    return 0;
+}
+
+static void async_free_pool_internal(async_pool *pool)
+{
+    if (pool == NULL)
+        return;
+
+    async_empty_pool(pool);
+    sk_ASYNC_JOB_free(pool->jobs);
+    OPENSSL_free(pool);
+    (void)async_set_pool(NULL);
+    async_local_cleanup();
+    async_ctx_free();
+}
+
+void ASYNC_cleanup_thread(void)
+{
+    async_free_pool_internal(async_get_pool());
+}
+
+void ASYNC_cleanup(int cleanupthread)
+{
+    /*
+     * We don't actually have any global cleanup at the moment so just cleanup
+     * the thread
+     */
+    if (cleanupthread)
+        ASYNC_cleanup_thread();
+}
+
+ASYNC_JOB *ASYNC_get_current_job(void)
+{
+    async_ctx *ctx;
+
+    ctx = async_get_ctx();
+    if(ctx == NULL)
+        return NULL;
+
+    return ctx->currjob;
+}
+
+OSSL_ASYNC_FD ASYNC_get_wait_fd(ASYNC_JOB *job)
+{
+    return job->wait_fd;
+}
+
+void ASYNC_wake(ASYNC_JOB *job)
+{
+    char dummy = 0;
+
+    if (job->wake_set)
+        return;
+    async_write1(job->wake_fd, &dummy);
+    job->wake_set = 1;
+}
+
+void ASYNC_clear_wake(ASYNC_JOB *job)
+{
+    char dummy = 0;
+    if (!job->wake_set)
+        return;
+    async_read1(job->wait_fd, &dummy);
+    job->wake_set = 0;
+}
+
+void ASYNC_block_pause(void)
+{
+    if (async_get_ctx() == NULL
+            || async_get_ctx()->currjob == NULL) {
+        /*
+         * We're not in a job anyway so ignore this
+         */
+        return;
+    }
+    async_get_ctx()->blocked++;
+}
+
+void ASYNC_unblock_pause(void)
+{
+    if (async_get_ctx() == NULL
+            || async_get_ctx()->currjob == NULL) {
+        /*
+         * We're not in a job anyway so ignore this
+         */
+        return;
+    }
+    if(async_get_ctx()->blocked > 0)
+        async_get_ctx()->blocked--;
+}
diff --git a/crypto/comp/comp_err.c b/crypto/async/async_err.c
similarity index 70%
copy from crypto/comp/comp_err.c
copy to crypto/async/async_err.c
index f3a772a..6fe1f85 100644
--- a/crypto/comp/comp_err.c
+++ b/crypto/async/async_err.c
@@ -1,4 +1,4 @@
-/* crypto/comp/comp_err.c */
+/* crypto/async/async_err.c */
 /* ====================================================================
  * Copyright (c) 1999-2015 The OpenSSL Project.  All rights reserved.
  *
@@ -61,38 +61,43 @@
 
 #include <stdio.h>
 #include <openssl/err.h>
-#include <openssl/comp.h>
+#include <openssl/async.h>
 
 /* BEGIN ERROR CODES */
 #ifndef OPENSSL_NO_ERR
 
-# define ERR_FUNC(func) ERR_PACK(ERR_LIB_COMP,func,0)
-# define ERR_REASON(reason) ERR_PACK(ERR_LIB_COMP,0,reason)
+# define ERR_FUNC(func) ERR_PACK(ERR_LIB_ASYNC,func,0)
+# define ERR_REASON(reason) ERR_PACK(ERR_LIB_ASYNC,0,reason)
 
-static ERR_STRING_DATA COMP_str_functs[] = {
-    {ERR_FUNC(COMP_F_BIO_ZLIB_FLUSH), "bio_zlib_flush"},
-    {ERR_FUNC(COMP_F_BIO_ZLIB_NEW), "bio_zlib_new"},
-    {ERR_FUNC(COMP_F_BIO_ZLIB_READ), "bio_zlib_read"},
-    {ERR_FUNC(COMP_F_BIO_ZLIB_WRITE), "bio_zlib_write"},
+static ERR_STRING_DATA ASYNC_str_functs[] = {
+    {ERR_FUNC(ASYNC_F_ASYNC_CTX_NEW), "async_ctx_new"},
+    {ERR_FUNC(ASYNC_F_ASYNC_INIT_THREAD), "ASYNC_init_thread"},
+    {ERR_FUNC(ASYNC_F_ASYNC_JOB_NEW), "async_job_new"},
+    {ERR_FUNC(ASYNC_F_ASYNC_PAUSE_JOB), "ASYNC_pause_job"},
+    {ERR_FUNC(ASYNC_F_ASYNC_START_FUNC), "async_start_func"},
+    {ERR_FUNC(ASYNC_F_ASYNC_START_JOB), "ASYNC_start_job"},
     {0, NULL}
 };
 
-static ERR_STRING_DATA COMP_str_reasons[] = {
-    {ERR_REASON(COMP_R_ZLIB_DEFLATE_ERROR), "zlib deflate error"},
-    {ERR_REASON(COMP_R_ZLIB_INFLATE_ERROR), "zlib inflate error"},
-    {ERR_REASON(COMP_R_ZLIB_NOT_SUPPORTED), "zlib not supported"},
+static ERR_STRING_DATA ASYNC_str_reasons[] = {
+    {ERR_REASON(ASYNC_R_CANNOT_CREATE_WAIT_PIPE), "cannot create wait pipe"},
+    {ERR_REASON(ASYNC_R_FAILED_TO_SET_POOL), "failed to set pool"},
+    {ERR_REASON(ASYNC_R_FAILED_TO_SWAP_CONTEXT), "failed to swap context"},
+    {ERR_REASON(ASYNC_R_INIT_FAILED), "init failed"},
+    {ERR_REASON(ASYNC_R_INVALID_POOL_SIZE), "invalid pool size"},
+    {ERR_REASON(ASYNC_R_POOL_ALREADY_INITED), "pool already inited"},
     {0, NULL}
 };
 
 #endif
 
-void ERR_load_COMP_strings(void)
+void ERR_load_ASYNC_strings(void)
 {
 #ifndef OPENSSL_NO_ERR
 
-    if (ERR_func_error_string(COMP_str_functs[0].error) == NULL) {
-        ERR_load_strings(0, COMP_str_functs);
-        ERR_load_strings(0, COMP_str_reasons);
+    if (ERR_func_error_string(ASYNC_str_functs[0].error) == NULL) {
+        ERR_load_strings(0, ASYNC_str_functs);
+        ERR_load_strings(0, ASYNC_str_reasons);
     }
 #endif
 }
diff --git a/crypto/conf/conf_mall.c b/crypto/async/async_locl.h
similarity index 68%
copy from crypto/conf/conf_mall.c
copy to crypto/async/async_locl.h
index 5db7da0..a463bf1 100644
--- a/crypto/conf/conf_mall.c
+++ b/crypto/async/async_locl.h
@@ -1,10 +1,9 @@
-/* conf_mall.c */
+/* crypto/async/async_locl.h */
 /*
- * Written by Stephen Henson (steve at openssl.org) for the OpenSSL project
- * 2001.
+ * Written by Matt Caswell (matt at openssl.org) for the OpenSSL project.
  */
 /* ====================================================================
- * Copyright (c) 2001 The OpenSSL Project.  All rights reserved.
+ * Copyright (c) 2015 The OpenSSL Project.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -50,33 +49,49 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  * OF THE POSSIBILITY OF SUCH DAMAGE.
  * ====================================================================
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com).  This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
  */
 
-#include <stdio.h>
+#include <openssl/async.h>
 #include <openssl/crypto.h>
-#include "internal/cryptlib.h"
-#include <openssl/conf.h>
-#include <openssl/dso.h>
-#include <openssl/x509.h>
-#include <openssl/asn1.h>
-#ifndef OPENSSL_NO_ENGINE
-# include <openssl/engine.h>
-#endif
 
-/* Load all OpenSSL builtin modules */
+typedef struct async_ctx_st async_ctx;
+typedef struct async_pool_st async_pool;
+
+#include "arch/async_win.h"
+#include "arch/async_posix.h"
+#include "arch/async_null.h"
+
+struct async_ctx_st {
+    async_fibre dispatcher;
+    ASYNC_JOB *currjob;
+    unsigned int blocked;
+};
+
+struct async_job_st {
+    async_fibre fibrectx;
+    int (*func) (void *);
+    void *funcargs;
+    int ret;
+    int status;
+    int wake_set;
+    OSSL_ASYNC_FD wait_fd;
+    OSSL_ASYNC_FD wake_fd;
+};
+
+DECLARE_STACK_OF(ASYNC_JOB)
+
+struct async_pool_st {
+    STACK_OF(ASYNC_JOB) *jobs;
+    size_t curr_size;
+    size_t max_size;
+};
 
-void OPENSSL_load_builtin_modules(void)
-{
-    /* Add builtin modules here */
-    ASN1_add_oid_module();
-    ASN1_add_stable_module();
-#ifndef OPENSSL_NO_ENGINE
-    ENGINE_add_conf_module();
-#endif
-    EVP_add_alg_module();
-}
+int async_global_init(void);
+int async_local_init(void);
+void async_local_cleanup(void);
+void async_global_cleanup(void);
+void async_start_func(void);
+int async_pipe(OSSL_ASYNC_FD *pipefds);
+int async_close_fd(OSSL_ASYNC_FD fd);
+int async_write1(OSSL_ASYNC_FD fd, const void *buf);
+int async_read1(OSSL_ASYNC_FD fd, void *buf);
diff --git a/crypto/ct/Makefile b/crypto/ct/Makefile
index dfb0839..dd04b04 100644
--- a/crypto/ct/Makefile
+++ b/crypto/ct/Makefile
@@ -70,7 +70,8 @@ ct_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
 ct_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
 ct_err.o: ../../include/openssl/symhacks.h ../include/internal/ct_int.h
 ct_err.o: ct_err.c
-ct_lib.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
+ct_lib.o: ../../e_os.h ../../include/openssl/asn1.h
+ct_lib.o: ../../include/openssl/async.h ../../include/openssl/bio.h
 ct_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
 ct_lib.o: ../../include/openssl/comp.h ../../include/openssl/crypto.h
 ct_lib.o: ../../include/openssl/dsa.h ../../include/openssl/dtls1.h
diff --git a/crypto/err/Makefile b/crypto/err/Makefile
index dcd7347..398b3b9 100644
--- a/crypto/err/Makefile
+++ b/crypto/err/Makefile
@@ -67,27 +67,27 @@ err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
 err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
 err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 err.o: ../include/internal/cryptlib.h err.c
-err_all.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
-err_all.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
-err_all.o: ../../include/openssl/cms.h ../../include/openssl/comp.h
-err_all.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
-err_all.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
-err_all.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
-err_all.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
-err_all.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
-err_all.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-err_all.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
-err_all.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h
-err_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
-err_all.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem2.h
-err_all.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
-err_all.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
-err_all.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
-err_all.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-err_all.o: ../../include/openssl/ts.h ../../include/openssl/ui.h
-err_all.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
-err_all.o: ../../include/openssl/x509v3.h ../include/internal/ct_int.h
-err_all.o: err_all.c
+err_all.o: ../../include/openssl/asn1.h ../../include/openssl/async.h
+err_all.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
+err_all.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h
+err_all.o: ../../include/openssl/comp.h ../../include/openssl/conf.h
+err_all.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
+err_all.o: ../../include/openssl/dsa.h ../../include/openssl/dso.h
+err_all.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+err_all.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
+err_all.o: ../../include/openssl/engine.h ../../include/openssl/err.h
+err_all.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h
+err_all.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
+err_all.o: ../../include/openssl/ocsp.h ../../include/openssl/opensslconf.h
+err_all.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+err_all.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs12.h
+err_all.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
+err_all.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
+err_all.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+err_all.o: ../../include/openssl/symhacks.h ../../include/openssl/ts.h
+err_all.o: ../../include/openssl/ui.h ../../include/openssl/x509.h
+err_all.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
+err_all.o: ../include/internal/ct_int.h err_all.c
 err_prn.o: ../../e_os.h ../../include/openssl/bio.h
 err_prn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
 err_prn.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
diff --git a/crypto/err/err.c b/crypto/err/err.c
index 077929c..b7ca3de 100644
--- a/crypto/err/err.c
+++ b/crypto/err/err.c
@@ -157,6 +157,7 @@ static ERR_STRING_DATA ERR_str_libraries[] = {
     {ERR_PACK(ERR_LIB_FIPS, 0, 0), "FIPS routines"},
     {ERR_PACK(ERR_LIB_CMS, 0, 0), "CMS routines"},
     {ERR_PACK(ERR_LIB_HMAC, 0, 0), "HMAC routines"},
+    {ERR_PACK(ERR_LIB_ASYNC, 0, 0), "ASYNC routines"},
     {0, NULL},
 };
 
diff --git a/crypto/err/err_all.c b/crypto/err/err_all.c
index d9a2a57..baf76e7 100644
--- a/crypto/err/err_all.c
+++ b/crypto/err/err_all.c
@@ -106,6 +106,7 @@
 # include <openssl/jpake.h>
 #endif
 #include <internal/ct_int.h>
+#include <openssl/async.h>
 
 void ERR_load_crypto_strings(void)
 {
@@ -165,5 +166,6 @@ void ERR_load_crypto_strings(void)
 # ifndef OPENSSL_NO_CT
     ERR_load_CT_strings();
 # endif
+    ERR_load_ASYNC_strings();
 #endif
 }
diff --git a/crypto/err/openssl.ec b/crypto/err/openssl.ec
index 8a10b80..0d308a9 100644
--- a/crypto/err/openssl.ec
+++ b/crypto/err/openssl.ec
@@ -36,6 +36,7 @@ L HMAC		include/openssl/hmac.h		crypto/hmac/hmac_err.c
 L CMS		include/openssl/cms.h		crypto/cms/cms_err.c
 L JPAKE		include/openssl/jpake.h		crypto/jpake/jpake_err.c
 L FIPS		include/openssl/fips.h		crypto/fips_err.h
+L ASYNC		include/openssl/async.h		crypto/async/async_err.c
 
 # additional header files to be scanned for function names
 L NONE		crypto/x509/x509_vfy.h		NONE
diff --git a/crypto/rand/md_rand.c b/crypto/rand/md_rand.c
index 0eaaf62..698a638 100644
--- a/crypto/rand/md_rand.c
+++ b/crypto/rand/md_rand.c
@@ -130,6 +130,7 @@
 
 #include <openssl/crypto.h>
 #include <openssl/rand.h>
+#include <openssl/async.h>
 #include "rand_lcl.h"
 
 #include <openssl/err.h>
@@ -432,6 +433,11 @@ static int rand_bytes(unsigned char *buf, int num, int pseudo)
      */
 
     CRYPTO_w_lock(CRYPTO_LOCK_RAND);
+    /*
+     * We could end up in an async engine while holding this lock so ensure
+     * we don't pause and cause a deadlock
+     */
+    ASYNC_block_pause();
 
     /* prevent rand_bytes() from trying to obtain the lock again */
     CRYPTO_w_lock(CRYPTO_LOCK_RAND2);
@@ -510,6 +516,7 @@ static int rand_bytes(unsigned char *buf, int num, int pseudo)
 
     /* before unlocking, we must clear 'crypto_lock_rand' */
     crypto_lock_rand = 0;
+    ASYNC_unblock_pause();
     CRYPTO_w_unlock(CRYPTO_LOCK_RAND);
 
     while (num > 0) {
@@ -576,10 +583,15 @@ static int rand_bytes(unsigned char *buf, int num, int pseudo)
         || !MD_Update(&m, local_md, MD_DIGEST_LENGTH))
         goto err;
     CRYPTO_w_lock(CRYPTO_LOCK_RAND);
+    /*
+     * Prevent deadlocks if we end up in an async engine
+     */
+    ASYNC_block_pause();
     if (!MD_Update(&m, md, MD_DIGEST_LENGTH) || !MD_Final(&m, md)) {
         CRYPTO_w_unlock(CRYPTO_LOCK_RAND);
         goto err;
     }
+    ASYNC_unblock_pause();
     CRYPTO_w_unlock(CRYPTO_LOCK_RAND);
 
     EVP_MD_CTX_cleanup(&m);
@@ -635,6 +647,10 @@ static int rand_status(void)
 
     if (!do_not_lock) {
         CRYPTO_w_lock(CRYPTO_LOCK_RAND);
+        /*
+         * Prevent deadlocks in case we end up in an async engine
+         */
+        ASYNC_block_pause();
 
         /*
          * prevent rand_bytes() from trying to obtain the lock again
@@ -656,6 +672,7 @@ static int rand_status(void)
         /* before unlocking, we must clear 'crypto_lock_rand' */
         crypto_lock_rand = 0;
 
+        ASYNC_unblock_pause();
         CRYPTO_w_unlock(CRYPTO_LOCK_RAND);
     }
 
diff --git a/doc/apps/s_client.pod b/doc/apps/s_client.pod
index 6468999..afcba28 100644
--- a/doc/apps/s_client.pod
+++ b/doc/apps/s_client.pod
@@ -68,6 +68,7 @@ B<openssl> B<s_client>
 [B<-no_tls1_1>]
 [B<-no_tls1_2>]
 [B<-fallback_scsv>]
+[B<-async>]
 [B<-bugs>]
 [B<-cipher cipherlist>]
 [B<-serverpref>]
@@ -277,6 +278,13 @@ work if TLS is turned off.
 
 Send TLS_FALLBACK_SCSV in the ClientHello.
 
+=item B<-async>
+
+switch on asynchronous mode. Cryptographic operations will be performed
+asynchronously. This will only have an effect if an asynchronous capable engine
+is also used via the B<-engine> option. For test purposes the dummy async engine
+(dasync) can be used (if available).
+
 =item B<-bugs>
 
 there are several known bug in SSL and TLS implementations. Adding this
diff --git a/doc/apps/s_server.pod b/doc/apps/s_server.pod
index cd8a3ef..706e039 100644
--- a/doc/apps/s_server.pod
+++ b/doc/apps/s_server.pod
@@ -73,6 +73,7 @@ B<openssl> B<s_server>
 [B<-dtls1>]
 [B<-dtls1_2>]
 [B<-listen>]
+[B<-async>]
 [B<-no_ssl3>]
 [B<-no_tls1>]
 [B<-no_dhe>]
@@ -312,6 +313,13 @@ them or not. Any without a cookie will be responded to with a
 HelloVerifyRequest. If a ClientHello with a cookie is received then s_server
 will connect to that peer and complete the handshake.
 
+=item B<-async>
+
+switch on asynchronous mode. Cryptographic operations will be performed
+asynchronously. This will only have an effect if an asynchronous capable engine
+is also used via the B<-engine> option. For test purposes the dummy async engine
+(dasync) can be used (if available).
+
 =item B<-bugs>
 
 there are several known bug in SSL and TLS implementations. Adding this
diff --git a/doc/crypto/ASYNC_start_job.pod b/doc/crypto/ASYNC_start_job.pod
new file mode 100644
index 0000000..256cc43
--- /dev/null
+++ b/doc/crypto/ASYNC_start_job.pod
@@ -0,0 +1,277 @@
+=pod
+
+=head1 NAME
+
+ASYNC_init, ASYNC_cleanup, ASYNC_init_thread, ASYNC_cleanup_thread,
+ASYNC_start_job, ASYNC_pause_job, ASYNC_in_job, ASYNC_get_wait_fd,
+ASYNC_get_current_job, ASYNC_wake, ASYNC_clear_wake, ASYNC_block_pause,
+ASYNC_unblock_pause - asynchronous job management functions
+
+=head1 SYNOPSIS
+
+ #include <openssl/async.h>
+
+ int ASYNC_init(int init_thread, size_t max_size, size_t init_size);
+ void ASYNC_cleanup(int cleanupthread);
+
+ int ASYNC_init_thread(size_t max_size, size_t init_size);
+ void ASYNC_cleanup_thread(void);
+
+ int ASYNC_start_job(ASYNC_JOB **job, int *ret, int (*func)(void *),
+                     void *args, size_t size);
+ int ASYNC_pause_job(void);
+
+ int ASYNC_get_wait_fd(ASYNC_JOB *job);
+ ASYNC_JOB *ASYNC_get_current_job(void);
+ void ASYNC_wake(ASYNC_JOB *job);
+ void ASYNC_clear_wake(ASYNC_JOB *job);
+ void ASYNC_block_pause(void);
+ void ASYNC_unblock_pause(void);
+
+=head1 DESCRIPTION
+
+OpenSSL implements asynchronous capabilities through an ASYNC_JOB. This
+represents code that can be started and executes until some event occurs. At
+that point the code can be paused and control returns to user code until some
+subsequent event indicates that the job can be resumed.
+
+The creation of an ASYNC_JOB is a relatively expensive operation. Therefore, for
+efficiency reasons, jobs can be created up front and reused many times. They are
+held in a pool until they are needed, at which point they are removed from the
+pool, used, and then returned to the pool when the job completes. Before using
+any of the asynchronous job functions, user code should first call
+ASYNC_init(). If the user application is multi-threaded, then
+ASYNC_init_thread() should be called for each thread that will initiate
+asynchronous jobs. If the B<init_thread> parameter to ASYNC_init() is non-zero
+then ASYNC_init_thread is automatically called for the current thread. Before
+user code exits it should free up resources for each thread that was initialised
+using ASYNC_cleanup_thread(). No asynchronous jobs must be outstanding for the thread
+when ASYNC_cleanup_thread() is called. Failing to ensure this will result in memory
+leaks. Additionally an application should call ASYNC_cleanup() when all
+asynchronous work is complete across all threads. If B<cleanupthread> is
+non-zero then ASYNC_cleanup_thread() is automatically called for the current
+thread.
+
+The B<max_size> argument limits the number of ASYNC_JOBs that will be held in
+the pool. If B<max_size> is set to 0 then no upper limit is set. When an
+ASYNC_JOB is needed but there are none available in the pool already then one
+will be automatically created, as long as the total of ASYNC_JOBs managed by the
+pool does not exceed B<max_size>. When the pool is first initialised
+B<init_size> ASYNC_JOBs will be created immediately. If ASYNC_init_thread() is
+not called before the pool is first used then it will be called automatically
+with a B<max_size> of 0 (no upper limit) and an B<init_size> of 0 (no ASYNC_JOBs
+created up front). If a pool is created in this way it must still be cleaned up
+with an explicit call to ASYNC_cleanup_thread().
+
+An asynchronous job is started by calling the ASYNC_start_job() function.
+Initially B<*job> should be NULL. B<ret> should point to a location where the
+return value of the asynchronous function should be stored on completion of the
+job. B<func> represents the function that should be started asynchronously. The
+data pointed to by B<args> and of size B<size> will be copied and then passed as
+an argument to B<func> when the job starts. ASYNC_start_job will return one of
+the following values:
+
+=over 4
+
+=item B<ASYNC_ERR>
+
+An error occurred trying to start the job. Check the OpenSSL error queue (e.g.
+see L<ERR_print_errors(3)>) for more details.
+
+=item B<ASYNC_NO_JOBS>
+
+There are no jobs currently available in the pool. This call can be retried
+again at a later time.
+
+=item B<ASYNC_PAUSE>
+
+The job was successfully started but was "paused" before it completed (see
+ASYNC_pause_job() below). A handle to the job is placed in B<*job>. Other work
+can be performed (if desired) and the job restarted at a later time. To restart
+a job call ASYNC_start_job() again passing the job handle in B<*job>. The
+B<func>, B<args> and B<size> parameters will be ignored when restarting a job.
+When restarting a job ASYNC_start_job() B<must> be called from the same thread
+that the job was originally started from.
+
+=item B<ASYNC_FINISH>
+
+The job completed. B<*job> will be NULL and the return value from B<func> will
+be placed in B<*ret>.
+
+=back
+
+At any one time there can be a maximum of one job actively running per thread
+(you can have many that are paused). ASYNC_get_current_job() can be used to get
+a pointer to the currently executing ASYNC_JOB. If no job is currently executing
+then this will return NULL.
+
+If executing within the context of a job (i.e. having been called directly or
+indirectly by the function "func" passed as an argument to ASYNC_start_job())
+then ASYNC_pause_job() will immediately return control to the calling
+application with ASYNC_PAUSE returned from the ASYNC_start_job() call. A
+subsequent call to ASYNC_start_job passing in the relevant ASYNC_JOB in the
+B<*job> parameter will resume execution from the ASYNC_pause_job() call. If
+ASYNC_pause_job() is called whilst not within the context of a job then no
+action is taken and ASYNC_pause_job() returns immediately.
+
+Every ASYNC_JOB has a "wait" file descriptor associated with it. Calling
+ASYNC_get_wait_fd() and passing in a pointer to an ASYNC_JOB in the B<job>
+parameter will return the wait file descriptor associated with that job. This
+file descriptor can be used to signal that the job should be resumed.
+Applications can wait for the file descriptor to be ready for "read" using a
+system function call such as select or poll (being ready for "read" indicates
+that the job should be resumed). Applications can signal that a job is ready to
+resume using ASYNC_wake() or clear an existing signal using ASYNC_clear_wake().
+
+An example of typical usage might be an async capable engine. User code would
+initiate cryptographic operations. The engine would initiate those operations
+asynchronously and then call ASYNC_pause_job() to return control to the user
+code. The user code can then perform other tasks or wait for the job to be ready
+by calling "select" or other similar function on the wait file descriptor. The
+engine can signal to the user code that the job should be resumed using
+ASYNC_wake(). Once resumed the engine would clear the wake signal by calling
+ASYNC_clear_wake().
+
+The ASYNC_block_pause() function will prevent the currently active job from
+pausing. The block will remain in place until a subsequent call to
+ASYNC_unblock_pause(). These functions can be nested, e.g. if you call
+ASYNC_block_pause() twice then you must call ASYNC_unblock_pause() twice in
+order to reenable pausing. If these functions are called while there is no
+currently active job then they have no effect. This functionality can be useful
+to avoid deadlock scenarios. For example during the execution of an ASYNC_JOB an
+application aquires a lock. It then calls some cryptographic function which
+invokes ASYNC_pause_job(). This returns control back to the code that created
+the ASYNC_JOB. If that code then attempts to aquire the same lock before
+resuming the original job then a deadlock can occur. By calling
+ASYNC_block_pause() immediately after aquiring the lock and
+ASYNC_unblock_pause() immediately before releasing it then this situation cannot
+occur.
+
+=head1 RETURN VALUES
+
+ASYNC_init and ASYNC_init_thread return 1 on success or 0 otherwise.
+
+ASYNC_start_job returns one of ASYNC_ERR, ASYNC_NO_JOBS, ASYNC_PAUSE or
+ASYNC_FINISH as described above.
+
+ASYNC_pause_job returns 0 if an error occured or 1 on success. If called when
+not within the context of an ASYNC_JOB then this is counted as success so 1 is
+returned.
+
+ASYNC_get_wait_fd returns the "wait" file descriptor associated with the
+ASYNC_JOB provided as an argument.
+
+ASYNC_get_current_job returns a pointer to the currently executing ASYNC_JOB or
+NULL if not within the context of a job.
+
+=head1 EXAMPLE
+
+The following example demonstrates how to use most of the core async APIs:
+
+ #include <stdio.h>
+ #include <openssl/async.h>
+
+ int jobfunc(void *arg)
+ {
+     ASYNC_JOB *currjob;
+     unsigned char *msg;
+
+     currjob = ASYNC_get_current_job();
+     if (currjob != NULL) {
+         printf("Executing within a job\n");
+     } else {
+         printf("Not executing within a job - should not happen\n");
+         return 0;
+     }
+
+     msg = (unsigned char *)arg;
+     printf("Passed in message is: %s\n", msg);
+
+     /*
+      * Normally some external event would cause this to happen at some
+      * later point - but we do it here for demo purposes, i.e.
+      * immediately signalling that the job is ready to be woken up after
+      * we return to main via ASYNC_pause_job().
+      */
+     ASYNC_wake(currjob);
+
+     /* Return control back to main */
+     ASYNC_pause_job();
+
+     /* Clear the wake signal */
+     ASYNC_clear_wake(currjob);
+
+     printf ("Resumed the job after a pause\n");
+
+     return 1;
+ }
+
+ int main(void)
+ {
+     ASYNC_JOB *job = NULL;
+     int ret, waitfd;
+     fd_set waitfdset;
+     unsigned char msg[13] = "Hello world!";
+
+     /*
+      * We're only expecting 1 job to be used here so we're only creating
+      * a pool of 1
+      */
+     if (!ASYNC_init(1, 1, 1)) {
+         printf("Error creating pool\n");
+         goto end;
+     }
+
+     printf("Starting...\n");
+
+     for (;;) {
+         switch(ASYNC_start_job(&job, &ret, jobfunc, msg, sizeof(msg))) {
+         case ASYNC_ERR:
+         case ASYNC_NO_JOBS:
+                 printf("An error occurred\n");
+                 goto end;
+         case ASYNC_PAUSE:
+                 printf("Job was paused\n");
+                 break;
+         case ASYNC_FINISH:
+                 printf("Job finished with return value %d\n", ret);
+                 goto end;
+         }
+
+         /* Wait for the job to be woken */
+         printf("Waiting for the job to be woken up\n");
+         waitfd = ASYNC_get_wait_fd(job);
+         FD_ZERO(&waitfdset);
+         FD_SET(waitfd, &waitfdset);
+         select(waitfd + 1, &waitfdset, NULL, NULL, NULL);
+     }
+
+ end:
+     printf("Finishing\n");
+     ASYNC_cleanup(1);
+
+     return 0;
+ }
+
+The expected output from executing the above example program is:
+
+ Starting...
+ Executing within a job
+ Passed in message is: Hello world!
+ Job was paused
+ Waiting for the job to be woken up
+ Resumed the job after a pause
+ Job finished with return value 1
+ Finishing
+
+=head1 SEE ALSO
+
+L<crypto(3)>, L<ERR_print_errors(3)>
+
+=head1 HISTORY
+
+ASYNC_init, ASYNC_init_thread, ASYNC_cleanup, ASYNC_cleanup_thread,
+ASYNC_start_job, ASYNC_pause_job, ASYNC_get_wait_fd, ASYNC_get_current_job,
+ASYNC_wake, ASYNC_clear_wake were first added to OpenSSL 1.1.0.
+
+=cut
diff --git a/doc/ssl/SSL_CTX_set_mode.pod b/doc/ssl/SSL_CTX_set_mode.pod
index 56f732f..341da16 100644
--- a/doc/ssl/SSL_CTX_set_mode.pod
+++ b/doc/ssl/SSL_CTX_set_mode.pod
@@ -79,6 +79,12 @@ DO NOT ENABLE THIS if your application attempts a normal handshake.
 Only use this in explicit fallback retries, following the guidance
 in draft-ietf-tls-downgrade-scsv-00.
 
+=item SSL_MODE_ASYNC
+
+Enable asynchronous processing. TLS I/O operations may indicate a retry with
+SSL_ERROR_WANT_ASYNC with this mode set if an asynchronous capable engine is
+used to perform cryptographic operations. See L<SSL_get_error(3)>.
+
 =back
 
 =head1 RETURN VALUES
@@ -90,6 +96,11 @@ SSL_CTX_get_mode() and SSL_get_mode() return the current bitmask.
 
 =head1 SEE ALSO
 
-L<ssl(3)>, L<SSL_read(3)>, L<SSL_write(3)>
+L<ssl(3)>, L<SSL_read(3)>, L<SSL_write(3)>, L<SSL_get_error(3)>
+
+=======
+=head1 HISTORY
+
+SSL_MODE_ASYNC was first added to OpenSSL 1.1.0.
 
 =cut
diff --git a/doc/ssl/SSL_get_async_wait_fd.pod b/doc/ssl/SSL_get_async_wait_fd.pod
new file mode 100644
index 0000000..840c9c8
--- /dev/null
+++ b/doc/ssl/SSL_get_async_wait_fd.pod
@@ -0,0 +1,45 @@
+=pod
+
+=head1 NAME
+
+SSL_waiting_for_async, SSL_get_async_wait_fd - manage asynchronous operations
+
+=head1 SYNOPSIS
+
+ #include <openssl/ssl.h>
+
+ int SSL_waiting_for_async(SSL *s);
+ int SSL_get_async_wait_fd(SSL *s);
+
+=head1 DESCRIPTION
+
+SSL_waiting_for_async() determines whether an SSL connection is currently
+waiting for asynchronous operations to complete (see the SSL_MODE_ASYNC mode in
+L<SSL_CTX_set_mode(3)>).
+
+SSL_get_async_wait_fd() returns a file descriptor which can be used in a call to
+select() or poll() to determine whether the current asynchronous operation has
+completed or not. A completed operation will result in data appearing as
+"read ready" on the file descriptor (no actual data should be read from the
+file descriptor). This function should only be called if the SSL object is
+currently waiting for asynchronous work to complete (i.e. SSL_ERROR_WANT_ASYNC
+has been received - see L<SSL_get_error(3)>).
+
+=head1 RETURN VALUES
+
+SSL_waiting_for_async() will return 1 if the current SSL operation is waiting
+for an async operation to complete and 0 otherwise.
+
+SSL_get_async_wait_fd() will return a file descriptor that can be used in a call
+to select() or poll() to wait for asynchronous work to complete, or -1 on error.
+
+=head1 SEE ALSO
+
+L<SSL_get_error(3)>, L<SSL_CTX_set_mode(3)>
+
+=head1 HISTORY
+
+SSL_waiting_for_async() and SSL_get_async_wait_fd() were first added to
+OpenSSL 1.1.0
+
+=cut
diff --git a/doc/ssl/SSL_get_error.pod b/doc/ssl/SSL_get_error.pod
index d52c27d..271f849 100644
--- a/doc/ssl/SSL_get_error.pod
+++ b/doc/ssl/SSL_get_error.pod
@@ -87,6 +87,18 @@ SSL_CTX_set_client_cert_cb() has asked to be called again.
 The TLS/SSL I/O function should be called again later.
 Details depend on the application.
 
+=item SSL_ERROR_WANT_ASYNC
+
+The operation did not complete because an asynchronous engine is still
+processing data. This will only occur if the mode has been set to SSL_MODE_ASYNC
+using L<SSL_CTX_set_mode(3)> or L<SSL_set_mode(3)> and an asynchronous capable
+engine is being used. An application can determine whether the engine has
+completed its processing using select() or poll() on the asynchronous wait file
+descriptor. This file descriptor is available by calling
+L<SSL_get_async_wait_fd(3)>. The TLS/SSL I/O function should be called again
+later. The function B<must> be called from the same thread that the original
+call was made from.
+
 =item SSL_ERROR_SYSCALL
 
 Some I/O error occurred.  The OpenSSL error queue may contain more
@@ -107,4 +119,8 @@ OpenSSL error queue contains more information on the error.
 
 L<ssl(3)>, L<err(3)>
 
+=head1 HISTORY
+
+SSL_ERROR_WANT_ASYNC was added in OpenSSL 1.1.0.
+
 =cut
diff --git a/engines/Makefile b/engines/Makefile
index 5cd2aa2..de0dafa 100644
--- a/engines/Makefile
+++ b/engines/Makefile
@@ -31,13 +31,15 @@ AFLAGS= $(ASFLAGS)
 GENERAL=Makefile engines.com install.com engine_vector.mar
 
 LIB=$(TOP)/libcrypto.a
-LIBNAMES= gmp padlock capi
+LIBNAMES= gmp padlock capi dasync
 LIBSRC=	e_gmp.c \
 	e_padlock.c \
-	e_capi.c
+	e_capi.c \
+	e_dasync.c
 LIBOBJ= e_gmp.o \
 	e_padlock.o \
 	e_capi.o \
+	e_dasync.o \
 	$(ENGINES_ASM_OBJ)
 
 TESTLIBNAMES= ossltest
@@ -50,7 +52,8 @@ HEADER=	e_gmp_err.c e_gmp_err.h \
 	e_chil_err.c e_chil_err.h \
 	e_ubsec_err.c e_ubsec_err.h \
 	e_capi_err.c e_capi_err.h \
-	e_ossltest_err.c e_ossltest_err.h
+	e_ossltest_err.c e_ossltest_err.h \
+	e_dasync_err.c e_dasync_err.h
 
 ALL=	$(GENERAL) $(SRC) $(HEADER)
 
@@ -166,6 +169,21 @@ e_capi.o: ../include/openssl/pkcs7.h ../include/openssl/safestack.h
 e_capi.o: ../include/openssl/sha.h ../include/openssl/stack.h
 e_capi.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
 e_capi.o: ../include/openssl/x509_vfy.h e_capi.c
+e_dasync.o: ../include/openssl/asn1.h ../include/openssl/async.h
+e_dasync.o: ../include/openssl/bio.h ../include/openssl/bn.h
+e_dasync.o: ../include/openssl/buffer.h ../include/openssl/crypto.h
+e_dasync.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+e_dasync.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
+e_dasync.o: ../include/openssl/engine.h ../include/openssl/err.h
+e_dasync.o: ../include/openssl/evp.h ../include/openssl/lhash.h
+e_dasync.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+e_dasync.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+e_dasync.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
+e_dasync.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+e_dasync.o: ../include/openssl/sha.h ../include/openssl/stack.h
+e_dasync.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
+e_dasync.o: ../include/openssl/x509_vfy.h e_dasync.c e_dasync_err.c
+e_dasync.o: e_dasync_err.h
 e_gmp.o: ../include/openssl/asn1.h ../include/openssl/bio.h
 e_gmp.o: ../include/openssl/bn.h ../include/openssl/buffer.h
 e_gmp.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h
diff --git a/engines/e_dasync.c b/engines/e_dasync.c
new file mode 100644
index 0000000..76171b1
--- /dev/null
+++ b/engines/e_dasync.c
@@ -0,0 +1,334 @@
+/* engines/e_dasync.c */
+/*
+ * Written by Matt Caswell (matt at openssl.org) for the OpenSSL project.
+ */
+/* ====================================================================
+ * Copyright (c) 2015 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    licensing at OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+#include <openssl/engine.h>
+#include <openssl/sha.h>
+#include <openssl/rsa.h>
+#include <openssl/evp.h>
+#include <openssl/async.h>
+#include <openssl/bn.h>
+
+#define DASYNC_LIB_NAME "DASYNC"
+#include "e_dasync_err.c"
+
+/* Engine Id and Name */
+static const char *engine_dasync_id = "dasync";
+static const char *engine_dasync_name = "Dummy Async engine support";
+
+
+/* Engine Lifetime functions */
+static int dasync_destroy(ENGINE *e);
+static int dasync_init(ENGINE *e);
+static int dasync_finish(ENGINE *e);
+void ENGINE_load_dasync(void);
+
+
+/* Set up digests. Just SHA1 for now */
+static int dasync_digests(ENGINE *e, const EVP_MD **digest,
+                          const int **nids, int nid);
+
+static int dasync_digest_nids[] = { NID_sha1, 0 };
+
+static void dummy_pause_job(void);
+
+/* SHA1 */
+static int dasync_sha1_init(EVP_MD_CTX *ctx);
+static int dasync_sha1_update(EVP_MD_CTX *ctx, const void *data,
+                             unsigned long count);
+static int dasync_sha1_final(EVP_MD_CTX *ctx, unsigned char *md);
+
+static const EVP_MD dasync_sha1 = {
+    NID_sha1,
+    NID_sha1WithRSAEncryption,
+    SHA_DIGEST_LENGTH,
+    EVP_MD_FLAG_PKEY_METHOD_SIGNATURE | EVP_MD_FLAG_DIGALGID_ABSENT,
+    dasync_sha1_init,
+    dasync_sha1_update,
+    dasync_sha1_final,
+    NULL,
+    NULL,
+    EVP_PKEY_NULL_method,
+    SHA_CBLOCK,
+    sizeof(EVP_MD *) + sizeof(SHA_CTX),
+};
+
+/* RSA */
+
+static int dasync_pub_enc(int flen, const unsigned char *from,
+                    unsigned char *to, RSA *rsa, int padding);
+static int dasync_pub_dec(int flen, const unsigned char *from,
+                    unsigned char *to, RSA *rsa, int padding);
+static int dasync_rsa_priv_enc(int flen, const unsigned char *from,
+                      unsigned char *to, RSA *rsa, int padding);
+static int dasync_rsa_priv_dec(int flen, const unsigned char *from,
+                      unsigned char *to, RSA *rsa, int padding);
+static int dasync_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa,
+                              BN_CTX *ctx);
+
+static int dasync_rsa_init(RSA *rsa);
+static int dasync_rsa_finish(RSA *rsa);
+
+static RSA_METHOD dasync_rsa_method = {
+    "Dummy Async RSA method",
+    dasync_pub_enc,             /* pub_enc */
+    dasync_pub_dec,             /* pub_dec */
+    dasync_rsa_priv_enc,        /* priv_enc */
+    dasync_rsa_priv_dec,        /* priv_dec */
+    dasync_rsa_mod_exp,         /* rsa_mod_exp */
+    BN_mod_exp_mont,            /* bn_mod_exp */
+    dasync_rsa_init,            /* init */
+    dasync_rsa_finish,          /* finish */
+    0,                          /* flags */
+    NULL,                       /* app_data */
+    0,                          /* rsa_sign */
+    0,                          /* rsa_verify */
+    NULL                        /* rsa_keygen */
+};
+
+
+static int bind_dasync(ENGINE *e)
+{
+    /* Ensure the dasync error handling is set up */
+    ERR_load_DASYNC_strings();
+
+    if (!ENGINE_set_id(e, engine_dasync_id)
+        || !ENGINE_set_name(e, engine_dasync_name)
+        || !ENGINE_set_RSA(e, &dasync_rsa_method)
+        || !ENGINE_set_digests(e, dasync_digests)
+        || !ENGINE_set_destroy_function(e, dasync_destroy)
+        || !ENGINE_set_init_function(e, dasync_init)
+        || !ENGINE_set_finish_function(e, dasync_finish)) {
+        DASYNCerr(DASYNC_F_BIND_DASYNC, DASYNC_R_INIT_FAILED);
+        return 0;
+    }
+
+    return 1;
+}
+
+# ifndef OPENSSL_NO_DYNAMIC_ENGINE
+static int bind_helper(ENGINE *e, const char *id)
+{
+    if (id && (strcmp(id, engine_dasync_id) != 0))
+        return 0;
+    if (!bind_dasync(e))
+        return 0;
+    return 1;
+}
+
+IMPLEMENT_DYNAMIC_CHECK_FN()
+    IMPLEMENT_DYNAMIC_BIND_FN(bind_helper)
+# endif
+
+static ENGINE *engine_dasync(void)
+{
+    ENGINE *ret = ENGINE_new();
+    if (!ret)
+        return NULL;
+    if (!bind_dasync(ret)) {
+        ENGINE_free(ret);
+        return NULL;
+    }
+    return ret;
+}
+
+void ENGINE_load_dasync(void)
+{
+    ENGINE *toadd = engine_dasync();
+    if (!toadd)
+        return;
+    ENGINE_add(toadd);
+    ENGINE_free(toadd);
+    ERR_clear_error();
+}
+
+static int dasync_init(ENGINE *e)
+{
+    return 1;
+}
+
+
+static int dasync_finish(ENGINE *e)
+{
+    return 1;
+}
+
+
+static int dasync_destroy(ENGINE *e)
+{
+    ERR_unload_DASYNC_strings();
+    return 1;
+}
+
+static int dasync_digests(ENGINE *e, const EVP_MD **digest,
+                          const int **nids, int nid)
+{
+    int ok = 1;
+    if (!digest) {
+        /* We are returning a list of supported nids */
+        *nids = dasync_digest_nids;
+        return (sizeof(dasync_digest_nids) -
+                1) / sizeof(dasync_digest_nids[0]);
+    }
+    /* We are being asked for a specific digest */
+    switch (nid) {
+    case NID_sha1:
+        *digest = &dasync_sha1;
+        break;
+    default:
+        ok = 0;
+        *digest = NULL;
+        break;
+    }
+    return ok;
+}
+
+static void dummy_pause_job(void) {
+    ASYNC_JOB *job;
+
+    if ((job = ASYNC_get_current_job()) == NULL)
+        return;
+
+    /*
+     * In the Dummy async engine we are cheating. We signal that the job
+     * is complete by waking it before the call to ASYNC_pause_job(). A real
+     * async engine would only wake when the job was actually complete
+     */
+    ASYNC_wake(job);
+
+    /* Ignore errors - we carry on anyway */
+    ASYNC_pause_job();
+
+    ASYNC_clear_wake(job);
+}
+
+
+/*
+ * SHA1 implementation. At the moment we just defer to the standard
+ * implementation
+ */
+#undef data
+#define data(ctx) ((SHA_CTX *)(ctx)->md_data)
+static int dasync_sha1_init(EVP_MD_CTX *ctx)
+{
+    dummy_pause_job();
+
+    return SHA1_Init(data(ctx));
+}
+
+static int dasync_sha1_update(EVP_MD_CTX *ctx, const void *data,
+                             unsigned long count)
+{
+    dummy_pause_job();
+
+    return SHA1_Update(data(ctx), data, (size_t)count);
+}
+
+static int dasync_sha1_final(EVP_MD_CTX *ctx, unsigned char *md)
+{
+    dummy_pause_job();
+
+    return SHA1_Final(md, data(ctx));
+}
+
+/*
+ * RSA implementation
+ */
+
+static int dasync_pub_enc(int flen, const unsigned char *from,
+                    unsigned char *to, RSA *rsa, int padding) {
+    /* Ignore errors - we carry on anyway */
+    dummy_pause_job();
+    return RSA_PKCS1_OpenSSL()->rsa_pub_enc(flen, from, to, rsa, padding);
+}
+
+static int dasync_pub_dec(int flen, const unsigned char *from,
+                    unsigned char *to, RSA *rsa, int padding) {
+    /* Ignore errors - we carry on anyway */
+    dummy_pause_job();
+    return RSA_PKCS1_OpenSSL()->rsa_pub_dec(flen, from, to, rsa, padding);
+}
+
+static int dasync_rsa_priv_enc(int flen, const unsigned char *from,
+                      unsigned char *to, RSA *rsa, int padding)
+{
+    /* Ignore errors - we carry on anyway */
+    dummy_pause_job();
+    return RSA_PKCS1_OpenSSL()->rsa_priv_enc(flen, from, to, rsa, padding);
+}
+
+static int dasync_rsa_priv_dec(int flen, const unsigned char *from,
+                      unsigned char *to, RSA *rsa, int padding)
+{
+    /* Ignore errors - we carry on anyway */
+    dummy_pause_job();
+    return RSA_PKCS1_OpenSSL()->rsa_priv_dec(flen, from, to, rsa, padding);
+}
+
+static int dasync_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx)
+{
+    /* Ignore errors - we carry on anyway */
+    dummy_pause_job();
+    return RSA_PKCS1_OpenSSL()->rsa_mod_exp(r0, I, rsa, ctx);
+}
+
+static int dasync_rsa_init(RSA *rsa)
+{
+    return RSA_PKCS1_OpenSSL()->init(rsa);
+}
+static int dasync_rsa_finish(RSA *rsa)
+{
+    return RSA_PKCS1_OpenSSL()->finish(rsa);
+}
diff --git a/engines/e_dasync.ec b/engines/e_dasync.ec
new file mode 100644
index 0000000..385faa0
--- /dev/null
+++ b/engines/e_dasync.ec
@@ -0,0 +1 @@
+L       DASYNC    e_dasync_err.h e_dasync_err.c
diff --git a/engines/e_ossltest_err.c b/engines/e_dasync_err.c
similarity index 57%
copy from engines/e_ossltest_err.c
copy to engines/e_dasync_err.c
index 4abb395..a222899 100644
--- a/engines/e_ossltest_err.c
+++ b/engines/e_dasync_err.c
@@ -1,4 +1,4 @@
-/* e_ossltest_err.c */
+/* e_dasync_err.c */
 /* ====================================================================
  * Copyright (c) 1999-2015 The OpenSSL Project.  All rights reserved.
  *
@@ -7,7 +7,7 @@
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
+ *    notice, this list of conditions and the following disclaimer. 
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
@@ -53,83 +53,95 @@
  *
  */
 
-/*
- * NOTE: this file was auto generated by the mkerr.pl script: any changes
+/* NOTE: this file was auto generated by the mkerr.pl script: any changes
  * made to it will be overwritten when the script next updates this file,
  * only reason strings will be preserved.
  */
 
 #include <stdio.h>
 #include <openssl/err.h>
-#include "e_ossltest_err.h"
+#include "e_dasync_err.h"
 
 /* BEGIN ERROR CODES */
 #ifndef OPENSSL_NO_ERR
 
-# define ERR_FUNC(func) ERR_PACK(0,func,0)
-# define ERR_REASON(reason) ERR_PACK(0,0,reason)
+#define ERR_FUNC(func) ERR_PACK(0,func,0)
+#define ERR_REASON(reason) ERR_PACK(0,0,reason)
 
-static ERR_STRING_DATA OSSLTEST_str_functs[] = {
-    {ERR_FUNC(OSSLTEST_F_BIND_OSSLTEST), "BIND_OSSLTEST"},
-    {ERR_FUNC(OSSLTEST_F_OSSLTEST_AES128_INIT_KEY),
-     "OSSLTEST_AES128_INIT_KEY"},
-    {0, NULL}
-};
+static ERR_STRING_DATA DASYNC_str_functs[]=
+	{
+{ERR_FUNC(DASYNC_F_BIND_DASYNC),	"BIND_DASYNC"},
+{ERR_FUNC(DASYNC_F_CIPHER_AES_128_CBC_CODE),	"CIPHER_AES_128_CBC_CODE"},
+{ERR_FUNC(DASYNC_F_DASYNC_BN_MOD_EXP),	"DASYNC_BN_MOD_EXP"},
+{ERR_FUNC(DASYNC_F_DASYNC_MOD_EXP),	"DASYNC_MOD_EXP"},
+{ERR_FUNC(DASYNC_F_DASYNC_PRIVATE_DECRYPT),	"DASYNC_PRIVATE_DECRYPT"},
+{ERR_FUNC(DASYNC_F_DASYNC_PRIVATE_ENCRYPT),	"DASYNC_PRIVATE_ENCRYPT"},
+{ERR_FUNC(DASYNC_F_DASYNC_PUBLIC_DECRYPT),	"DASYNC_PUBLIC_DECRYPT"},
+{ERR_FUNC(DASYNC_F_DASYNC_PUBLIC_ENCRYPT),	"DASYNC_PUBLIC_ENCRYPT"},
+{0,NULL}
+	};
 
-static ERR_STRING_DATA OSSLTEST_str_reasons[] = {
-    {ERR_REASON(OSSLTEST_R_INIT_FAILED), "init failed"},
-    {0, NULL}
-};
+static ERR_STRING_DATA DASYNC_str_reasons[]=
+	{
+{ERR_REASON(DASYNC_R_INIT_FAILED)        ,"init failed"},
+{ERR_REASON(DASYNC_R_LENGTH_NOT_BLOCK_ALIGNED),"length not block aligned"},
+{ERR_REASON(DASYNC_R_UNKNOWN_FAULT)      ,"unknown fault"},
+{0,NULL}
+	};
 
 #endif
 
-#ifdef OSSLTEST_LIB_NAME
-static ERR_STRING_DATA OSSLTEST_lib_name[] = {
-    {0, OSSLTEST_LIB_NAME},
-    {0, NULL}
-};
+#ifdef DASYNC_LIB_NAME
+static ERR_STRING_DATA DASYNC_lib_name[]=
+        {
+{0	,DASYNC_LIB_NAME},
+{0,NULL}
+	};
 #endif
 
-static int OSSLTEST_lib_error_code = 0;
-static int OSSLTEST_error_init = 1;
 
-static void ERR_load_OSSLTEST_strings(void)
-{
-    if (OSSLTEST_lib_error_code == 0)
-        OSSLTEST_lib_error_code = ERR_get_next_error_library();
+static int DASYNC_lib_error_code=0;
+static int DASYNC_error_init=1;
 
-    if (OSSLTEST_error_init) {
-        OSSLTEST_error_init = 0;
+static void ERR_load_DASYNC_strings(void)
+	{
+	if (DASYNC_lib_error_code == 0)
+		DASYNC_lib_error_code=ERR_get_next_error_library();
+
+	if (DASYNC_error_init)
+		{
+		DASYNC_error_init=0;
 #ifndef OPENSSL_NO_ERR
-        ERR_load_strings(OSSLTEST_lib_error_code, OSSLTEST_str_functs);
-        ERR_load_strings(OSSLTEST_lib_error_code, OSSLTEST_str_reasons);
+		ERR_load_strings(DASYNC_lib_error_code,DASYNC_str_functs);
+		ERR_load_strings(DASYNC_lib_error_code,DASYNC_str_reasons);
 #endif
 
-#ifdef OSSLTEST_LIB_NAME
-        OSSLTEST_lib_name->error = ERR_PACK(OSSLTEST_lib_error_code, 0, 0);
-        ERR_load_strings(0, OSSLTEST_lib_name);
+#ifdef DASYNC_LIB_NAME
+		DASYNC_lib_name->error = ERR_PACK(DASYNC_lib_error_code,0,0);
+		ERR_load_strings(0,DASYNC_lib_name);
 #endif
-    }
-}
+		}
+	}
 
-static void ERR_unload_OSSLTEST_strings(void)
-{
-    if (OSSLTEST_error_init == 0) {
+static void ERR_unload_DASYNC_strings(void)
+	{
+	if (DASYNC_error_init == 0)
+		{
 #ifndef OPENSSL_NO_ERR
-        ERR_unload_strings(OSSLTEST_lib_error_code, OSSLTEST_str_functs);
-        ERR_unload_strings(OSSLTEST_lib_error_code, OSSLTEST_str_reasons);
+		ERR_unload_strings(DASYNC_lib_error_code,DASYNC_str_functs);
+		ERR_unload_strings(DASYNC_lib_error_code,DASYNC_str_reasons);
 #endif
 
-#ifdef OSSLTEST_LIB_NAME
-        ERR_unload_strings(0, OSSLTEST_lib_name);
+#ifdef DASYNC_LIB_NAME
+		ERR_unload_strings(0,DASYNC_lib_name);
 #endif
-        OSSLTEST_error_init = 1;
-    }
-}
-
-static void ERR_OSSLTEST_error(int function, int reason, char *file, int line)
-{
-    if (OSSLTEST_lib_error_code == 0)
-        OSSLTEST_lib_error_code = ERR_get_next_error_library();
-    ERR_PUT_error(OSSLTEST_lib_error_code, function, reason, file, line);
-}
+		DASYNC_error_init=1;
+		}
+	}
+
+static void ERR_DASYNC_error(int function, int reason, char *file, int line)
+	{
+	if (DASYNC_lib_error_code == 0)
+		DASYNC_lib_error_code=ERR_get_next_error_library();
+	ERR_PUT_error(DASYNC_lib_error_code,function,reason,file,line);
+	}
diff --git a/engines/e_ossltest_err.h b/engines/e_dasync_err.h
similarity index 76%
copy from engines/e_ossltest_err.h
copy to engines/e_dasync_err.h
index b46eb05..943bfec 100644
--- a/engines/e_ossltest_err.h
+++ b/engines/e_dasync_err.h
@@ -52,31 +52,38 @@
  *
  */
 
-#ifndef HEADER_OSSLTEST_ERR_H
-# define HEADER_OSSLTEST_ERR_H
+#ifndef HEADER_DASYNC_ERR_H
+# define HEADER_DASYNC_ERR_H
 
 #ifdef  __cplusplus
 extern "C" {
 #endif
 
 /* BEGIN ERROR CODES */
-/*
- * The following lines are auto generated by the script mkerr.pl. Any changes
+/* The following lines are auto generated by the script mkerr.pl. Any changes
  * made after this point may be overwritten when the script is next run.
  */
-static void ERR_load_OSSLTEST_strings(void);
-static void ERR_unload_OSSLTEST_strings(void);
-static void ERR_OSSLTEST_error(int function, int reason, char *file, int line);
-# define OSSLTESTerr(f,r) ERR_OSSLTEST_error((f),(r),__FILE__,__LINE__)
+static void ERR_load_DASYNC_strings(void);
+static void ERR_unload_DASYNC_strings(void);
+static void ERR_DASYNC_error(int function, int reason, char *file, int line);
+#define DASYNCerr(f,r) ERR_DASYNC_error((f),(r),__FILE__,__LINE__)
 
-/* Error codes for the OSSLTEST functions. */
+/* Error codes for the DASYNC functions. */
 
 /* Function codes. */
-# define OSSLTEST_F_BIND_OSSLTEST                         100
-# define OSSLTEST_F_OSSLTEST_AES128_INIT_KEY              101
+#define DASYNC_F_BIND_DASYNC				 107
+#define DASYNC_F_CIPHER_AES_128_CBC_CODE		 100
+#define DASYNC_F_DASYNC_BN_MOD_EXP			 101
+#define DASYNC_F_DASYNC_MOD_EXP				 102
+#define DASYNC_F_DASYNC_PRIVATE_DECRYPT			 103
+#define DASYNC_F_DASYNC_PRIVATE_ENCRYPT			 104
+#define DASYNC_F_DASYNC_PUBLIC_DECRYPT			 105
+#define DASYNC_F_DASYNC_PUBLIC_ENCRYPT			 106
 
 /* Reason codes. */
-# define OSSLTEST_R_INIT_FAILED                           100
+#define DASYNC_R_INIT_FAILED				 102
+#define DASYNC_R_LENGTH_NOT_BLOCK_ALIGNED		 100
+#define DASYNC_R_UNKNOWN_FAULT				 101
 
 #ifdef  __cplusplus
 }
diff --git a/include/openssl/comp.h b/include/openssl/async.h
similarity index 57%
copy from include/openssl/comp.h
copy to include/openssl/async.h
index c7d903f..de5ef89 100644
--- a/include/openssl/comp.h
+++ b/include/openssl/async.h
@@ -1,5 +1,9 @@
+/* include/openssl/async.h */
+/*
+ * Written by Matt Caswell (matt at openssl.org) for the OpenSSL project.
+ */
 /* ====================================================================
- * Copyright (c) 1999-2015 The OpenSSL Project.  All rights reserved.
+ * Copyright (c) 2015 The OpenSSL Project.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -21,7 +25,7 @@
  * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
  *    endorse or promote products derived from this software without
  *    prior written permission. For written permission, please contact
- *    openssl-core at OpenSSL.org.
+ *    licensing at OpenSSL.org.
  *
  * 5. Products derived from this software may not be called "OpenSSL"
  *    nor may "OpenSSL" appear in their names without prior written
@@ -45,64 +49,72 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  * OF THE POSSIBILITY OF SUCH DAMAGE.
  * ====================================================================
- *
- * This product includes cryptographic software written by Eric Young
- * (eay at cryptsoft.com).  This product includes software written by Tim
- * Hudson (tjh at cryptsoft.com).
- *
  */
 
+#ifndef HEADER_ASYNC_H
+# define HEADER_ASYNC_H
+
+#include <stdlib.h>
 
-#ifndef HEADER_COMP_H
-# define HEADER_COMP_H
+#if defined(_WIN32) || defined(__CYGWIN__)
+#include <windows.h>
+#define OSSL_ASYNC_FD   HANDLE
+#else
+#define OSSL_ASYNC_FD   int
+#endif
 
-# include <openssl/crypto.h>
 
-#ifdef  __cplusplus
+# ifdef  __cplusplus
 extern "C" {
-#endif
+# endif
 
+typedef struct async_job_st ASYNC_JOB;
 
-COMP_CTX *COMP_CTX_new(COMP_METHOD *meth);
-const COMP_METHOD *COMP_CTX_get_method(const COMP_CTX *ctx);
-int COMP_CTX_get_type(const COMP_CTX* comp);
-int COMP_get_type(const COMP_METHOD *meth);
-const char *COMP_get_name(const COMP_METHOD *meth);
-void COMP_CTX_free(COMP_CTX *ctx);
+#define ASYNC_ERR      0
+#define ASYNC_NO_JOBS  1
+#define ASYNC_PAUSE    2
+#define ASYNC_FINISH   3
 
-int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen,
-                        unsigned char *in, int ilen);
-int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen,
-                      unsigned char *in, int ilen);
+int ASYNC_init(int init_thread, size_t max_size, size_t init_size);
+void ASYNC_cleanup(int cleanupthread);
+int ASYNC_init_thread(size_t max_size, size_t init_size);
+void ASYNC_cleanup_thread(void);
 
-COMP_METHOD *COMP_zlib(void);
-void COMP_zlib_cleanup(void);
+int ASYNC_start_job(ASYNC_JOB **job, int *ret, int (*func)(void *),
+                         void *args, size_t size);
+int ASYNC_pause_job(void);
 
-# ifdef HEADER_BIO_H
-#  ifdef ZLIB
-BIO_METHOD *BIO_f_zlib(void);
-#  endif
-# endif
+OSSL_ASYNC_FD ASYNC_get_wait_fd(ASYNC_JOB *job);
+ASYNC_JOB *ASYNC_get_current_job(void);
+void ASYNC_wake(ASYNC_JOB *job);
+void ASYNC_clear_wake(ASYNC_JOB *job);
+void ASYNC_block_pause(void);
+void ASYNC_unblock_pause(void);
 
 /* BEGIN ERROR CODES */
 /*
  * The following lines are auto generated by the script mkerr.pl. Any changes
  * made after this point may be overwritten when the script is next run.
  */
-void ERR_load_COMP_strings(void);
+void ERR_load_ASYNC_strings(void);
 
-/* Error codes for the COMP functions. */
+/* Error codes for the ASYNC functions. */
 
 /* Function codes. */
-# define COMP_F_BIO_ZLIB_FLUSH                            99
-# define COMP_F_BIO_ZLIB_NEW                              100
-# define COMP_F_BIO_ZLIB_READ                             101
-# define COMP_F_BIO_ZLIB_WRITE                            102
+# define ASYNC_F_ASYNC_CTX_NEW                            100
+# define ASYNC_F_ASYNC_INIT_THREAD                        101
+# define ASYNC_F_ASYNC_JOB_NEW                            102
+# define ASYNC_F_ASYNC_PAUSE_JOB                          103
+# define ASYNC_F_ASYNC_START_FUNC                         104
+# define ASYNC_F_ASYNC_START_JOB                          105
 
 /* Reason codes. */
-# define COMP_R_ZLIB_DEFLATE_ERROR                        99
-# define COMP_R_ZLIB_INFLATE_ERROR                        100
-# define COMP_R_ZLIB_NOT_SUPPORTED                        101
+# define ASYNC_R_CANNOT_CREATE_WAIT_PIPE                  100
+# define ASYNC_R_FAILED_TO_SET_POOL                       101
+# define ASYNC_R_FAILED_TO_SWAP_CONTEXT                   102
+# define ASYNC_R_INIT_FAILED                              105
+# define ASYNC_R_INVALID_POOL_SIZE                        103
+# define ASYNC_R_POOL_ALREADY_INITED                      104
 
 #ifdef  __cplusplus
 }
diff --git a/include/openssl/engine.h b/include/openssl/engine.h
index c228487..7a9b495 100644
--- a/include/openssl/engine.h
+++ b/include/openssl/engine.h
@@ -409,6 +409,7 @@ void ENGINE_load_gmp(void);
 #  ifndef OPENSSL_NO_GOST
 void ENGINE_load_gost(void);
 #  endif
+void ENGINE_load_dasync(void);
 # endif
 void ENGINE_load_cryptodev(void);
 void ENGINE_load_rdrand(void);
diff --git a/include/openssl/err.h b/include/openssl/err.h
index 4c6d8d4..79bf6a3 100644
--- a/include/openssl/err.h
+++ b/include/openssl/err.h
@@ -194,6 +194,7 @@ typedef struct err_state_st {
 # define ERR_LIB_HMAC            48
 # define ERR_LIB_JPAKE           49
 # define ERR_LIB_CT              50
+# define ERR_LIB_ASYNC           51
 
 # define ERR_LIB_USER            128
 
@@ -231,6 +232,7 @@ typedef struct err_state_st {
 # define HMACerr(f,r) ERR_PUT_error(ERR_LIB_HMAC,(f),(r),__FILE__,__LINE__)
 # define JPAKEerr(f,r) ERR_PUT_error(ERR_LIB_JPAKE,(f),(r),__FILE__,__LINE__)
 # define CTerr(f,r) ERR_PUT_error(ERR_LIB_CT,(f),(r),__FILE__,__LINE__)
+# define ASYNCerr(f,r) ERR_PUT_error(ERR_LIB_ASYNC,(f),(r),__FILE__,__LINE__)
 
 /*
  * Borland C seems too stupid to be able to shift and do longs in the
diff --git a/include/openssl/safestack.h b/include/openssl/safestack.h
index 785bec6..f2fa57c 100644
--- a/include/openssl/safestack.h
+++ b/include/openssl/safestack.h
@@ -412,6 +412,29 @@ DECLARE_SPECIAL_STACK_OF(OPENSSL_BLOCK, void)
 # define sk_ASN1_VALUE_sort(st) SKM_sk_sort(ASN1_VALUE, (st))
 # define sk_ASN1_VALUE_is_sorted(st) SKM_sk_is_sorted(ASN1_VALUE, (st))
 
+# define sk_ASYNC_JOB_new(cmp) SKM_sk_new(ASYNC_JOB, (cmp))
+# define sk_ASYNC_JOB_new_null() SKM_sk_new_null(ASYNC_JOB)
+# define sk_ASYNC_JOB_free(st) SKM_sk_free(ASYNC_JOB, (st))
+# define sk_ASYNC_JOB_num(st) SKM_sk_num(ASYNC_JOB, (st))
+# define sk_ASYNC_JOB_value(st, i) SKM_sk_value(ASYNC_JOB, (st), (i))
+# define sk_ASYNC_JOB_set(st, i, val) SKM_sk_set(ASYNC_JOB, (st), (i), (val))
+# define sk_ASYNC_JOB_zero(st) SKM_sk_zero(ASYNC_JOB, (st))
+# define sk_ASYNC_JOB_push(st, val) SKM_sk_push(ASYNC_JOB, (st), (val))
+# define sk_ASYNC_JOB_unshift(st, val) SKM_sk_unshift(ASYNC_JOB, (st), (val))
+# define sk_ASYNC_JOB_find(st, val) SKM_sk_find(ASYNC_JOB, (st), (val))
+# define sk_ASYNC_JOB_find_ex(st, val) SKM_sk_find_ex(ASYNC_JOB, (st), (val))
+# define sk_ASYNC_JOB_delete(st, i) SKM_sk_delete(ASYNC_JOB, (st), (i))
+# define sk_ASYNC_JOB_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASYNC_JOB, (st), (ptr))
+# define sk_ASYNC_JOB_insert(st, val, i) SKM_sk_insert(ASYNC_JOB, (st), (val), (i))
+# define sk_ASYNC_JOB_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASYNC_JOB, (st), (cmp))
+# define sk_ASYNC_JOB_dup(st) SKM_sk_dup(ASYNC_JOB, st)
+# define sk_ASYNC_JOB_pop_free(st, free_func) SKM_sk_pop_free(ASYNC_JOB, (st), (free_func))
+# define sk_ASYNC_JOB_deep_copy(st, copy_func, free_func) SKM_sk_deep_copy(ASYNC_JOB, (st), (copy_func), (free_func))
+# define sk_ASYNC_JOB_shift(st) SKM_sk_shift(ASYNC_JOB, (st))
+# define sk_ASYNC_JOB_pop(st) SKM_sk_pop(ASYNC_JOB, (st))
+# define sk_ASYNC_JOB_sort(st) SKM_sk_sort(ASYNC_JOB, (st))
+# define sk_ASYNC_JOB_is_sorted(st) SKM_sk_is_sorted(ASYNC_JOB, (st))
+
 # define sk_BIO_new(cmp) SKM_sk_new(BIO, (cmp))
 # define sk_BIO_new_null() SKM_sk_new_null(BIO)
 # define sk_BIO_free(st) SKM_sk_free(BIO, (st))
diff --git a/include/openssl/ssl.h b/include/openssl/ssl.h
index 5ee403b..cf0c7e1 100644
--- a/include/openssl/ssl.h
+++ b/include/openssl/ssl.h
@@ -490,6 +490,10 @@ typedef int (*custom_ext_parse_cb) (SSL *s, unsigned int ext_type,
  * draft-ietf-tls-downgrade-scsv-00.
  */
 # define SSL_MODE_SEND_FALLBACK_SCSV 0x00000080U
+/*
+ * Support Asynchronous operation
+ */
+# define SSL_MODE_ASYNC 0x00000100U
 
 /* Cert related flags */
 /*
@@ -874,16 +878,18 @@ __owur int SSL_CTX_add_server_custom_ext(SSL_CTX *ctx, unsigned int ext_type,
 
 __owur int SSL_extension_supported(unsigned int ext_type);
 
-# define SSL_NOTHING     1
-# define SSL_WRITING     2
-# define SSL_READING     3
-# define SSL_X509_LOOKUP 4
+# define SSL_NOTHING            1
+# define SSL_WRITING            2
+# define SSL_READING            3
+# define SSL_X509_LOOKUP        4
+# define SSL_ASYNC_PAUSED       5
 
 /* These will only be used when doing non-blocking IO */
 # define SSL_want_nothing(s)     (SSL_want(s) == SSL_NOTHING)
 # define SSL_want_read(s)        (SSL_want(s) == SSL_READING)
 # define SSL_want_write(s)       (SSL_want(s) == SSL_WRITING)
 # define SSL_want_x509_lookup(s) (SSL_want(s) == SSL_X509_LOOKUP)
+# define SSL_want_async(s)       (SSL_want(s) == SSL_ASYNC_PAUSED)
 
 # define SSL_MAC_FLAG_READ_MAC_STREAM 1
 # define SSL_MAC_FLAG_WRITE_MAC_STREAM 2
@@ -1102,6 +1108,7 @@ DECLARE_PEM_rw(SSL_SESSION, SSL_SESSION)
 # define SSL_ERROR_ZERO_RETURN           6
 # define SSL_ERROR_WANT_CONNECT          7
 # define SSL_ERROR_WANT_ACCEPT           8
+# define SSL_ERROR_WANT_ASYNC            9
 # define SSL_CTRL_NEED_TMP_RSA                   1
 # define SSL_CTRL_SET_TMP_RSA                    2
 # define SSL_CTRL_SET_TMP_DH                     3
@@ -1564,6 +1571,8 @@ __owur char *SSL_get_srp_userinfo(SSL *s);
 
 void SSL_certs_clear(SSL *s);
 void SSL_free(SSL *ssl);
+__owur int SSL_waiting_for_async(SSL *s);
+__owur int SSL_get_async_wait_fd(SSL *s);
 __owur int SSL_accept(SSL *ssl);
 __owur int SSL_connect(SSL *ssl);
 __owur int SSL_read(SSL *ssl, void *buf, int num);
@@ -2024,6 +2033,7 @@ void ERR_load_SSL_strings(void);
 # define SSL_F_SSL3_SETUP_WRITE_BUFFER                    291
 # define SSL_F_SSL3_WRITE_BYTES                           158
 # define SSL_F_SSL3_WRITE_PENDING                         159
+# define SSL_F_SSL_ACCEPT                                 351
 # define SSL_F_SSL_ADD_CERT_CHAIN                         316
 # define SSL_F_SSL_ADD_CERT_TO_BUF                        319
 # define SSL_F_SSL_ADD_CLIENTHELLO_RENEGOTIATE_EXT        298
@@ -2114,6 +2124,7 @@ void ERR_load_SSL_strings(void);
 # define SSL_F_SSL_SET_WFD                                196
 # define SSL_F_SSL_SHUTDOWN                               224
 # define SSL_F_SSL_SRP_CTX_INIT                           313
+# define SSL_F_SSL_START_ASYNC_JOB                        388
 # define SSL_F_SSL_UNDEFINED_CONST_FUNCTION               243
 # define SSL_F_SSL_UNDEFINED_FUNCTION                     197
 # define SSL_F_SSL_UNDEFINED_VOID_FUNCTION                244
@@ -2266,6 +2277,7 @@ void ERR_load_SSL_strings(void);
 # define SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST              151
 # define SSL_R_EXCESSIVE_MESSAGE_SIZE                     152
 # define SSL_R_EXTRA_DATA_IN_MESSAGE                      153
+# define SSL_R_FAILED_TO_INIT_ASYNC                       405
 # define SSL_R_FRAGMENTED_CLIENT_HELLO                    401
 # define SSL_R_GOT_A_FIN_BEFORE_A_CCS                     154
 # define SSL_R_GOT_NEXT_PROTO_BEFORE_A_CCS                355
diff --git a/ssl/Makefile b/ssl/Makefile
index 0865631..10f75b7 100644
--- a/ssl/Makefile
+++ b/ssl/Makefile
@@ -98,115 +98,117 @@ clean:
 	
 # DO NOT DELETE THIS LINE -- make depend depends on it.
 
-bio_ssl.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-bio_ssl.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-bio_ssl.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-bio_ssl.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-bio_ssl.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-bio_ssl.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-bio_ssl.o: ../include/openssl/err.h ../include/openssl/evp.h
-bio_ssl.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
-bio_ssl.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-bio_ssl.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-bio_ssl.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-bio_ssl.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-bio_ssl.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
-bio_ssl.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-bio_ssl.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
-bio_ssl.o: ../include/openssl/ssl2.h ../include/openssl/ssl3.h
-bio_ssl.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-bio_ssl.o: ../include/openssl/tls1.h ../include/openssl/x509.h
-bio_ssl.o: ../include/openssl/x509_vfy.h bio_ssl.c packet_locl.h
-bio_ssl.o: record/record.h ssl_locl.h statem/statem.h
-d1_lib.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-d1_lib.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-d1_lib.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-d1_lib.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-d1_lib.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-d1_lib.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-d1_lib.o: ../include/openssl/err.h ../include/openssl/evp.h
-d1_lib.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
-d1_lib.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-d1_lib.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-d1_lib.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-d1_lib.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-d1_lib.o: ../include/openssl/pqueue.h ../include/openssl/rand.h
-d1_lib.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-d1_lib.o: ../include/openssl/sha.h ../include/openssl/srtp.h
-d1_lib.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
-d1_lib.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
-d1_lib.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
-d1_lib.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h d1_lib.c
-d1_lib.o: packet_locl.h record/record.h ssl_locl.h statem/statem.h
-d1_msg.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-d1_msg.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-d1_msg.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-d1_msg.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-d1_msg.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-d1_msg.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-d1_msg.o: ../include/openssl/err.h ../include/openssl/evp.h
-d1_msg.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
-d1_msg.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-d1_msg.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-d1_msg.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-d1_msg.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-d1_msg.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
-d1_msg.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-d1_msg.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
-d1_msg.o: ../include/openssl/ssl2.h ../include/openssl/ssl3.h
-d1_msg.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-d1_msg.o: ../include/openssl/tls1.h ../include/openssl/x509.h
-d1_msg.o: ../include/openssl/x509_vfy.h d1_msg.c packet_locl.h record/record.h
-d1_msg.o: ssl_locl.h statem/statem.h
-d1_srtp.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-d1_srtp.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-d1_srtp.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-d1_srtp.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-d1_srtp.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-d1_srtp.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-d1_srtp.o: ../include/openssl/err.h ../include/openssl/evp.h
-d1_srtp.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
-d1_srtp.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-d1_srtp.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-d1_srtp.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-d1_srtp.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-d1_srtp.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
-d1_srtp.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-d1_srtp.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
-d1_srtp.o: ../include/openssl/ssl2.h ../include/openssl/ssl3.h
-d1_srtp.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-d1_srtp.o: ../include/openssl/tls1.h ../include/openssl/x509.h
-d1_srtp.o: ../include/openssl/x509_vfy.h d1_srtp.c packet_locl.h
-d1_srtp.o: record/record.h ssl_locl.h statem/statem.h
-methods.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-methods.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-methods.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-methods.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-methods.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-methods.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-methods.o: ../include/openssl/err.h ../include/openssl/evp.h
-methods.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
-methods.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-methods.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-methods.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-methods.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-methods.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
-methods.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-methods.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
-methods.o: ../include/openssl/ssl2.h ../include/openssl/ssl3.h
-methods.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-methods.o: ../include/openssl/tls1.h ../include/openssl/x509.h
-methods.o: ../include/openssl/x509_vfy.h methods.c packet_locl.h
-methods.o: record/record.h ssl_locl.h statem/statem.h
+bio_ssl.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+bio_ssl.o: ../include/openssl/bio.h ../include/openssl/bn.h
+bio_ssl.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+bio_ssl.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+bio_ssl.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+bio_ssl.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+bio_ssl.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+bio_ssl.o: ../include/openssl/evp.h ../include/openssl/hmac.h
+bio_ssl.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+bio_ssl.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+bio_ssl.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+bio_ssl.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+bio_ssl.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
+bio_ssl.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+bio_ssl.o: ../include/openssl/sha.h ../include/openssl/srtp.h
+bio_ssl.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+bio_ssl.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
+bio_ssl.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
+bio_ssl.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h bio_ssl.c
+bio_ssl.o: packet_locl.h record/record.h ssl_locl.h statem/statem.h
+d1_lib.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+d1_lib.o: ../include/openssl/bio.h ../include/openssl/bn.h
+d1_lib.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+d1_lib.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+d1_lib.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+d1_lib.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+d1_lib.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+d1_lib.o: ../include/openssl/evp.h ../include/openssl/hmac.h
+d1_lib.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+d1_lib.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+d1_lib.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+d1_lib.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+d1_lib.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
+d1_lib.o: ../include/openssl/rand.h ../include/openssl/rsa.h
+d1_lib.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+d1_lib.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
+d1_lib.o: ../include/openssl/ssl2.h ../include/openssl/ssl3.h
+d1_lib.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+d1_lib.o: ../include/openssl/tls1.h ../include/openssl/x509.h
+d1_lib.o: ../include/openssl/x509_vfy.h d1_lib.c packet_locl.h record/record.h
+d1_lib.o: ssl_locl.h statem/statem.h
+d1_msg.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+d1_msg.o: ../include/openssl/bio.h ../include/openssl/bn.h
+d1_msg.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+d1_msg.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+d1_msg.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+d1_msg.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+d1_msg.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+d1_msg.o: ../include/openssl/evp.h ../include/openssl/hmac.h
+d1_msg.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+d1_msg.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+d1_msg.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+d1_msg.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+d1_msg.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
+d1_msg.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+d1_msg.o: ../include/openssl/sha.h ../include/openssl/srtp.h
+d1_msg.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+d1_msg.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
+d1_msg.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
+d1_msg.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h d1_msg.c
+d1_msg.o: packet_locl.h record/record.h ssl_locl.h statem/statem.h
+d1_srtp.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+d1_srtp.o: ../include/openssl/bio.h ../include/openssl/bn.h
+d1_srtp.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+d1_srtp.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+d1_srtp.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+d1_srtp.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+d1_srtp.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+d1_srtp.o: ../include/openssl/evp.h ../include/openssl/hmac.h
+d1_srtp.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+d1_srtp.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+d1_srtp.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+d1_srtp.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+d1_srtp.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
+d1_srtp.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+d1_srtp.o: ../include/openssl/sha.h ../include/openssl/srtp.h
+d1_srtp.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+d1_srtp.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
+d1_srtp.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
+d1_srtp.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h d1_srtp.c
+d1_srtp.o: packet_locl.h record/record.h ssl_locl.h statem/statem.h
+methods.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+methods.o: ../include/openssl/bio.h ../include/openssl/bn.h
+methods.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+methods.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+methods.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+methods.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+methods.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+methods.o: ../include/openssl/evp.h ../include/openssl/hmac.h
+methods.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+methods.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+methods.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+methods.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+methods.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
+methods.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+methods.o: ../include/openssl/sha.h ../include/openssl/srtp.h
+methods.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+methods.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
+methods.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
+methods.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h methods.c
+methods.o: packet_locl.h record/record.h ssl_locl.h statem/statem.h
 record/dtls1_bitmap.o: ../e_os.h ../include/openssl/asn1.h
-record/dtls1_bitmap.o: ../include/openssl/bio.h ../include/openssl/bn.h
-record/dtls1_bitmap.o: ../include/openssl/buffer.h ../include/openssl/comp.h
-record/dtls1_bitmap.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
-record/dtls1_bitmap.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
-record/dtls1_bitmap.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
-record/dtls1_bitmap.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
-record/dtls1_bitmap.o: ../include/openssl/evp.h ../include/openssl/hmac.h
-record/dtls1_bitmap.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+record/dtls1_bitmap.o: ../include/openssl/async.h ../include/openssl/bio.h
+record/dtls1_bitmap.o: ../include/openssl/bn.h ../include/openssl/buffer.h
+record/dtls1_bitmap.o: ../include/openssl/comp.h ../include/openssl/crypto.h
+record/dtls1_bitmap.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
+record/dtls1_bitmap.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+record/dtls1_bitmap.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
+record/dtls1_bitmap.o: ../include/openssl/err.h ../include/openssl/evp.h
+record/dtls1_bitmap.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
+record/dtls1_bitmap.o: ../include/openssl/obj_mac.h
 record/dtls1_bitmap.o: ../include/openssl/objects.h
 record/dtls1_bitmap.o: ../include/openssl/opensslconf.h
 record/dtls1_bitmap.o: ../include/openssl/opensslv.h
@@ -223,14 +225,15 @@ record/dtls1_bitmap.o: record/../record/record.h record/../ssl_locl.h
 record/dtls1_bitmap.o: record/../statem/statem.h record/dtls1_bitmap.c
 record/dtls1_bitmap.o: record/record_locl.h
 record/rec_layer_d1.o: ../e_os.h ../include/openssl/asn1.h
-record/rec_layer_d1.o: ../include/openssl/bio.h ../include/openssl/bn.h
-record/rec_layer_d1.o: ../include/openssl/buffer.h ../include/openssl/comp.h
-record/rec_layer_d1.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
-record/rec_layer_d1.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
-record/rec_layer_d1.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
-record/rec_layer_d1.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
-record/rec_layer_d1.o: ../include/openssl/evp.h ../include/openssl/hmac.h
-record/rec_layer_d1.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+record/rec_layer_d1.o: ../include/openssl/async.h ../include/openssl/bio.h
+record/rec_layer_d1.o: ../include/openssl/bn.h ../include/openssl/buffer.h
+record/rec_layer_d1.o: ../include/openssl/comp.h ../include/openssl/crypto.h
+record/rec_layer_d1.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
+record/rec_layer_d1.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+record/rec_layer_d1.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
+record/rec_layer_d1.o: ../include/openssl/err.h ../include/openssl/evp.h
+record/rec_layer_d1.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
+record/rec_layer_d1.o: ../include/openssl/obj_mac.h
 record/rec_layer_d1.o: ../include/openssl/objects.h
 record/rec_layer_d1.o: ../include/openssl/opensslconf.h
 record/rec_layer_d1.o: ../include/openssl/opensslv.h
@@ -247,14 +250,15 @@ record/rec_layer_d1.o: record/../packet_locl.h record/../record/record.h
 record/rec_layer_d1.o: record/../ssl_locl.h record/../statem/statem.h
 record/rec_layer_d1.o: record/rec_layer_d1.c record/record_locl.h
 record/rec_layer_s3.o: ../e_os.h ../include/openssl/asn1.h
-record/rec_layer_s3.o: ../include/openssl/bio.h ../include/openssl/bn.h
-record/rec_layer_s3.o: ../include/openssl/buffer.h ../include/openssl/comp.h
-record/rec_layer_s3.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
-record/rec_layer_s3.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
-record/rec_layer_s3.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
-record/rec_layer_s3.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
-record/rec_layer_s3.o: ../include/openssl/evp.h ../include/openssl/hmac.h
-record/rec_layer_s3.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+record/rec_layer_s3.o: ../include/openssl/async.h ../include/openssl/bio.h
+record/rec_layer_s3.o: ../include/openssl/bn.h ../include/openssl/buffer.h
+record/rec_layer_s3.o: ../include/openssl/comp.h ../include/openssl/crypto.h
+record/rec_layer_s3.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
+record/rec_layer_s3.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+record/rec_layer_s3.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
+record/rec_layer_s3.o: ../include/openssl/err.h ../include/openssl/evp.h
+record/rec_layer_s3.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
+record/rec_layer_s3.o: ../include/openssl/obj_mac.h
 record/rec_layer_s3.o: ../include/openssl/objects.h
 record/rec_layer_s3.o: ../include/openssl/opensslconf.h
 record/rec_layer_s3.o: ../include/openssl/opensslv.h
@@ -271,15 +275,15 @@ record/rec_layer_s3.o: record/../packet_locl.h record/../record/record.h
 record/rec_layer_s3.o: record/../ssl_locl.h record/../statem/statem.h
 record/rec_layer_s3.o: record/rec_layer_s3.c record/record_locl.h
 record/ssl3_buffer.o: ../e_os.h ../include/openssl/asn1.h
-record/ssl3_buffer.o: ../include/openssl/bio.h ../include/openssl/bn.h
-record/ssl3_buffer.o: ../include/openssl/buffer.h ../include/openssl/comp.h
-record/ssl3_buffer.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
-record/ssl3_buffer.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
-record/ssl3_buffer.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
-record/ssl3_buffer.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
-record/ssl3_buffer.o: ../include/openssl/evp.h ../include/openssl/hmac.h
-record/ssl3_buffer.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-record/ssl3_buffer.o: ../include/openssl/objects.h
+record/ssl3_buffer.o: ../include/openssl/async.h ../include/openssl/bio.h
+record/ssl3_buffer.o: ../include/openssl/bn.h ../include/openssl/buffer.h
+record/ssl3_buffer.o: ../include/openssl/comp.h ../include/openssl/crypto.h
+record/ssl3_buffer.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
+record/ssl3_buffer.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+record/ssl3_buffer.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
+record/ssl3_buffer.o: ../include/openssl/err.h ../include/openssl/evp.h
+record/ssl3_buffer.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
+record/ssl3_buffer.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
 record/ssl3_buffer.o: ../include/openssl/opensslconf.h
 record/ssl3_buffer.o: ../include/openssl/opensslv.h
 record/ssl3_buffer.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
@@ -295,15 +299,16 @@ record/ssl3_buffer.o: record/../record/record.h record/../ssl_locl.h
 record/ssl3_buffer.o: record/../statem/statem.h record/record_locl.h
 record/ssl3_buffer.o: record/ssl3_buffer.c
 record/ssl3_record.o: ../e_os.h ../include/internal/constant_time_locl.h
-record/ssl3_record.o: ../include/openssl/asn1.h ../include/openssl/bio.h
-record/ssl3_record.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-record/ssl3_record.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-record/ssl3_record.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-record/ssl3_record.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-record/ssl3_record.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-record/ssl3_record.o: ../include/openssl/err.h ../include/openssl/evp.h
-record/ssl3_record.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
-record/ssl3_record.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+record/ssl3_record.o: ../include/openssl/asn1.h ../include/openssl/async.h
+record/ssl3_record.o: ../include/openssl/bio.h ../include/openssl/bn.h
+record/ssl3_record.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+record/ssl3_record.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+record/ssl3_record.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+record/ssl3_record.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+record/ssl3_record.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+record/ssl3_record.o: ../include/openssl/evp.h ../include/openssl/hmac.h
+record/ssl3_record.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+record/ssl3_record.o: ../include/openssl/objects.h
 record/ssl3_record.o: ../include/openssl/opensslconf.h
 record/ssl3_record.o: ../include/openssl/opensslv.h
 record/ssl3_record.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
@@ -319,190 +324,195 @@ record/ssl3_record.o: record/../packet_locl.h record/../record/record.h
 record/ssl3_record.o: record/../ssl_locl.h record/../statem/statem.h
 record/ssl3_record.o: record/record_locl.h record/ssl3_record.c
 s3_cbc.o: ../e_os.h ../include/internal/constant_time_locl.h
-s3_cbc.o: ../include/openssl/asn1.h ../include/openssl/bio.h
-s3_cbc.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-s3_cbc.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-s3_cbc.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-s3_cbc.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-s3_cbc.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-s3_cbc.o: ../include/openssl/err.h ../include/openssl/evp.h
-s3_cbc.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
-s3_cbc.o: ../include/openssl/md5.h ../include/openssl/obj_mac.h
-s3_cbc.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
-s3_cbc.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-s3_cbc.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-s3_cbc.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
-s3_cbc.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-s3_cbc.o: ../include/openssl/sha.h ../include/openssl/srtp.h
-s3_cbc.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
-s3_cbc.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
-s3_cbc.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
-s3_cbc.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h packet_locl.h
-s3_cbc.o: record/record.h s3_cbc.c ssl_locl.h statem/statem.h
-s3_enc.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-s3_enc.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-s3_enc.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-s3_enc.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-s3_enc.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-s3_enc.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-s3_enc.o: ../include/openssl/err.h ../include/openssl/evp.h
-s3_enc.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
-s3_enc.o: ../include/openssl/md5.h ../include/openssl/obj_mac.h
-s3_enc.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
-s3_enc.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-s3_enc.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-s3_enc.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
-s3_enc.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-s3_enc.o: ../include/openssl/sha.h ../include/openssl/srtp.h
-s3_enc.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
-s3_enc.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
-s3_enc.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
-s3_enc.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h packet_locl.h
-s3_enc.o: record/record.h s3_enc.c ssl_locl.h statem/statem.h
-s3_lib.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-s3_lib.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-s3_lib.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-s3_lib.o: ../include/openssl/dh.h ../include/openssl/dsa.h
-s3_lib.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
-s3_lib.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
-s3_lib.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
-s3_lib.o: ../include/openssl/evp.h ../include/openssl/hmac.h
-s3_lib.o: ../include/openssl/lhash.h ../include/openssl/md5.h
-s3_lib.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-s3_lib.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-s3_lib.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-s3_lib.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-s3_lib.o: ../include/openssl/pqueue.h ../include/openssl/rand.h
-s3_lib.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-s3_lib.o: ../include/openssl/sha.h ../include/openssl/srtp.h
-s3_lib.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
-s3_lib.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
-s3_lib.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
-s3_lib.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h packet_locl.h
-s3_lib.o: record/record.h s3_lib.c ssl_locl.h statem/statem.h
-s3_msg.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-s3_msg.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-s3_msg.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-s3_msg.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-s3_msg.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-s3_msg.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-s3_msg.o: ../include/openssl/err.h ../include/openssl/evp.h
-s3_msg.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
-s3_msg.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-s3_msg.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-s3_msg.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-s3_msg.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-s3_msg.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
-s3_msg.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-s3_msg.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
-s3_msg.o: ../include/openssl/ssl2.h ../include/openssl/ssl3.h
-s3_msg.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-s3_msg.o: ../include/openssl/tls1.h ../include/openssl/x509.h
-s3_msg.o: ../include/openssl/x509_vfy.h packet_locl.h record/record.h s3_msg.c
-s3_msg.o: ssl_locl.h statem/statem.h
-ssl_algs.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-ssl_algs.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-ssl_algs.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-ssl_algs.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-ssl_algs.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-ssl_algs.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-ssl_algs.o: ../include/openssl/err.h ../include/openssl/evp.h
-ssl_algs.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
-ssl_algs.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-ssl_algs.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-ssl_algs.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-ssl_algs.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-ssl_algs.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
-ssl_algs.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-ssl_algs.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
-ssl_algs.o: ../include/openssl/ssl2.h ../include/openssl/ssl3.h
-ssl_algs.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-ssl_algs.o: ../include/openssl/tls1.h ../include/openssl/x509.h
-ssl_algs.o: ../include/openssl/x509_vfy.h packet_locl.h record/record.h
-ssl_algs.o: ssl_algs.c ssl_locl.h statem/statem.h
+s3_cbc.o: ../include/openssl/asn1.h ../include/openssl/async.h
+s3_cbc.o: ../include/openssl/bio.h ../include/openssl/bn.h
+s3_cbc.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+s3_cbc.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+s3_cbc.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+s3_cbc.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+s3_cbc.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+s3_cbc.o: ../include/openssl/evp.h ../include/openssl/hmac.h
+s3_cbc.o: ../include/openssl/lhash.h ../include/openssl/md5.h
+s3_cbc.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+s3_cbc.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+s3_cbc.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+s3_cbc.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+s3_cbc.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
+s3_cbc.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+s3_cbc.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
+s3_cbc.o: ../include/openssl/ssl2.h ../include/openssl/ssl3.h
+s3_cbc.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+s3_cbc.o: ../include/openssl/tls1.h ../include/openssl/x509.h
+s3_cbc.o: ../include/openssl/x509_vfy.h packet_locl.h record/record.h s3_cbc.c
+s3_cbc.o: ssl_locl.h statem/statem.h
+s3_enc.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+s3_enc.o: ../include/openssl/bio.h ../include/openssl/bn.h
+s3_enc.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+s3_enc.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+s3_enc.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+s3_enc.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+s3_enc.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+s3_enc.o: ../include/openssl/evp.h ../include/openssl/hmac.h
+s3_enc.o: ../include/openssl/lhash.h ../include/openssl/md5.h
+s3_enc.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+s3_enc.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+s3_enc.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+s3_enc.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+s3_enc.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
+s3_enc.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+s3_enc.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
+s3_enc.o: ../include/openssl/ssl2.h ../include/openssl/ssl3.h
+s3_enc.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+s3_enc.o: ../include/openssl/tls1.h ../include/openssl/x509.h
+s3_enc.o: ../include/openssl/x509_vfy.h packet_locl.h record/record.h s3_enc.c
+s3_enc.o: ssl_locl.h statem/statem.h
+s3_lib.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+s3_lib.o: ../include/openssl/bio.h ../include/openssl/bn.h
+s3_lib.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+s3_lib.o: ../include/openssl/crypto.h ../include/openssl/dh.h
+s3_lib.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
+s3_lib.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+s3_lib.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
+s3_lib.o: ../include/openssl/err.h ../include/openssl/evp.h
+s3_lib.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
+s3_lib.o: ../include/openssl/md5.h ../include/openssl/obj_mac.h
+s3_lib.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+s3_lib.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+s3_lib.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+s3_lib.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
+s3_lib.o: ../include/openssl/rand.h ../include/openssl/rsa.h
+s3_lib.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+s3_lib.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
+s3_lib.o: ../include/openssl/ssl2.h ../include/openssl/ssl3.h
+s3_lib.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+s3_lib.o: ../include/openssl/tls1.h ../include/openssl/x509.h
+s3_lib.o: ../include/openssl/x509_vfy.h packet_locl.h record/record.h s3_lib.c
+s3_lib.o: ssl_locl.h statem/statem.h
+s3_msg.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+s3_msg.o: ../include/openssl/bio.h ../include/openssl/bn.h
+s3_msg.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+s3_msg.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+s3_msg.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+s3_msg.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+s3_msg.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+s3_msg.o: ../include/openssl/evp.h ../include/openssl/hmac.h
+s3_msg.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+s3_msg.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+s3_msg.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+s3_msg.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+s3_msg.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
+s3_msg.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+s3_msg.o: ../include/openssl/sha.h ../include/openssl/srtp.h
+s3_msg.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+s3_msg.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
+s3_msg.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
+s3_msg.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h packet_locl.h
+s3_msg.o: record/record.h s3_msg.c ssl_locl.h statem/statem.h
+ssl_algs.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+ssl_algs.o: ../include/openssl/bio.h ../include/openssl/bn.h
+ssl_algs.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+ssl_algs.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+ssl_algs.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+ssl_algs.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+ssl_algs.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+ssl_algs.o: ../include/openssl/evp.h ../include/openssl/hmac.h
+ssl_algs.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+ssl_algs.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+ssl_algs.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+ssl_algs.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+ssl_algs.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
+ssl_algs.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+ssl_algs.o: ../include/openssl/sha.h ../include/openssl/srtp.h
+ssl_algs.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+ssl_algs.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
+ssl_algs.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
+ssl_algs.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
+ssl_algs.o: packet_locl.h record/record.h ssl_algs.c ssl_locl.h statem/statem.h
 ssl_asn1.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/asn1t.h
-ssl_asn1.o: ../include/openssl/bio.h ../include/openssl/bn.h
-ssl_asn1.o: ../include/openssl/buffer.h ../include/openssl/comp.h
-ssl_asn1.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
-ssl_asn1.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
-ssl_asn1.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
-ssl_asn1.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
-ssl_asn1.o: ../include/openssl/evp.h ../include/openssl/hmac.h
-ssl_asn1.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-ssl_asn1.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
-ssl_asn1.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-ssl_asn1.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-ssl_asn1.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
-ssl_asn1.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-ssl_asn1.o: ../include/openssl/sha.h ../include/openssl/srtp.h
-ssl_asn1.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
-ssl_asn1.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
-ssl_asn1.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
-ssl_asn1.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-ssl_asn1.o: packet_locl.h record/record.h ssl_asn1.c ssl_locl.h statem/statem.h
+ssl_asn1.o: ../include/openssl/async.h ../include/openssl/bio.h
+ssl_asn1.o: ../include/openssl/bn.h ../include/openssl/buffer.h
+ssl_asn1.o: ../include/openssl/comp.h ../include/openssl/crypto.h
+ssl_asn1.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
+ssl_asn1.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+ssl_asn1.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
+ssl_asn1.o: ../include/openssl/err.h ../include/openssl/evp.h
+ssl_asn1.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
+ssl_asn1.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+ssl_asn1.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+ssl_asn1.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+ssl_asn1.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+ssl_asn1.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
+ssl_asn1.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+ssl_asn1.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
+ssl_asn1.o: ../include/openssl/ssl2.h ../include/openssl/ssl3.h
+ssl_asn1.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+ssl_asn1.o: ../include/openssl/tls1.h ../include/openssl/x509.h
+ssl_asn1.o: ../include/openssl/x509_vfy.h packet_locl.h record/record.h
+ssl_asn1.o: ssl_asn1.c ssl_locl.h statem/statem.h
 ssl_cert.o: ../e_os.h ../include/internal/o_dir.h ../include/openssl/asn1.h
-ssl_cert.o: ../include/openssl/bio.h ../include/openssl/bn.h
-ssl_cert.o: ../include/openssl/buffer.h ../include/openssl/comp.h
-ssl_cert.o: ../include/openssl/conf.h ../include/openssl/crypto.h
-ssl_cert.o: ../include/openssl/dh.h ../include/openssl/dsa.h
-ssl_cert.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
-ssl_cert.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
-ssl_cert.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
-ssl_cert.o: ../include/openssl/evp.h ../include/openssl/hmac.h
-ssl_cert.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-ssl_cert.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
-ssl_cert.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-ssl_cert.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-ssl_cert.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
-ssl_cert.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-ssl_cert.o: ../include/openssl/sha.h ../include/openssl/srtp.h
-ssl_cert.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
-ssl_cert.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
-ssl_cert.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
-ssl_cert.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-ssl_cert.o: ../include/openssl/x509v3.h packet_locl.h record/record.h
-ssl_cert.o: ssl_cert.c ssl_locl.h statem/statem.h
-ssl_ciph.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-ssl_ciph.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-ssl_ciph.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-ssl_ciph.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-ssl_ciph.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-ssl_ciph.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-ssl_ciph.o: ../include/openssl/engine.h ../include/openssl/err.h
-ssl_ciph.o: ../include/openssl/evp.h ../include/openssl/hmac.h
-ssl_ciph.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-ssl_ciph.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
-ssl_ciph.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-ssl_ciph.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-ssl_ciph.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
-ssl_ciph.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-ssl_ciph.o: ../include/openssl/sha.h ../include/openssl/srtp.h
-ssl_ciph.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
-ssl_ciph.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
-ssl_ciph.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
-ssl_ciph.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-ssl_ciph.o: packet_locl.h record/record.h ssl_ciph.c ssl_locl.h statem/statem.h
-ssl_conf.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-ssl_conf.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-ssl_conf.o: ../include/openssl/comp.h ../include/openssl/conf.h
-ssl_conf.o: ../include/openssl/crypto.h ../include/openssl/dh.h
-ssl_conf.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-ssl_conf.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-ssl_conf.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-ssl_conf.o: ../include/openssl/err.h ../include/openssl/evp.h
-ssl_conf.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
-ssl_conf.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-ssl_conf.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-ssl_conf.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-ssl_conf.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-ssl_conf.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
-ssl_conf.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-ssl_conf.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
-ssl_conf.o: ../include/openssl/ssl2.h ../include/openssl/ssl3.h
-ssl_conf.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-ssl_conf.o: ../include/openssl/tls1.h ../include/openssl/x509.h
-ssl_conf.o: ../include/openssl/x509_vfy.h packet_locl.h record/record.h
-ssl_conf.o: ssl_conf.c ssl_locl.h statem/statem.h
+ssl_cert.o: ../include/openssl/async.h ../include/openssl/bio.h
+ssl_cert.o: ../include/openssl/bn.h ../include/openssl/buffer.h
+ssl_cert.o: ../include/openssl/comp.h ../include/openssl/conf.h
+ssl_cert.o: ../include/openssl/crypto.h ../include/openssl/dh.h
+ssl_cert.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
+ssl_cert.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+ssl_cert.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
+ssl_cert.o: ../include/openssl/err.h ../include/openssl/evp.h
+ssl_cert.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
+ssl_cert.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+ssl_cert.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+ssl_cert.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+ssl_cert.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+ssl_cert.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
+ssl_cert.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+ssl_cert.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
+ssl_cert.o: ../include/openssl/ssl2.h ../include/openssl/ssl3.h
+ssl_cert.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+ssl_cert.o: ../include/openssl/tls1.h ../include/openssl/x509.h
+ssl_cert.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h
+ssl_cert.o: packet_locl.h record/record.h ssl_cert.c ssl_locl.h statem/statem.h
+ssl_ciph.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+ssl_ciph.o: ../include/openssl/bio.h ../include/openssl/bn.h
+ssl_ciph.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+ssl_ciph.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+ssl_ciph.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+ssl_ciph.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+ssl_ciph.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
+ssl_ciph.o: ../include/openssl/err.h ../include/openssl/evp.h
+ssl_ciph.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
+ssl_ciph.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+ssl_ciph.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+ssl_ciph.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+ssl_ciph.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+ssl_ciph.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
+ssl_ciph.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+ssl_ciph.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
+ssl_ciph.o: ../include/openssl/ssl2.h ../include/openssl/ssl3.h
+ssl_ciph.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+ssl_ciph.o: ../include/openssl/tls1.h ../include/openssl/x509.h
+ssl_ciph.o: ../include/openssl/x509_vfy.h packet_locl.h record/record.h
+ssl_ciph.o: ssl_ciph.c ssl_locl.h statem/statem.h
+ssl_conf.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+ssl_conf.o: ../include/openssl/bio.h ../include/openssl/bn.h
+ssl_conf.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+ssl_conf.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+ssl_conf.o: ../include/openssl/dh.h ../include/openssl/dsa.h
+ssl_conf.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+ssl_conf.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+ssl_conf.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+ssl_conf.o: ../include/openssl/evp.h ../include/openssl/hmac.h
+ssl_conf.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+ssl_conf.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+ssl_conf.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+ssl_conf.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+ssl_conf.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
+ssl_conf.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+ssl_conf.o: ../include/openssl/sha.h ../include/openssl/srtp.h
+ssl_conf.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+ssl_conf.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
+ssl_conf.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
+ssl_conf.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
+ssl_conf.o: packet_locl.h record/record.h ssl_conf.c ssl_locl.h statem/statem.h
 ssl_err.o: ../include/openssl/asn1.h ../include/openssl/bio.h
 ssl_err.o: ../include/openssl/buffer.h ../include/openssl/comp.h
 ssl_err.o: ../include/openssl/crypto.h ../include/openssl/dtls1.h
@@ -537,163 +547,164 @@ ssl_err2.o: ../include/openssl/ssl2.h ../include/openssl/ssl3.h
 ssl_err2.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
 ssl_err2.o: ../include/openssl/tls1.h ../include/openssl/x509.h
 ssl_err2.o: ../include/openssl/x509_vfy.h ssl_err2.c
-ssl_lib.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-ssl_lib.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-ssl_lib.o: ../include/openssl/comp.h ../include/openssl/conf.h
-ssl_lib.o: ../include/openssl/crypto.h ../include/openssl/dh.h
-ssl_lib.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-ssl_lib.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-ssl_lib.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-ssl_lib.o: ../include/openssl/engine.h ../include/openssl/err.h
-ssl_lib.o: ../include/openssl/evp.h ../include/openssl/hmac.h
-ssl_lib.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-ssl_lib.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
-ssl_lib.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-ssl_lib.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-ssl_lib.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-ssl_lib.o: ../include/openssl/pqueue.h ../include/openssl/rand.h
-ssl_lib.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-ssl_lib.o: ../include/openssl/sha.h ../include/openssl/srtp.h
-ssl_lib.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
-ssl_lib.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
-ssl_lib.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
-ssl_lib.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-ssl_lib.o: ../include/openssl/x509v3.h packet_locl.h record/record.h ssl_lib.c
-ssl_lib.o: ssl_locl.h statem/statem.h
-ssl_rsa.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-ssl_rsa.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-ssl_rsa.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-ssl_rsa.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-ssl_rsa.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-ssl_rsa.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-ssl_rsa.o: ../include/openssl/err.h ../include/openssl/evp.h
-ssl_rsa.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
-ssl_rsa.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-ssl_rsa.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-ssl_rsa.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-ssl_rsa.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-ssl_rsa.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
-ssl_rsa.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-ssl_rsa.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
-ssl_rsa.o: ../include/openssl/ssl2.h ../include/openssl/ssl3.h
-ssl_rsa.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-ssl_rsa.o: ../include/openssl/tls1.h ../include/openssl/x509.h
-ssl_rsa.o: ../include/openssl/x509_vfy.h packet_locl.h record/record.h
-ssl_rsa.o: ssl_locl.h ssl_rsa.c statem/statem.h
-ssl_sess.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-ssl_sess.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-ssl_sess.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-ssl_sess.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-ssl_sess.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-ssl_sess.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-ssl_sess.o: ../include/openssl/engine.h ../include/openssl/err.h
-ssl_sess.o: ../include/openssl/evp.h ../include/openssl/hmac.h
-ssl_sess.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-ssl_sess.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
-ssl_sess.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-ssl_sess.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-ssl_sess.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
-ssl_sess.o: ../include/openssl/rand.h ../include/openssl/rsa.h
-ssl_sess.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-ssl_sess.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
-ssl_sess.o: ../include/openssl/ssl2.h ../include/openssl/ssl3.h
-ssl_sess.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-ssl_sess.o: ../include/openssl/tls1.h ../include/openssl/x509.h
-ssl_sess.o: ../include/openssl/x509_vfy.h packet_locl.h record/record.h
-ssl_sess.o: ssl_locl.h ssl_sess.c statem/statem.h
-ssl_stat.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-ssl_stat.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-ssl_stat.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-ssl_stat.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-ssl_stat.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-ssl_stat.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-ssl_stat.o: ../include/openssl/err.h ../include/openssl/evp.h
-ssl_stat.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
-ssl_stat.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-ssl_stat.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-ssl_stat.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-ssl_stat.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-ssl_stat.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
-ssl_stat.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-ssl_stat.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
-ssl_stat.o: ../include/openssl/ssl2.h ../include/openssl/ssl3.h
-ssl_stat.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-ssl_stat.o: ../include/openssl/tls1.h ../include/openssl/x509.h
-ssl_stat.o: ../include/openssl/x509_vfy.h packet_locl.h record/record.h
-ssl_stat.o: ssl_locl.h ssl_stat.c statem/statem.h
-ssl_txt.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-ssl_txt.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-ssl_txt.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-ssl_txt.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-ssl_txt.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-ssl_txt.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-ssl_txt.o: ../include/openssl/err.h ../include/openssl/evp.h
-ssl_txt.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
-ssl_txt.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-ssl_txt.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-ssl_txt.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-ssl_txt.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-ssl_txt.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
-ssl_txt.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-ssl_txt.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
-ssl_txt.o: ../include/openssl/ssl2.h ../include/openssl/ssl3.h
-ssl_txt.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-ssl_txt.o: ../include/openssl/tls1.h ../include/openssl/x509.h
-ssl_txt.o: ../include/openssl/x509_vfy.h packet_locl.h record/record.h
-ssl_txt.o: ssl_locl.h ssl_txt.c statem/statem.h
-ssl_utst.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-ssl_utst.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-ssl_utst.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-ssl_utst.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-ssl_utst.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-ssl_utst.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-ssl_utst.o: ../include/openssl/err.h ../include/openssl/evp.h
-ssl_utst.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
-ssl_utst.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-ssl_utst.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-ssl_utst.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-ssl_utst.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-ssl_utst.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
-ssl_utst.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-ssl_utst.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
-ssl_utst.o: ../include/openssl/ssl2.h ../include/openssl/ssl3.h
-ssl_utst.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-ssl_utst.o: ../include/openssl/tls1.h ../include/openssl/x509.h
-ssl_utst.o: ../include/openssl/x509_vfy.h packet_locl.h record/record.h
-ssl_utst.o: ssl_locl.h ssl_utst.c statem/statem.h
-statem/statem.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-statem/statem.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-statem/statem.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-statem/statem.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-statem/statem.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-statem/statem.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-statem/statem.o: ../include/openssl/err.h ../include/openssl/evp.h
-statem/statem.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
-statem/statem.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-statem/statem.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-statem/statem.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-statem/statem.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-statem/statem.o: ../include/openssl/pqueue.h ../include/openssl/rand.h
-statem/statem.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-statem/statem.o: ../include/openssl/sha.h ../include/openssl/srtp.h
-statem/statem.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
-statem/statem.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
-statem/statem.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
-statem/statem.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-statem/statem.o: statem/../packet_locl.h statem/../record/record.h
-statem/statem.o: statem/../ssl_locl.h statem/../statem/statem.h statem/statem.c
-statem/statem.o: statem/statem_locl.h
+ssl_lib.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+ssl_lib.o: ../include/openssl/bio.h ../include/openssl/bn.h
+ssl_lib.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+ssl_lib.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+ssl_lib.o: ../include/openssl/dh.h ../include/openssl/dsa.h
+ssl_lib.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+ssl_lib.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+ssl_lib.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
+ssl_lib.o: ../include/openssl/err.h ../include/openssl/evp.h
+ssl_lib.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
+ssl_lib.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+ssl_lib.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
+ssl_lib.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+ssl_lib.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+ssl_lib.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
+ssl_lib.o: ../include/openssl/rand.h ../include/openssl/rsa.h
+ssl_lib.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+ssl_lib.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
+ssl_lib.o: ../include/openssl/ssl2.h ../include/openssl/ssl3.h
+ssl_lib.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+ssl_lib.o: ../include/openssl/tls1.h ../include/openssl/x509.h
+ssl_lib.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h
+ssl_lib.o: packet_locl.h record/record.h ssl_lib.c ssl_locl.h statem/statem.h
+ssl_rsa.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+ssl_rsa.o: ../include/openssl/bio.h ../include/openssl/bn.h
+ssl_rsa.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+ssl_rsa.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+ssl_rsa.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+ssl_rsa.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+ssl_rsa.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+ssl_rsa.o: ../include/openssl/evp.h ../include/openssl/hmac.h
+ssl_rsa.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+ssl_rsa.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+ssl_rsa.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+ssl_rsa.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+ssl_rsa.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
+ssl_rsa.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+ssl_rsa.o: ../include/openssl/sha.h ../include/openssl/srtp.h
+ssl_rsa.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+ssl_rsa.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
+ssl_rsa.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
+ssl_rsa.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
+ssl_rsa.o: packet_locl.h record/record.h ssl_locl.h ssl_rsa.c statem/statem.h
+ssl_sess.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+ssl_sess.o: ../include/openssl/bio.h ../include/openssl/bn.h
+ssl_sess.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+ssl_sess.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+ssl_sess.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+ssl_sess.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+ssl_sess.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
+ssl_sess.o: ../include/openssl/err.h ../include/openssl/evp.h
+ssl_sess.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
+ssl_sess.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+ssl_sess.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+ssl_sess.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+ssl_sess.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+ssl_sess.o: ../include/openssl/pqueue.h ../include/openssl/rand.h
+ssl_sess.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+ssl_sess.o: ../include/openssl/sha.h ../include/openssl/srtp.h
+ssl_sess.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+ssl_sess.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
+ssl_sess.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
+ssl_sess.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
+ssl_sess.o: packet_locl.h record/record.h ssl_locl.h ssl_sess.c statem/statem.h
+ssl_stat.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+ssl_stat.o: ../include/openssl/bio.h ../include/openssl/bn.h
+ssl_stat.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+ssl_stat.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+ssl_stat.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+ssl_stat.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+ssl_stat.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+ssl_stat.o: ../include/openssl/evp.h ../include/openssl/hmac.h
+ssl_stat.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+ssl_stat.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+ssl_stat.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+ssl_stat.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+ssl_stat.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
+ssl_stat.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+ssl_stat.o: ../include/openssl/sha.h ../include/openssl/srtp.h
+ssl_stat.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+ssl_stat.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
+ssl_stat.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
+ssl_stat.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
+ssl_stat.o: packet_locl.h record/record.h ssl_locl.h ssl_stat.c statem/statem.h
+ssl_txt.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+ssl_txt.o: ../include/openssl/bio.h ../include/openssl/bn.h
+ssl_txt.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+ssl_txt.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+ssl_txt.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+ssl_txt.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+ssl_txt.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+ssl_txt.o: ../include/openssl/evp.h ../include/openssl/hmac.h
+ssl_txt.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+ssl_txt.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+ssl_txt.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+ssl_txt.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+ssl_txt.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
+ssl_txt.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+ssl_txt.o: ../include/openssl/sha.h ../include/openssl/srtp.h
+ssl_txt.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+ssl_txt.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
+ssl_txt.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
+ssl_txt.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
+ssl_txt.o: packet_locl.h record/record.h ssl_locl.h ssl_txt.c statem/statem.h
+ssl_utst.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+ssl_utst.o: ../include/openssl/bio.h ../include/openssl/bn.h
+ssl_utst.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+ssl_utst.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+ssl_utst.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+ssl_utst.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+ssl_utst.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+ssl_utst.o: ../include/openssl/evp.h ../include/openssl/hmac.h
+ssl_utst.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+ssl_utst.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+ssl_utst.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+ssl_utst.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+ssl_utst.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
+ssl_utst.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+ssl_utst.o: ../include/openssl/sha.h ../include/openssl/srtp.h
+ssl_utst.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+ssl_utst.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
+ssl_utst.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
+ssl_utst.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
+ssl_utst.o: packet_locl.h record/record.h ssl_locl.h ssl_utst.c statem/statem.h
+statem/statem.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+statem/statem.o: ../include/openssl/bio.h ../include/openssl/bn.h
+statem/statem.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+statem/statem.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+statem/statem.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+statem/statem.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+statem/statem.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+statem/statem.o: ../include/openssl/evp.h ../include/openssl/hmac.h
+statem/statem.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+statem/statem.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+statem/statem.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+statem/statem.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+statem/statem.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
+statem/statem.o: ../include/openssl/rand.h ../include/openssl/rsa.h
+statem/statem.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+statem/statem.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
+statem/statem.o: ../include/openssl/ssl2.h ../include/openssl/ssl3.h
+statem/statem.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+statem/statem.o: ../include/openssl/tls1.h ../include/openssl/x509.h
+statem/statem.o: ../include/openssl/x509_vfy.h statem/../packet_locl.h
+statem/statem.o: statem/../record/record.h statem/../ssl_locl.h
+statem/statem.o: statem/../statem/statem.h statem/statem.c statem/statem_locl.h
 statem/statem_clnt.o: ../e_os.h ../include/openssl/asn1.h
-statem/statem_clnt.o: ../include/openssl/bio.h ../include/openssl/bn.h
-statem/statem_clnt.o: ../include/openssl/buffer.h ../include/openssl/comp.h
-statem/statem_clnt.o: ../include/openssl/crypto.h ../include/openssl/dh.h
-statem/statem_clnt.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-statem/statem_clnt.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-statem/statem_clnt.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-statem/statem_clnt.o: ../include/openssl/engine.h ../include/openssl/err.h
-statem/statem_clnt.o: ../include/openssl/evp.h ../include/openssl/hmac.h
-statem/statem_clnt.o: ../include/openssl/lhash.h ../include/openssl/md5.h
-statem/statem_clnt.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+statem/statem_clnt.o: ../include/openssl/async.h ../include/openssl/bio.h
+statem/statem_clnt.o: ../include/openssl/bn.h ../include/openssl/buffer.h
+statem/statem_clnt.o: ../include/openssl/comp.h ../include/openssl/crypto.h
+statem/statem_clnt.o: ../include/openssl/dh.h ../include/openssl/dsa.h
+statem/statem_clnt.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+statem/statem_clnt.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+statem/statem_clnt.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
+statem/statem_clnt.o: ../include/openssl/err.h ../include/openssl/evp.h
+statem/statem_clnt.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
+statem/statem_clnt.o: ../include/openssl/md5.h ../include/openssl/obj_mac.h
+statem/statem_clnt.o: ../include/openssl/objects.h
 statem/statem_clnt.o: ../include/openssl/opensslconf.h
 statem/statem_clnt.o: ../include/openssl/opensslv.h
 statem/statem_clnt.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
@@ -709,15 +720,15 @@ statem/statem_clnt.o: statem/../packet_locl.h statem/../record/record.h
 statem/statem_clnt.o: statem/../ssl_locl.h statem/../statem/statem.h
 statem/statem_clnt.o: statem/statem_clnt.c statem/statem_locl.h
 statem/statem_dtls.o: ../e_os.h ../include/openssl/asn1.h
-statem/statem_dtls.o: ../include/openssl/bio.h ../include/openssl/bn.h
-statem/statem_dtls.o: ../include/openssl/buffer.h ../include/openssl/comp.h
-statem/statem_dtls.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
-statem/statem_dtls.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
-statem/statem_dtls.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
-statem/statem_dtls.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
-statem/statem_dtls.o: ../include/openssl/evp.h ../include/openssl/hmac.h
-statem/statem_dtls.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-statem/statem_dtls.o: ../include/openssl/objects.h
+statem/statem_dtls.o: ../include/openssl/async.h ../include/openssl/bio.h
+statem/statem_dtls.o: ../include/openssl/bn.h ../include/openssl/buffer.h
+statem/statem_dtls.o: ../include/openssl/comp.h ../include/openssl/crypto.h
+statem/statem_dtls.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
+statem/statem_dtls.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+statem/statem_dtls.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
+statem/statem_dtls.o: ../include/openssl/err.h ../include/openssl/evp.h
+statem/statem_dtls.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
+statem/statem_dtls.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
 statem/statem_dtls.o: ../include/openssl/opensslconf.h
 statem/statem_dtls.o: ../include/openssl/opensslv.h
 statem/statem_dtls.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
@@ -733,15 +744,15 @@ statem/statem_dtls.o: statem/../packet_locl.h statem/../record/record.h
 statem/statem_dtls.o: statem/../ssl_locl.h statem/../statem/statem.h
 statem/statem_dtls.o: statem/statem_dtls.c statem/statem_locl.h
 statem/statem_lib.o: ../e_os.h ../include/openssl/asn1.h
-statem/statem_lib.o: ../include/openssl/bio.h ../include/openssl/bn.h
-statem/statem_lib.o: ../include/openssl/buffer.h ../include/openssl/comp.h
-statem/statem_lib.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
-statem/statem_lib.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
-statem/statem_lib.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
-statem/statem_lib.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
-statem/statem_lib.o: ../include/openssl/evp.h ../include/openssl/hmac.h
-statem/statem_lib.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-statem/statem_lib.o: ../include/openssl/objects.h
+statem/statem_lib.o: ../include/openssl/async.h ../include/openssl/bio.h
+statem/statem_lib.o: ../include/openssl/bn.h ../include/openssl/buffer.h
+statem/statem_lib.o: ../include/openssl/comp.h ../include/openssl/crypto.h
+statem/statem_lib.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
+statem/statem_lib.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+statem/statem_lib.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
+statem/statem_lib.o: ../include/openssl/err.h ../include/openssl/evp.h
+statem/statem_lib.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
+statem/statem_lib.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
 statem/statem_lib.o: ../include/openssl/opensslconf.h
 statem/statem_lib.o: ../include/openssl/opensslv.h
 statem/statem_lib.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
@@ -757,16 +768,17 @@ statem/statem_lib.o: statem/../packet_locl.h statem/../record/record.h
 statem/statem_lib.o: statem/../ssl_locl.h statem/../statem/statem.h
 statem/statem_lib.o: statem/statem_lib.c statem/statem_locl.h
 statem/statem_srvr.o: ../e_os.h ../include/internal/constant_time_locl.h
-statem/statem_srvr.o: ../include/openssl/asn1.h ../include/openssl/bio.h
-statem/statem_srvr.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-statem/statem_srvr.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-statem/statem_srvr.o: ../include/openssl/dh.h ../include/openssl/dsa.h
-statem/statem_srvr.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
-statem/statem_srvr.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
-statem/statem_srvr.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
-statem/statem_srvr.o: ../include/openssl/evp.h ../include/openssl/hmac.h
-statem/statem_srvr.o: ../include/openssl/lhash.h ../include/openssl/md5.h
-statem/statem_srvr.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+statem/statem_srvr.o: ../include/openssl/asn1.h ../include/openssl/async.h
+statem/statem_srvr.o: ../include/openssl/bio.h ../include/openssl/bn.h
+statem/statem_srvr.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+statem/statem_srvr.o: ../include/openssl/crypto.h ../include/openssl/dh.h
+statem/statem_srvr.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
+statem/statem_srvr.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+statem/statem_srvr.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
+statem/statem_srvr.o: ../include/openssl/err.h ../include/openssl/evp.h
+statem/statem_srvr.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
+statem/statem_srvr.o: ../include/openssl/md5.h ../include/openssl/obj_mac.h
+statem/statem_srvr.o: ../include/openssl/objects.h
 statem/statem_srvr.o: ../include/openssl/opensslconf.h
 statem/statem_srvr.o: ../include/openssl/opensslv.h
 statem/statem_srvr.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
@@ -781,127 +793,128 @@ statem/statem_srvr.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
 statem/statem_srvr.o: statem/../packet_locl.h statem/../record/record.h
 statem/statem_srvr.o: statem/../ssl_locl.h statem/../statem/statem.h
 statem/statem_srvr.o: statem/statem_locl.h statem/statem_srvr.c
-t1_enc.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-t1_enc.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-t1_enc.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-t1_enc.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-t1_enc.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-t1_enc.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-t1_enc.o: ../include/openssl/err.h ../include/openssl/evp.h
-t1_enc.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
-t1_enc.o: ../include/openssl/md5.h ../include/openssl/obj_mac.h
-t1_enc.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
-t1_enc.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-t1_enc.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-t1_enc.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
-t1_enc.o: ../include/openssl/rand.h ../include/openssl/rsa.h
-t1_enc.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-t1_enc.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
-t1_enc.o: ../include/openssl/ssl2.h ../include/openssl/ssl3.h
-t1_enc.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-t1_enc.o: ../include/openssl/tls1.h ../include/openssl/x509.h
-t1_enc.o: ../include/openssl/x509_vfy.h packet_locl.h record/record.h
-t1_enc.o: ssl_locl.h statem/statem.h t1_enc.c
-t1_ext.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-t1_ext.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-t1_ext.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-t1_ext.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-t1_ext.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-t1_ext.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-t1_ext.o: ../include/openssl/err.h ../include/openssl/evp.h
-t1_ext.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
-t1_ext.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-t1_ext.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-t1_ext.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-t1_ext.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-t1_ext.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
-t1_ext.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-t1_ext.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
-t1_ext.o: ../include/openssl/ssl2.h ../include/openssl/ssl3.h
-t1_ext.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-t1_ext.o: ../include/openssl/tls1.h ../include/openssl/x509.h
-t1_ext.o: ../include/openssl/x509_vfy.h packet_locl.h record/record.h
-t1_ext.o: ssl_locl.h statem/statem.h t1_ext.c
-t1_lib.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-t1_lib.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-t1_lib.o: ../include/openssl/comp.h ../include/openssl/conf.h
-t1_lib.o: ../include/openssl/crypto.h ../include/openssl/dh.h
-t1_lib.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-t1_lib.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-t1_lib.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-t1_lib.o: ../include/openssl/err.h ../include/openssl/evp.h
-t1_lib.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
-t1_lib.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-t1_lib.o: ../include/openssl/ocsp.h ../include/openssl/opensslconf.h
-t1_lib.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-t1_lib.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-t1_lib.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
-t1_lib.o: ../include/openssl/rand.h ../include/openssl/rsa.h
-t1_lib.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-t1_lib.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
-t1_lib.o: ../include/openssl/ssl2.h ../include/openssl/ssl3.h
-t1_lib.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-t1_lib.o: ../include/openssl/tls1.h ../include/openssl/x509.h
-t1_lib.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h
-t1_lib.o: packet_locl.h record/record.h ssl_locl.h statem/statem.h t1_lib.c
-t1_reneg.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-t1_reneg.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-t1_reneg.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-t1_reneg.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-t1_reneg.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-t1_reneg.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-t1_reneg.o: ../include/openssl/err.h ../include/openssl/evp.h
-t1_reneg.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
-t1_reneg.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-t1_reneg.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-t1_reneg.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-t1_reneg.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-t1_reneg.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
-t1_reneg.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-t1_reneg.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
-t1_reneg.o: ../include/openssl/ssl2.h ../include/openssl/ssl3.h
-t1_reneg.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-t1_reneg.o: ../include/openssl/tls1.h ../include/openssl/x509.h
-t1_reneg.o: ../include/openssl/x509_vfy.h packet_locl.h record/record.h
-t1_reneg.o: ssl_locl.h statem/statem.h t1_reneg.c
-t1_trce.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-t1_trce.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-t1_trce.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-t1_trce.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-t1_trce.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-t1_trce.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-t1_trce.o: ../include/openssl/err.h ../include/openssl/evp.h
-t1_trce.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
-t1_trce.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-t1_trce.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-t1_trce.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-t1_trce.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-t1_trce.o: ../include/openssl/pqueue.h ../include/openssl/rsa.h
-t1_trce.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-t1_trce.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
-t1_trce.o: ../include/openssl/ssl2.h ../include/openssl/ssl3.h
-t1_trce.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-t1_trce.o: ../include/openssl/tls1.h ../include/openssl/x509.h
-t1_trce.o: ../include/openssl/x509_vfy.h packet_locl.h record/record.h
-t1_trce.o: ssl_locl.h statem/statem.h t1_trce.c
-tls_srp.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-tls_srp.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-tls_srp.o: ../include/openssl/comp.h ../include/openssl/crypto.h
-tls_srp.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-tls_srp.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-tls_srp.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-tls_srp.o: ../include/openssl/err.h ../include/openssl/evp.h
-tls_srp.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
-tls_srp.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
-tls_srp.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
-tls_srp.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
-tls_srp.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
-tls_srp.o: ../include/openssl/pqueue.h ../include/openssl/rand.h
-tls_srp.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
-tls_srp.o: ../include/openssl/sha.h ../include/openssl/srp.h
-tls_srp.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
-tls_srp.o: ../include/openssl/ssl2.h ../include/openssl/ssl3.h
-tls_srp.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
-tls_srp.o: ../include/openssl/tls1.h ../include/openssl/x509.h
-tls_srp.o: ../include/openssl/x509_vfy.h packet_locl.h record/record.h
-tls_srp.o: ssl_locl.h statem/statem.h tls_srp.c
+t1_enc.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+t1_enc.o: ../include/openssl/bio.h ../include/openssl/bn.h
+t1_enc.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+t1_enc.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+t1_enc.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+t1_enc.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+t1_enc.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+t1_enc.o: ../include/openssl/evp.h ../include/openssl/hmac.h
+t1_enc.o: ../include/openssl/lhash.h ../include/openssl/md5.h
+t1_enc.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+t1_enc.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+t1_enc.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+t1_enc.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+t1_enc.o: ../include/openssl/pqueue.h ../include/openssl/rand.h
+t1_enc.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+t1_enc.o: ../include/openssl/sha.h ../include/openssl/srtp.h
+t1_enc.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+t1_enc.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
+t1_enc.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
+t1_enc.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h packet_locl.h
+t1_enc.o: record/record.h ssl_locl.h statem/statem.h t1_enc.c
+t1_ext.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+t1_ext.o: ../include/openssl/bio.h ../include/openssl/bn.h
+t1_ext.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+t1_ext.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+t1_ext.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+t1_ext.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+t1_ext.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+t1_ext.o: ../include/openssl/evp.h ../include/openssl/hmac.h
+t1_ext.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+t1_ext.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+t1_ext.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+t1_ext.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+t1_ext.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
+t1_ext.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+t1_ext.o: ../include/openssl/sha.h ../include/openssl/srtp.h
+t1_ext.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+t1_ext.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
+t1_ext.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
+t1_ext.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h packet_locl.h
+t1_ext.o: record/record.h ssl_locl.h statem/statem.h t1_ext.c
+t1_lib.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+t1_lib.o: ../include/openssl/bio.h ../include/openssl/bn.h
+t1_lib.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+t1_lib.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+t1_lib.o: ../include/openssl/dh.h ../include/openssl/dsa.h
+t1_lib.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+t1_lib.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+t1_lib.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+t1_lib.o: ../include/openssl/evp.h ../include/openssl/hmac.h
+t1_lib.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+t1_lib.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
+t1_lib.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+t1_lib.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+t1_lib.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+t1_lib.o: ../include/openssl/pqueue.h ../include/openssl/rand.h
+t1_lib.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+t1_lib.o: ../include/openssl/sha.h ../include/openssl/srtp.h
+t1_lib.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+t1_lib.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
+t1_lib.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
+t1_lib.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
+t1_lib.o: ../include/openssl/x509v3.h packet_locl.h record/record.h ssl_locl.h
+t1_lib.o: statem/statem.h t1_lib.c
+t1_reneg.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+t1_reneg.o: ../include/openssl/bio.h ../include/openssl/bn.h
+t1_reneg.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+t1_reneg.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+t1_reneg.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+t1_reneg.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+t1_reneg.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+t1_reneg.o: ../include/openssl/evp.h ../include/openssl/hmac.h
+t1_reneg.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+t1_reneg.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+t1_reneg.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+t1_reneg.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+t1_reneg.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
+t1_reneg.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+t1_reneg.o: ../include/openssl/sha.h ../include/openssl/srtp.h
+t1_reneg.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+t1_reneg.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
+t1_reneg.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
+t1_reneg.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
+t1_reneg.o: packet_locl.h record/record.h ssl_locl.h statem/statem.h t1_reneg.c
+t1_trce.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+t1_trce.o: ../include/openssl/bio.h ../include/openssl/bn.h
+t1_trce.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+t1_trce.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+t1_trce.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+t1_trce.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+t1_trce.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+t1_trce.o: ../include/openssl/evp.h ../include/openssl/hmac.h
+t1_trce.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+t1_trce.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+t1_trce.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+t1_trce.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+t1_trce.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
+t1_trce.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+t1_trce.o: ../include/openssl/sha.h ../include/openssl/srtp.h
+t1_trce.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+t1_trce.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
+t1_trce.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
+t1_trce.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
+t1_trce.o: packet_locl.h record/record.h ssl_locl.h statem/statem.h t1_trce.c
+tls_srp.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+tls_srp.o: ../include/openssl/bio.h ../include/openssl/bn.h
+tls_srp.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+tls_srp.o: ../include/openssl/crypto.h ../include/openssl/dsa.h
+tls_srp.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+tls_srp.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+tls_srp.o: ../include/openssl/ecdsa.h ../include/openssl/err.h
+tls_srp.o: ../include/openssl/evp.h ../include/openssl/hmac.h
+tls_srp.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+tls_srp.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
+tls_srp.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
+tls_srp.o: ../include/openssl/pem.h ../include/openssl/pem2.h
+tls_srp.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
+tls_srp.o: ../include/openssl/rand.h ../include/openssl/rsa.h
+tls_srp.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+tls_srp.o: ../include/openssl/srp.h ../include/openssl/srtp.h
+tls_srp.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
+tls_srp.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
+tls_srp.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
+tls_srp.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
+tls_srp.o: packet_locl.h record/record.h ssl_locl.h statem/statem.h tls_srp.c
diff --git a/ssl/ssl_err.c b/ssl/ssl_err.c
index 82fb614..642beae 100644
--- a/ssl/ssl_err.c
+++ b/ssl/ssl_err.c
@@ -190,6 +190,7 @@ static ERR_STRING_DATA SSL_str_functs[] = {
     {ERR_FUNC(SSL_F_SSL3_SETUP_WRITE_BUFFER), "ssl3_setup_write_buffer"},
     {ERR_FUNC(SSL_F_SSL3_WRITE_BYTES), "ssl3_write_bytes"},
     {ERR_FUNC(SSL_F_SSL3_WRITE_PENDING), "ssl3_write_pending"},
+    {ERR_FUNC(SSL_F_SSL_ACCEPT), "SSL_accept"},
     {ERR_FUNC(SSL_F_SSL_ADD_CERT_CHAIN), "ssl_add_cert_chain"},
     {ERR_FUNC(SSL_F_SSL_ADD_CERT_TO_BUF), "ssl_add_cert_to_buf"},
     {ERR_FUNC(SSL_F_SSL_ADD_CLIENTHELLO_RENEGOTIATE_EXT),
@@ -315,6 +316,7 @@ static ERR_STRING_DATA SSL_str_functs[] = {
     {ERR_FUNC(SSL_F_SSL_SET_WFD), "SSL_set_wfd"},
     {ERR_FUNC(SSL_F_SSL_SHUTDOWN), "SSL_shutdown"},
     {ERR_FUNC(SSL_F_SSL_SRP_CTX_INIT), "SSL_SRP_CTX_init"},
+    {ERR_FUNC(SSL_F_SSL_START_ASYNC_JOB), "SSL_START_ASYNC_JOB"},
     {ERR_FUNC(SSL_F_SSL_UNDEFINED_CONST_FUNCTION),
      "ssl_undefined_const_function"},
     {ERR_FUNC(SSL_F_SSL_UNDEFINED_FUNCTION), "ssl_undefined_function"},
@@ -521,6 +523,7 @@ static ERR_STRING_DATA SSL_str_reasons[] = {
      "error in received cipher list"},
     {ERR_REASON(SSL_R_EXCESSIVE_MESSAGE_SIZE), "excessive message size"},
     {ERR_REASON(SSL_R_EXTRA_DATA_IN_MESSAGE), "extra data in message"},
+    {ERR_REASON(SSL_R_FAILED_TO_INIT_ASYNC), "failed to init async"},
     {ERR_REASON(SSL_R_FRAGMENTED_CLIENT_HELLO), "fragmented client hello"},
     {ERR_REASON(SSL_R_GOT_A_FIN_BEFORE_A_CCS), "got a fin before a ccs"},
     {ERR_REASON(SSL_R_GOT_NEXT_PROTO_BEFORE_A_CCS),
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c
index 1c3b726..44374b4 100644
--- a/ssl/ssl_lib.c
+++ b/ssl/ssl_lib.c
@@ -158,6 +158,7 @@
 #ifndef OPENSSL_NO_ENGINE
 # include <openssl/engine.h>
 #endif
+#include <openssl/async.h>
 
 const char SSL_version_str[] = OPENSSL_VERSION_TEXT;
 
@@ -186,6 +187,17 @@ SSL3_ENC_METHOD ssl3_undef_enc_method = {
              int use_context))ssl_undefined_function,
 };
 
+struct ssl_async_args {
+    SSL *s;
+    void *buf;
+    int num;
+    int type;
+    union {
+        int (*func1)(SSL *, void *, int);
+        int (*func2)(SSL *, const void *, int);
+    } f;
+};
+
 static void clear_ciphers(SSL *s)
 {
     /* clear the current cipher */
@@ -386,6 +398,8 @@ SSL *SSL_new(SSL_CTX *ctx)
     s->psk_server_callback = ctx->psk_server_callback;
 #endif
 
+    s->job = NULL;
+
     return (s);
  err:
     SSL_free(s);
@@ -914,22 +928,40 @@ int SSL_check_private_key(const SSL *ssl)
                                    ssl->cert->key->privatekey));
 }
 
+int SSL_waiting_for_async(SSL *s)
+{
+    if(s->job)
+        return 1;
+
+    return 0;
+}
+
+int SSL_get_async_wait_fd(SSL *s)
+{
+    if (!s->job)
+        return -1;
+
+    return ASYNC_get_wait_fd(s->job);
+}
+
 int SSL_accept(SSL *s)
 {
-    if (s->handshake_func == 0)
+    if (s->handshake_func == 0) {
         /* Not properly initialized yet */
         SSL_set_accept_state(s);
+    }
 
-    return (s->method->ssl_accept(s));
+    return SSL_do_handshake(s);
 }
 
 int SSL_connect(SSL *s)
 {
-    if (s->handshake_func == 0)
+    if (s->handshake_func == 0) {
         /* Not properly initialized yet */
         SSL_set_connect_state(s);
+    }
 
-    return (s->method->ssl_connect(s));
+    return SSL_do_handshake(s);
 }
 
 long SSL_get_default_timeout(const SSL *s)
@@ -937,6 +969,46 @@ long SSL_get_default_timeout(const SSL *s)
     return (s->method->get_timeout());
 }
 
+static int ssl_start_async_job(SSL *s, struct ssl_async_args *args,
+                          int (*func)(void *)) {
+    int ret;
+    switch(ASYNC_start_job(&s->job, &ret, func, args,
+        sizeof(struct ssl_async_args))) {
+    case ASYNC_ERR:
+        s->rwstate = SSL_NOTHING;
+        SSLerr(SSL_F_SSL_START_ASYNC_JOB, SSL_R_FAILED_TO_INIT_ASYNC);
+        return -1;
+    case ASYNC_PAUSE:
+        s->rwstate = SSL_ASYNC_PAUSED;
+        return -1;
+    case ASYNC_FINISH:
+        s->job = NULL;
+        return ret;
+    default:
+        s->rwstate = SSL_NOTHING;
+        SSLerr(SSL_F_SSL_START_ASYNC_JOB, ERR_R_INTERNAL_ERROR);
+        /* Shouldn't happen */
+        return -1;
+    }
+}
+
+static int ssl_io_intern(void *vargs)
+{
+    struct ssl_async_args *args;
+    SSL *s;
+    void *buf;
+    int num;
+
+    args = (struct ssl_async_args *)vargs;
+    s = args->s;
+    buf = args->buf;
+    num = args->num;
+    if (args->type == 1)
+        return args->f.func1(s, buf, num);
+    else
+        return args->f.func2(s, buf, num);
+}
+
 int SSL_read(SSL *s, void *buf, int num)
 {
     if (s->handshake_func == 0) {
@@ -948,7 +1020,20 @@ int SSL_read(SSL *s, void *buf, int num)
         s->rwstate = SSL_NOTHING;
         return (0);
     }
-    return (s->method->ssl_read(s, buf, num));
+
+    if((s->mode & SSL_MODE_ASYNC) && ASYNC_get_current_job() == NULL) {
+        struct ssl_async_args args;
+
+        args.s = s;
+        args.buf = buf;
+        args.num = num;
+        args.type = 1;
+        args.f.func1 = s->method->ssl_read;
+
+        return ssl_start_async_job(s, &args, ssl_io_intern);
+    } else {
+        return s->method->ssl_read(s, buf, num);
+    }
 }
 
 int SSL_peek(SSL *s, void *buf, int num)
@@ -961,7 +1046,19 @@ int SSL_peek(SSL *s, void *buf, int num)
     if (s->shutdown & SSL_RECEIVED_SHUTDOWN) {
         return (0);
     }
-    return (s->method->ssl_peek(s, buf, num));
+    if((s->mode & SSL_MODE_ASYNC) && ASYNC_get_current_job() == NULL) {
+        struct ssl_async_args args;
+
+        args.s = s;
+        args.buf = buf;
+        args.num = num;
+        args.type = 1;
+        args.f.func1 = s->method->ssl_peek;
+
+        return ssl_start_async_job(s, &args, ssl_io_intern);
+    } else {
+        return s->method->ssl_peek(s, buf, num);
+    }
 }
 
 int SSL_write(SSL *s, const void *buf, int num)
@@ -976,7 +1073,20 @@ int SSL_write(SSL *s, const void *buf, int num)
         SSLerr(SSL_F_SSL_WRITE, SSL_R_PROTOCOL_IS_SHUTDOWN);
         return (-1);
     }
-    return (s->method->ssl_write(s, buf, num));
+
+    if((s->mode & SSL_MODE_ASYNC) && ASYNC_get_current_job() == NULL) {
+        struct ssl_async_args args;
+
+        args.s = s;
+        args.buf = (void *)buf;
+        args.num = num;
+        args.type = 2;
+        args.f.func2 = s->method->ssl_write;
+
+        return ssl_start_async_job(s, &args, ssl_io_intern);
+    } else {
+        return s->method->ssl_write(s, buf, num);
+    }
 }
 
 int SSL_shutdown(SSL *s)
@@ -2373,6 +2483,9 @@ int SSL_get_error(const SSL *s, int i)
     if ((i < 0) && SSL_want_x509_lookup(s)) {
         return (SSL_ERROR_WANT_X509_LOOKUP);
     }
+    if ((i < 0) && SSL_want_async(s)) {
+        return SSL_ERROR_WANT_ASYNC;
+    }
 
     if (i == 0) {
         if ((s->shutdown & SSL_RECEIVED_SHUTDOWN) &&
@@ -2382,21 +2495,40 @@ int SSL_get_error(const SSL *s, int i)
     return (SSL_ERROR_SYSCALL);
 }
 
+static int ssl_do_handshake_intern(void *vargs)
+{
+    struct ssl_async_args *args;
+    SSL *s;
+
+    args = (struct ssl_async_args *)vargs;
+    s = args->s;
+
+    return s->handshake_func(s);
+}
+
 int SSL_do_handshake(SSL *s)
 {
     int ret = 1;
 
     if (s->handshake_func == NULL) {
         SSLerr(SSL_F_SSL_DO_HANDSHAKE, SSL_R_CONNECTION_TYPE_NOT_SET);
-        return (-1);
+        return -1;
     }
 
     s->method->ssl_renegotiate_check(s);
 
     if (SSL_in_init(s) || SSL_in_before(s)) {
-        ret = s->handshake_func(s);
+        if((s->mode & SSL_MODE_ASYNC) && ASYNC_get_current_job() == NULL) {
+            struct ssl_async_args args;
+
+            args.s = s;
+
+            ret = ssl_start_async_job(s, &args, ssl_do_handshake_intern);
+        } else {
+            ret = s->handshake_func(s);
+        }
     }
-    return (ret);
+    return ret;
 }
 
 void SSL_set_accept_state(SSL *s)
@@ -2432,8 +2564,6 @@ int ssl_undefined_void_function(void)
 
 int ssl_undefined_const_function(const SSL *s)
 {
-    SSLerr(SSL_F_SSL_UNDEFINED_CONST_FUNCTION,
-           ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
     return (0);
 }
 
diff --git a/ssl/ssl_locl.h b/ssl/ssl_locl.h
index 6ccdbe4..0657c20 100644
--- a/ssl/ssl_locl.h
+++ b/ssl/ssl_locl.h
@@ -163,6 +163,7 @@
 # endif
 # include <openssl/err.h>
 # include <openssl/ssl.h>
+# include <openssl/async.h>
 # include <openssl/symhacks.h>
 
 #include "record/record.h"
@@ -1199,6 +1200,9 @@ struct ssl_st {
 
     /* Default password callback user data. */
     void *default_passwd_callback_userdata;
+
+    /* Async Job info */
+    ASYNC_JOB *job;
 };
 
 
diff --git a/test/Makefile b/test/Makefile
index ffeba40..efab366 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -78,6 +78,7 @@ SSLVERTOLTEST=	sslvertoltest
 SSLEXTENSIONTEST=	sslextensiontest
 SSLSESSIONTICKTEST= 	sslsessionticktest
 SSLSKEWITH0PTEST=	sslskewith0ptest
+ASYNCTEST=	asynctest
 
 TESTS=		alltests
 
@@ -97,7 +98,7 @@ EXE=	$(NPTEST)$(EXE_EXT) $(BNTEST)$(EXE_EXT) $(ECTEST)$(EXE_EXT) \
 	$(SRPTEST)$(EXE_EXT) $(V3NAMETEST)$(EXE_EXT) \
 	$(HEARTBEATTEST)$(EXE_EXT) $(P5_CRPT2_TEST)$(EXE_EXT) \
 	$(CONSTTIMETEST)$(EXE_EXT) $(VERIFYEXTRATEST)$(EXE_EXT) \
-	$(CLIENTHELLOTEST)$(EXE_EXT) $(PACKETTEST)$(EXE_EXT)
+	$(CLIENTHELLOTEST)$(EXE_EXT) $(PACKETTEST)$(EXE_EXT) $(ASYNCTEST)$(EXE_EXT)
 
 # $(METHTEST)$(EXE_EXT)
 
@@ -113,7 +114,7 @@ OBJ=	$(NPTEST).o $(BNTEST).o $(ECTEST).o \
 	$(EVPTEST).o $(EVPEXTRATEST).o $(IGETEST).o $(JPAKETEST).o $(V3NAMETEST).o \
 	$(GOST2814789TEST).o $(HEARTBEATTEST).o $(P5_CRPT2_TEST).o \
 	$(CONSTTIMETEST).o $(VERIFYEXTRATEST).o $(CLIENTHELLOTEST).o \
-	$(PACKETTEST).o testutil.o
+	$(PACKETTEST).o $(ASYNCTEST).o testutil.o
 
 SRC=	$(NPTEST).c $(BNTEST).c $(ECTEST).c \
 	$(ECDSATEST).c $(ECDHTEST).c $(GMDIFFTEST).c $(PBELUTEST).c $(IDEATEST).c \
@@ -126,7 +127,7 @@ SRC=	$(NPTEST).c $(BNTEST).c $(ECTEST).c \
 	$(EVPTEST).c $(EVPEXTRATEST).c $(IGETEST).c $(JPAKETEST).c $(V3NAMETEST).c \
 	$(GOST2814789TEST).c $(HEARTBEATTEST).c $(P5_CRPT2_TEST).c \
 	$(CONSTTIMETEST).c $(VERIFYEXTRATEST).c $(CLIENTHELLOTEST).c \
-	$(PACKETTEST).c testutil.c
+	$(PACKETTEST).c $(ASYNCTEST).c testutil.c
 
 HEADER=	testutil.h
 
@@ -364,6 +365,9 @@ $(CLIENTHELLOTEST)$(EXE_EXT): $(CLIENTHELLOTEST).o
 $(PACKETTEST)$(EXE_EXT): $(PACKETTEST).o
 	@target=$(PACKETTEST) $(BUILD_CMD)
 
+$(ASYNCTEST)$(EXE_EXT): $(ASYNCTEST).o
+	@target=$(ASYNCTEST) $(BUILD_CMD)
+
 #$(AESTEST).o: $(AESTEST).c
 #	$(CC) -c $(CFLAGS) -DINTERMEDIATE_VALUE_KAT -DTRACE_KAT_MCT $(AESTEST).c
 
@@ -379,6 +383,22 @@ dummytest$(EXE_EXT): dummytest.o $(DLIBCRYPTO)
 
 # DO NOT DELETE THIS LINE -- make depend depends on it.
 
+asynctest.o: ../e_os.h ../include/../apps/apps.h ../include/../apps/progs.h
+asynctest.o: ../include/openssl/asn1.h ../include/openssl/async.h
+asynctest.o: ../include/openssl/bio.h ../include/openssl/buffer.h
+asynctest.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+asynctest.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+asynctest.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
+asynctest.o: ../include/openssl/engine.h ../include/openssl/evp.h
+asynctest.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+asynctest.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
+asynctest.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+asynctest.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
+asynctest.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+asynctest.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+asynctest.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+asynctest.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h
+asynctest.o: asynctest.c
 bftest.o: ../e_os.h ../include/openssl/blowfish.h ../include/openssl/e_os2.h
 bftest.o: ../include/openssl/opensslconf.h bftest.c
 bntest.o: ../crypto/bn/bn_lcl.h ../crypto/include/internal/bn_int.h ../e_os.h
@@ -539,7 +559,8 @@ gost2814789test.o: ../include/openssl/pkcs7.h ../include/openssl/safestack.h
 gost2814789test.o: ../include/openssl/sha.h ../include/openssl/stack.h
 gost2814789test.o: ../include/openssl/symhacks.h ../include/openssl/x509.h
 gost2814789test.o: ../include/openssl/x509_vfy.h gost2814789test.c
-heartbeat_test.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
+heartbeat_test.o: ../e_os.h ../include/openssl/asn1.h
+heartbeat_test.o: ../include/openssl/async.h ../include/openssl/bio.h
 heartbeat_test.o: ../include/openssl/bn.h ../include/openssl/buffer.h
 heartbeat_test.o: ../include/openssl/comp.h ../include/openssl/crypto.h
 heartbeat_test.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
@@ -659,30 +680,30 @@ sha1test.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
 sha1test.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
 sha1test.o: ../include/openssl/safestack.h ../include/openssl/sha.h
 sha1test.o: ../include/openssl/stack.h ../include/openssl/symhacks.h sha1test.c
-ssltest.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
-ssltest.o: ../include/openssl/bn.h ../include/openssl/buffer.h
-ssltest.o: ../include/openssl/comp.h ../include/openssl/conf.h
-ssltest.o: ../include/openssl/crypto.h ../include/openssl/dh.h
-ssltest.o: ../include/openssl/dsa.h ../include/openssl/dtls1.h
-ssltest.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
-ssltest.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
-ssltest.o: ../include/openssl/engine.h ../include/openssl/err.h
-ssltest.o: ../include/openssl/evp.h ../include/openssl/hmac.h
-ssltest.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
-ssltest.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
-ssltest.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
-ssltest.o: ../include/openssl/pem.h ../include/openssl/pem2.h
-ssltest.o: ../include/openssl/pkcs7.h ../include/openssl/pqueue.h
-ssltest.o: ../include/openssl/rand.h ../include/openssl/rsa.h
-ssltest.o: ../include/openssl/safestack.h ../include/openssl/sha.h
-ssltest.o: ../include/openssl/srp.h ../include/openssl/srtp.h
-ssltest.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
-ssltest.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
-ssltest.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h
-ssltest.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
-ssltest.o: ../include/openssl/x509v3.h ../ssl/packet_locl.h
-ssltest.o: ../ssl/record/record.h ../ssl/ssl_locl.h ../ssl/statem/statem.h
-ssltest.o: ssltest.c
+ssltest.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/async.h
+ssltest.o: ../include/openssl/bio.h ../include/openssl/bn.h
+ssltest.o: ../include/openssl/buffer.h ../include/openssl/comp.h
+ssltest.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+ssltest.o: ../include/openssl/dh.h ../include/openssl/dsa.h
+ssltest.o: ../include/openssl/dtls1.h ../include/openssl/e_os2.h
+ssltest.o: ../include/openssl/ec.h ../include/openssl/ecdh.h
+ssltest.o: ../include/openssl/ecdsa.h ../include/openssl/engine.h
+ssltest.o: ../include/openssl/err.h ../include/openssl/evp.h
+ssltest.o: ../include/openssl/hmac.h ../include/openssl/lhash.h
+ssltest.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h
+ssltest.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+ssltest.o: ../include/openssl/ossl_typ.h ../include/openssl/pem.h
+ssltest.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
+ssltest.o: ../include/openssl/pqueue.h ../include/openssl/rand.h
+ssltest.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
+ssltest.o: ../include/openssl/sha.h ../include/openssl/srp.h
+ssltest.o: ../include/openssl/srtp.h ../include/openssl/ssl.h
+ssltest.o: ../include/openssl/ssl2.h ../include/openssl/ssl3.h
+ssltest.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+ssltest.o: ../include/openssl/tls1.h ../include/openssl/x509.h
+ssltest.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h
+ssltest.o: ../ssl/packet_locl.h ../ssl/record/record.h ../ssl/ssl_locl.h
+ssltest.o: ../ssl/statem/statem.h ssltest.c
 testutil.o: ../e_os.h ../include/openssl/e_os2.h
 testutil.o: ../include/openssl/opensslconf.h testutil.c testutil.h
 v3nametest.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h
diff --git a/test/asynctest.c b/test/asynctest.c
new file mode 100644
index 0000000..be41d2b
--- /dev/null
+++ b/test/asynctest.c
@@ -0,0 +1,299 @@
+/* test/asynctest.c */
+/*
+ * Written by Matt Caswell for the OpenSSL project.
+ */
+/* ====================================================================
+ * Copyright (c) 2015 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    openssl-core at openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay at cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh at cryptsoft.com).
+ *
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <openssl/async.h>
+#include <openssl/crypto.h>
+#include <../apps/apps.h>
+
+#if defined(OPENSSL_SYS_UNIX) && defined(OPENSSL_THREADS)
+# include <unistd.h>
+# if _POSIX_VERSION >= 200112L
+#  define ASYNC_POSIX
+# endif
+#elif defined(_WIN32) || defined(__CYGWIN__)
+# define ASYNC_WIN
+#endif
+
+#if !defined(ASYNC_POSIX) && !defined(ASYNC_WIN)
+# define ASYNC_NULL
+#endif
+
+#ifndef ASYNC_NULL
+
+static int ctr = 0;
+static ASYNC_JOB *currjob = NULL;
+
+static int only_pause(void *args)
+{
+    ASYNC_pause_job();
+
+    return 1;
+}
+
+static int add_two(void *args)
+{
+    ctr++;
+    ASYNC_pause_job();
+    ctr++;
+
+    return 2;
+}
+
+static int save_current(void *args)
+{
+    currjob = ASYNC_get_current_job();
+    ASYNC_pause_job();
+
+    return 1;
+}
+
+static int wake(void *args)
+{
+    ASYNC_pause_job();
+    ASYNC_wake(ASYNC_get_current_job());
+    ASYNC_pause_job();
+    ASYNC_clear_wake(ASYNC_get_current_job());
+
+    return 1;
+}
+
+static int blockpause(void *args)
+{
+    ASYNC_block_pause();
+    ASYNC_pause_job();
+    ASYNC_unblock_pause();
+    ASYNC_pause_job();
+
+    return 1;
+}
+
+static int test_ASYNC_init()
+{
+    ASYNC_JOB *job1 = NULL, *job2 = NULL, *job3 = NULL;
+    int funcret1, funcret2, funcret3;
+
+    if (       !ASYNC_init(1, 2, 0)
+            || ASYNC_start_job(&job1, &funcret1, only_pause, NULL, 0)
+                != ASYNC_PAUSE
+            || ASYNC_start_job(&job2, &funcret2, only_pause, NULL, 0)
+                != ASYNC_PAUSE
+            || ASYNC_start_job(&job3, &funcret3, only_pause, NULL, 0)
+                != ASYNC_NO_JOBS
+            || ASYNC_start_job(&job1, &funcret1, only_pause, NULL, 0)
+                != ASYNC_FINISH
+            || ASYNC_start_job(&job3, &funcret3, only_pause, NULL, 0)
+                != ASYNC_PAUSE
+            || ASYNC_start_job(&job2, &funcret2, only_pause, NULL, 0)
+                != ASYNC_FINISH
+            || ASYNC_start_job(&job3, &funcret3, only_pause, NULL, 0)
+                != ASYNC_FINISH
+            || funcret1 != 1
+            || funcret2 != 1
+            || funcret3 != 1) {
+        fprintf(stderr, "test_ASYNC_init() failed\n");
+        ASYNC_cleanup(1);
+        return 0;
+    }
+
+    ASYNC_cleanup(1);
+    return 1;
+}
+
+static int test_ASYNC_start_job()
+{
+    ASYNC_JOB *job = NULL;
+    int funcret;
+
+    ctr = 0;
+
+    if (       !ASYNC_init(1, 1, 0)
+            || ASYNC_start_job(&job, &funcret, add_two, NULL, 0) != ASYNC_PAUSE
+            || ctr != 1
+            || ASYNC_start_job(&job, &funcret, add_two, NULL, 0) != ASYNC_FINISH
+            || ctr != 2
+            || funcret != 2) {
+        fprintf(stderr, "test_ASYNC_start_job() failed\n");
+        ASYNC_cleanup(1);
+        return 0;
+    }
+
+    ASYNC_cleanup(1);
+    return 1;
+}
+
+static int test_ASYNC_get_current_job()
+{
+    ASYNC_JOB *job = NULL;
+    int funcret;
+
+    currjob = NULL;
+
+    if (       !ASYNC_init(1, 1, 0)
+            || ASYNC_start_job(&job, &funcret, save_current, NULL, 0)
+                != ASYNC_PAUSE
+            || currjob != job
+            || ASYNC_start_job(&job, &funcret, save_current, NULL, 0)
+                != ASYNC_FINISH
+            || funcret != 1) {
+        fprintf(stderr, "test_ASYNC_get_current_job() failed\n");
+        ASYNC_cleanup(1);
+        return 0;
+    }
+
+    ASYNC_cleanup(1);
+    return 1;
+}
+
+static int hasdata(OSSL_ASYNC_FD fd)
+{
+#ifdef ASYNC_POSIX
+    fd_set checkfds;
+    struct timeval tv;
+    FD_ZERO(&checkfds);
+    openssl_fdset(fd, &checkfds);
+    memset(&tv, 0, sizeof tv);
+    if (select(fd + 1, (void *)&checkfds, NULL, NULL, &tv) < 0)
+        return -1;
+    if (FD_ISSET(fd, &checkfds))
+        return 1;
+    return 0;
+#else
+    DWORD avail = 0;
+
+    if (PeekNamedPipe(fd, NULL, 0, NULL, &avail, NULL) && avail > 0)
+        return 1;
+
+    return 0;
+#endif
+}
+
+static int test_ASYNC_get_wait_fd()
+{
+    ASYNC_JOB *job = NULL;
+    int funcret;
+    OSSL_ASYNC_FD fd;
+
+    if (       !ASYNC_init(1, 1, 0)
+            || ASYNC_start_job(&job, &funcret, wake, NULL, 0)
+                != ASYNC_PAUSE
+            || (fd = ASYNC_get_wait_fd(job)) < 0
+            || hasdata(fd) != 0
+            || ASYNC_start_job(&job, &funcret, save_current, NULL, 0)
+                != ASYNC_PAUSE
+            || hasdata(fd) != 1
+            || (ASYNC_clear_wake(job), 0)
+            || hasdata(fd) != 0
+            || (ASYNC_wake(job), 0)
+            || hasdata(fd) != 1
+            || ASYNC_start_job(&job, &funcret, save_current, NULL, 0)
+                != ASYNC_FINISH
+            || funcret != 1) {
+        fprintf(stderr, "test_ASYNC_get_wait_fd() failed\n");
+        ASYNC_cleanup(1);
+        return 0;
+    }
+
+    ASYNC_cleanup(1);
+    return 1;
+}
+
+static int test_ASYNC_block_pause()
+{
+    ASYNC_JOB *job = NULL;
+    int funcret;
+
+    if (       !ASYNC_init(1, 1, 0)
+            || ASYNC_start_job(&job, &funcret, blockpause, NULL, 0)
+                != ASYNC_PAUSE
+            || ASYNC_start_job(&job, &funcret, blockpause, NULL, 0)
+                != ASYNC_FINISH
+            || funcret != 1) {
+        fprintf(stderr, "test_ASYNC_block_pause() failed\n");
+        ASYNC_cleanup(1);
+        return 0;
+    }
+
+    ASYNC_cleanup(1);
+    return 1;
+}
+
+#endif
+
+int main(int argc, char **argv)
+{
+
+#ifdef ASYNC_NULL
+    fprintf(stderr, "NULL implementation - skipping async tests\n");
+#else
+    CRYPTO_malloc_debug_init();
+    CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL);
+    CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
+
+    if (       !test_ASYNC_init()
+            || !test_ASYNC_start_job()
+            || !test_ASYNC_get_current_job()
+            || !test_ASYNC_get_wait_fd()
+            || !test_ASYNC_block_pause()) {
+        return 1;
+    }
+#endif
+    printf("PASS\n");
+    return 0;
+}
diff --git a/test/recipes/90-test_async.t b/test/recipes/90-test_async.t
new file mode 100644
index 0000000..dfee578
--- /dev/null
+++ b/test/recipes/90-test_async.t
@@ -0,0 +1,5 @@
+#!/usr/bin/perl
+
+use OpenSSL::Test::Simple;
+
+simple_test("test_async", "asynctest", "async");
diff --git a/util/indent.pro b/util/indent.pro
index 4d1bd45..abfccc7 100644
--- a/util/indent.pro
+++ b/util/indent.pro
@@ -731,3 +731,6 @@
 -T SH_LIST
 -T PACKET
 -T RECORD_LAYER
+-T ASYNC_FIBRE
+-T ASYNC_CTX
+-T ASYNC_JOB
diff --git a/util/libeay.num b/util/libeay.num
index 1f905e8..0ff302c 100755
--- a/util/libeay.num
+++ b/util/libeay.num
@@ -4649,3 +4649,17 @@ X509_get0_uids                          5008	EXIST::FUNCTION:
 X509_aux_print                          5009	EXIST::FUNCTION:STDIO
 TS_RESP_CTX_set_signer_digest           5010	EXIST::FUNCTION:
 TS_CONF_set_signer_digest               5011	EXIST::FUNCTION:
+ENGINE_load_dasync                      5012	EXIST::FUNCTION:ENGINE,STATIC_ENGINE
+ASYNC_pause_job                         5013	EXIST::FUNCTION:
+ASYNC_start_job                         5014	EXIST::FUNCTION:
+ASYNC_init_thread                       5015	EXIST::FUNCTION:
+ASYNC_cleanup_thread                    5016	EXIST::FUNCTION:
+ASYNC_wake                              5017	EXIST::FUNCTION:
+ASYNC_clear_wake                        5018	EXIST::FUNCTION:
+ASYNC_get_current_job                   5019	EXIST::FUNCTION:
+ASYNC_get_wait_fd                       5020	EXIST::FUNCTION:
+ERR_load_ASYNC_strings                  5021	EXIST::FUNCTION:
+ASYNC_unblock_pause                     5022	EXIST::FUNCTION:
+ASYNC_block_pause                       5023	EXIST::FUNCTION:
+ASYNC_cleanup                           5024	EXIST::FUNCTION:
+ASYNC_init                              5025	EXIST::FUNCTION:
diff --git a/util/mkdef.pl b/util/mkdef.pl
index d20bac6..43b2c2b 100755
--- a/util/mkdef.pl
+++ b/util/mkdef.pl
@@ -331,6 +331,7 @@ $crypto.=" include/openssl/cms.h";
 $crypto.=" include/openssl/jpake.h";
 $crypto.=" include/openssl/srp.h";
 $crypto.=" include/openssl/modes.h";
+$crypto.=" include/openssl/async.h";
 
 my $symhacks="include/openssl/symhacks.h";
 
diff --git a/util/mkfiles.pl b/util/mkfiles.pl
index 68a9a6c..6e43cbf 100755
--- a/util/mkfiles.pl
+++ b/util/mkfiles.pl
@@ -64,6 +64,7 @@ my @dirs = (
 "crypto/ts",
 "crypto/srp",
 "crypto/ct",
+"crypto/async",
 "ssl",
 "apps",
 "engines",
diff --git a/util/ssleay.num b/util/ssleay.num
index be4c940..a63fd41 100755
--- a/util/ssleay.num
+++ b/util/ssleay.num
@@ -411,3 +411,5 @@ SSL_is_init_finished                    445	EXIST::FUNCTION:
 SSL_get_state                           446	EXIST::FUNCTION:
 SSL_set_default_passwd_cb               447	EXIST::FUNCTION:
 SSL_set_default_passwd_cb_userdata      448	EXIST::FUNCTION:
+SSL_waiting_for_async                   449	EXIST::FUNCTION:
+SSL_get_async_wait_fd                   450	EXIST::FUNCTION:


More information about the openssl-commits mailing list