Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[doc] Document that a BIO pair may need 2-pass read to retrieve all bytes due to ring buffer #7160

Closed
space88man opened this issue Jan 22, 2024 · 2 comments · Fixed by #7169
Assignees

Comments

@space88man
Copy link
Contributor

space88man commented Jan 22, 2024

Version

master

Description

When a BIO pair has known NN bytes available from (wolfSSL_BIO_pending) it may still need two-pass wolfSSL_BIO_read to get all bytes due to ring buffer, i.e, the first read may be short, then the 2nd read will get the remainder.

This is an implementation detail as wolfSSL_BIO_BIO_read uses wolfSSL_BIO_nread0 under the cover and does not perform wrap around (i.e it does only 1 x XMEMCPY).

This is different behaviour from OpenSSL where the BIO_read on a BIO pair will do wrap around.
(The OpenSSL nread behaviour is the same as wolfSSL's nread behaviour). OpenSSL uses two implementations - a BIO_read that does wrap around(and provides all bytes in one pass) and a BIO_nread that does not do wrap around.

@julek-wolfssl
Copy link
Member

Thank you for your report. I opened a pull request that solves your issue at #7169. Please try it and let us know your feedback.

@space88man
Copy link
Contributor Author

Great - LGTM.

Thank you for your report. I opened a pull request that solves your issue at #7169. Please try it and let us know your feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants