From ceebc1e71598349ee37b25cd82fe7533760d670a Mon Sep 17 00:00:00 2001 From: Ping Yu Date: Mon, 7 Jan 2019 16:03:07 -0500 Subject: Change vpp code to align with openssl interface change PR in openssl community is almost done, and need to change some code in VPP to align with the openssl interface. Change-Id: Ic7da53e507b67b53958760d07738dd774b1c526d Signed-off-by: Ping Yu --- src/plugins/tlsopenssl/tls_openssl.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'src/plugins/tlsopenssl/tls_openssl.c') diff --git a/src/plugins/tlsopenssl/tls_openssl.c b/src/plugins/tlsopenssl/tls_openssl.c index 7994cc5d981..d07e0f89838 100644 --- a/src/plugins/tlsopenssl/tls_openssl.c +++ b/src/plugins/tlsopenssl/tls_openssl.c @@ -185,8 +185,7 @@ vpp_ssl_async_process_event (tls_ctx_t * ctx, engine_cb = vpp_add_async_pending_event (ctx, handler); if (engine_cb) { - SSL_set_async_callback (oc->ssl, (void *) engine_cb->callback, - (void *) engine_cb->arg); + SSL_set_async_callback_arg (oc->ssl, (void *) engine_cb->arg); TLS_DBG (2, "set callback to engine %p\n", engine_cb->callback); } return 0; @@ -201,7 +200,7 @@ vpp_ssl_async_retry_func (tls_ctx_t * ctx, openssl_resume_handler * handler) if (vpp_add_async_run_event (ctx, handler)) { - SSL_set_async_estatus (oc->ssl, 0); + SSL_clear_async_status (oc->ssl); } return 0; @@ -230,19 +229,23 @@ openssl_ctx_handshake_rx (tls_ctx_t * ctx, stream_session_t * tls_session) break; } +#ifdef HAVE_OPENSSL_ASYNC + myself = openssl_ctx_handshake_rx; + vpp_ssl_async_process_event (ctx, myself); +#endif + rv = SSL_do_handshake (oc->ssl); err = SSL_get_error (oc->ssl, rv); openssl_try_handshake_write (oc, tls_session); #ifdef HAVE_OPENSSL_ASYNC - myself = openssl_ctx_handshake_rx; - if (SSL_get_async_estatus (oc->ssl, &estatus) - && (estatus == ENGINE_STATUS_RETRY)) - { - vpp_ssl_async_retry_func (ctx, myself); - } - else if (err == SSL_ERROR_WANT_ASYNC) + if (err == SSL_ERROR_WANT_ASYNC) { - vpp_ssl_async_process_event (ctx, myself); + SSL_get_async_status (oc->ssl, &estatus); + + if (estatus == ASYNC_STATUS_EAGAIN) + { + vpp_ssl_async_retry_func (ctx, myself); + } } #endif @@ -587,6 +590,7 @@ openssl_start_listen (tls_ctx_t * lctx) #ifdef HAVE_OPENSSL_ASYNC if (om->async) SSL_CTX_set_mode (ssl_ctx, SSL_MODE_ASYNC); + SSL_CTX_set_async_callback (ssl_ctx, tls_async_openssl_callback); #endif SSL_CTX_set_options (ssl_ctx, flags); SSL_CTX_set_ecdh_auto (ssl_ctx, 1); -- cgit 1.2.3-korg