aboutsummaryrefslogtreecommitdiff
path: root/crypto/async/arch
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2016-01-25 15:28:57 +0000
committerMatt Caswell <matt@openssl.org>2016-02-29 12:58:44 +0000
commitff75a25749c7fceaff7503af6f09d4299a052996 (patch)
tree4f7d8161e709ea1b82e9ceef0d27f78393b18127 /crypto/async/arch
parentb32166b4fabd2a3aeec382521b0173b24a5d7c02 (diff)
downloadopenssl-ff75a25749c7fceaff7503af6f09d4299a052996.zip
openssl-ff75a25749c7fceaff7503af6f09d4299a052996.tar.gz
openssl-ff75a25749c7fceaff7503af6f09d4299a052996.tar.bz2
Refactor the async wait fd logic
Implementation experience has shown that the original plan for async wait fds was too simplistic. Originally the async logic created a pipe internally and user/engine code could then get access to it via API calls. It is more flexible if the engine is able to create its own fd and provide it to the async code. Another issue is that there can be a lot of churn in the fd value within the context of (say) a single SSL connection leading to continually adding and removing fds from (say) epoll. It is better if we can provide some stability of the fd value across a whole SSL connection. This is problematic because an engine has no concept of an SSL connection. This commit refactors things to introduce an ASYNC_WAIT_CTX which acts as a proxy for an SSL connection down at the engine layer. Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/async/arch')
-rw-r--r--crypto/async/arch/async_null.c20
-rw-r--r--crypto/async/arch/async_posix.c32
-rw-r--r--crypto/async/arch/async_win.c36
3 files changed, 0 insertions, 88 deletions
diff --git a/crypto/async/arch/async_null.c b/crypto/async/arch/async_null.c
index 2b1d28e..03f8ebf 100644
--- a/crypto/async/arch/async_null.c
+++ b/crypto/async/arch/async_null.c
@@ -55,26 +55,6 @@
#ifdef ASYNC_NULL
-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;
-}
-
int async_global_init(void)
{
return 0;
diff --git a/crypto/async/arch/async_posix.c b/crypto/async/arch/async_posix.c
index 57cce7b..626471d 100644
--- a/crypto/async/arch/async_posix.c
+++ b/crypto/async/arch/async_posix.c
@@ -103,36 +103,4 @@ void async_fibre_free(async_fibre *fibre)
fibre->fibre.uc_stack.ss_sp = NULL;
}
-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/crypto/async/arch/async_win.c b/crypto/async/arch/async_win.c
index e862e25..c0776b1 100644
--- a/crypto/async/arch/async_win.c
+++ b/crypto/async/arch/async_win.c
@@ -127,42 +127,6 @@ 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);