tls: openssl: fix SSL_read partial read scenario 06/38106/1
authorOfer Heifetz <oferh@marvell.com>
Thu, 2 Feb 2023 14:57:26 +0000 (06:57 -0800)
committerFlorin Coras <florin.coras@gmail.com>
Fri, 3 Feb 2023 03:58:51 +0000 (03:58 +0000)
commit701ba9cfe3f724d3b57d6397756a571d8469fbdf
treed97bed162ebaeb1efcfa522b2e85b07b29981abb
parent42b5a8767c8ba61d3fc7b531b3bc66525f9e3feb
tls: openssl: fix SSL_read partial read scenario

When application performs SSL_read from the app rx-fifo, it can
pre-allocate multiple segments, but there is an issue if the OpenSSL
manages to partially fill in the first segment, in this case, since
data is assumed to be copied over by OpenSSL to the pre-allocated
segments(s), vpp uses svm_fifo_enqueue_nocopy API which performs
zero copy by passing the pre-allocated segment to SSL_read.

If the decrypted data size is smaller than the pre-allocated fifo
segment buffer size, application will fetch buffers including zero
in the area not filled in by SSL_read.

Type: fix

Signed-off-by: Ofer Heifetz <oferh@marvell.com>
Change-Id: I941a89b17d567d86e5bd2c35785f1df043c33f38
(cherry picked from commit 905ec8797790380e134714e15ff3341eeeabb05e)
src/plugins/tlsopenssl/tls_openssl.c