Reduce the instruction overhead of OpenSSL calls

Started by ryanewang(王蕾)about 1 year ago2 messages
Jump to latest
#1ryanewang(王蕾)
ryanewang@tencent.com

Hi,
From the openssl documentation, when the value of ret is greater than 0, the SSL_get_error() function returns SSL_ERROR_NONE. 
So, it seems that when the return value of SSL_read() or SSL_write() function is greater than 0, we don't need to make an error judgment. 
The attached patch attempts to reduce unnecessary error judgments. 

I am glad for feedback and reviews!

腾讯
ryanewang 研发四组员工

Attachments:

0001-Patch-Remove-unnecessary-OpenSSL-error-judgment.patchapplication/octet-stream; charset=utf-8; name=0001-Patch-Remove-unnecessary-OpenSSL-error-judgment.patchDownload+32-1
#2Daniel Gustafsson
daniel@yesql.se
In reply to: ryanewang(王蕾) (#1)
Re: Reduce the instruction overhead of OpenSSL calls

On 27 Feb 2025, at 14:16, ryanewang(王蕾) <ryanewang@tencent.com> wrote:

Hi,
From the openssl documentation, when the value of ret is greater than 0, the SSL_get_error() function returns SSL_ERROR_NONE.
So, it seems that when the return value of SSL_read() or SSL_write() function is greater than 0, we don't need to make an error judgment.
The attached patch attempts to reduce unnecessary error judgments.

Calling SSL_get_error() is needed to clear the error queue for subsequent IO
operations, so I don't skipping it would be wise. I imagine that any overhead
is dwarfed by the time spent in network IO anyways.

--
Daniel Gustafsson