tls: fix tlsopenssl for remaining buffer

Type: fix

1. added additional checks for pending data in
   openssl_ctx_read_tls().
2. fixed read/write typo issues.

Signed-off-by: Sivaprasad Tummala <Sivaprasad.Tummala@intel.com>
Change-Id: Id018c62bb9e02bf0d5f9abf929b6030b965a5d61
This commit is contained in:
Sivaprasad Tummala
2021-03-22 21:21:56 +05:30
parent 8919fec5ac
commit 04161c8f20

View File

@ -475,7 +475,7 @@ openssl_ctx_read_tls (tls_ctx_t *ctx, session_t *tls_session)
{ {
openssl_ctx_t *oc = (openssl_ctx_t *) ctx; openssl_ctx_t *oc = (openssl_ctx_t *) ctx;
session_t *app_session; session_t *app_session;
int read, wrote = 0; int read;
svm_fifo_t *f; svm_fifo_t *f;
if (PREDICT_FALSE (SSL_in_init (oc->ssl))) if (PREDICT_FALSE (SSL_in_init (oc->ssl)))
@ -493,10 +493,11 @@ openssl_ctx_read_tls (tls_ctx_t *ctx, session_t *tls_session)
if (read && app_session->session_state >= SESSION_STATE_READY) if (read && app_session->session_state >= SESSION_STATE_READY)
tls_notify_app_enqueue (ctx, app_session); tls_notify_app_enqueue (ctx, app_session);
if (SSL_pending (oc->ssl) > 0) if ((SSL_pending (oc->ssl) > 0) ||
svm_fifo_max_dequeue_cons (tls_session->rx_fifo))
tls_add_vpp_q_builtin_rx_evt (tls_session); tls_add_vpp_q_builtin_rx_evt (tls_session);
return wrote; return read;
} }
static inline int static inline int