summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPing Yu <ping.yu@intel.com>2018-11-05 15:41:01 -0500
committerMatt Caswell <matt@openssl.org>2019-01-27 12:27:17 +0000
commit9f5a87fd665cb597fa1c1f4eef882d2d2f833e61 (patch)
tree3bad8287fe464c81267aa7cf43a41344fd6db414 /include
parent61e033308b1c004bd808352fb1d786547dcdf62b (diff)
downloadopenssl-new-9f5a87fd665cb597fa1c1f4eef882d2d2f833e61.tar.gz
add an additional async notification communication method based on callback
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Yang <yang.yang@baishancloud.com> Signed-off-by: Ping Yu <ping.yu@intel.com> Signed-off-by: Steven Linsell <stevenx.linsell@intel.com> (Merged from https://github.com/openssl/openssl/pull/7573)
Diffstat (limited to 'include')
-rw-r--r--include/openssl/async.h14
-rw-r--r--include/openssl/ssl.h9
2 files changed, 23 insertions, 0 deletions
diff --git a/include/openssl/async.h b/include/openssl/async.h
index 71aef3bf98..910c144c6b 100644
--- a/include/openssl/async.h
+++ b/include/openssl/async.h
@@ -31,12 +31,18 @@ extern "C" {
typedef struct async_job_st ASYNC_JOB;
typedef struct async_wait_ctx_st ASYNC_WAIT_CTX;
+typedef int (*ASYNC_callback_fn)(void *arg);
#define ASYNC_ERR 0
#define ASYNC_NO_JOBS 1
#define ASYNC_PAUSE 2
#define ASYNC_FINISH 3
+#define ASYNC_STATUS_UNSUPPORTED 0
+#define ASYNC_STATUS_ERR 1
+#define ASYNC_STATUS_OK 2
+#define ASYNC_STATUS_EAGAIN 3
+
int ASYNC_init_thread(size_t max_size, size_t init_size);
void ASYNC_cleanup_thread(void);
@@ -52,6 +58,14 @@ int ASYNC_WAIT_CTX_get_fd(ASYNC_WAIT_CTX *ctx, const void *key,
OSSL_ASYNC_FD *fd, void **custom_data);
int ASYNC_WAIT_CTX_get_all_fds(ASYNC_WAIT_CTX *ctx, OSSL_ASYNC_FD *fd,
size_t *numfds);
+int ASYNC_WAIT_CTX_get_callback(ASYNC_WAIT_CTX *ctx,
+ ASYNC_callback_fn *callback,
+ void **callback_arg);
+int ASYNC_WAIT_CTX_set_callback(ASYNC_WAIT_CTX *ctx,
+ ASYNC_callback_fn callback,
+ void *callback_arg);
+int ASYNC_WAIT_CTX_set_status(ASYNC_WAIT_CTX *ctx, int status);
+int ASYNC_WAIT_CTX_get_status(ASYNC_WAIT_CTX *ctx);
int ASYNC_WAIT_CTX_get_changed_fds(ASYNC_WAIT_CTX *ctx, OSSL_ASYNC_FD *addfd,
size_t *numaddfds, OSSL_ASYNC_FD *delfd,
size_t *numdelfds);
diff --git a/include/openssl/ssl.h b/include/openssl/ssl.h
index ea41dd089e..c7a830445b 100644
--- a/include/openssl/ssl.h
+++ b/include/openssl/ssl.h
@@ -293,6 +293,9 @@ typedef int (*SSL_custom_ext_parse_cb_ex)(SSL *s, unsigned int ext_type,
/* Typedef for verification callback */
typedef int (*SSL_verify_cb)(int preverify_ok, X509_STORE_CTX *x509_ctx);
+/* Typedef for SSL async callback */
+typedef int (*SSL_async_callback_fn)(SSL *s, void *arg);
+
/*
* Some values are reserved until OpenSSL 1.2.0 because they were previously
* included in SSL_OP_ALL in a 1.1.x release.
@@ -1815,6 +1818,12 @@ __owur int SSL_get_all_async_fds(SSL *s, OSSL_ASYNC_FD *fds, size_t *numfds);
__owur int SSL_get_changed_async_fds(SSL *s, OSSL_ASYNC_FD *addfd,
size_t *numaddfds, OSSL_ASYNC_FD *delfd,
size_t *numdelfds);
+__owur int SSL_CTX_set_async_callback(SSL_CTX *ctx, SSL_async_callback_fn callback);
+__owur int SSL_CTX_set_async_callback_arg(SSL_CTX *ctx, void *arg);
+__owur int SSL_set_async_callback(SSL *s, SSL_async_callback_fn callback);
+__owur int SSL_set_async_callback_arg(SSL *s, void *arg);
+__owur int SSL_get_async_status(SSL *s, int *status);
+
# endif
__owur int SSL_accept(SSL *ssl);
__owur int SSL_stateless(SSL *s);