wolfssl
wolfssl copied to clipboard
Add missing BIO_should_read and BIO_should_write functions
Description
Currently, BIO_should_retry exists as a component of the OpenSSL compatibility layer. However, there is no way to check the should_read/should_write flag of a BIO object - the BIO_should_read and BIO_should_write functions from OpenSSL are not implemented.
I've implemented the two missing functions as wolfSSL_BIO_should_read and wolfSSL_BIO_should_write by letting wolfSSL check the flags of the BIO, then created the compatibility definitions for BIO_should_read and BIO_should_write in the OpenSSL compatibility header.
Testing
I've created two unit tests, test_wolfSSL_BIO_should_read and test_wolfSSL_BIO_should_write. They each test the respective function before creating the connection and when a read or write is expected to happen.
I've ran the unit_test program after creating these unit tests, and all unit tests completed successfully.
Checklist
- [X] added tests
- [ ] updated/added doxygen
- [ ] updated appropriate READMEs
- [ ] Updated manual and documentation
Can one of the wolfSSL admins verify this patch?
Approved as contributor.
Okay to test
retest this please
@darktohka :
Testing: ./configure --enable-all
Running: make check
make[2]: warning: -j5 forced in submake: resetting jobserver mode.
tests/api.c:40013:10: error: unused variable 'ret' [-Werror,-Wunused-variable]
int ret;
^
tests/api.c:40051:14: error: variable 'bio' is uninitialized when used here [-Werror,-Wuninitialized]
BIO_read(bio, reply, sizeof(reply));
^~~
tests/api.c:40014:13: note: initialize the variable 'bio' to silence this warning
BIO* bio;
^
= NULL
tests/api.c:40048:26: error: variable 'ssl' is uninitialized when used here [-Werror,-Wuninitialized]
wolfSSL_SSLSetIORecv(ssl, EmbedReceive);
^~~
tests/api.c:40009:21: note: initialize the variable 'ssl' to silence this warning
WOLFSSL* ssl;
^
= NULL
tests/api.c:40084:10: error: unused variable 'ret' [-Werror,-Wunused-variable]
int ret;
^
tests/api.c:40121:14: error: variable 'bio' is uninitialized when used here [-Werror,-Wuninitialized]
BIO_read(bio, reply, sizeof(reply));
^~~
tests/api.c:40085:13: note: initialize the variable 'bio' to silence this warning
BIO* bio;
^
= NULL
tests/api.c:40118:26: error: variable 'ssl' is uninitialized when used here [-Werror,-Wuninitialized]
wolfSSL_SSLSetIORecv(ssl, EmbedReceive);
^~~
tests/api.c:40080:21: note: initialize the variable 'ssl' to silence this warning
WOLFSSL* ssl;
^
= NULL
6 errors generated.
Can one of the admins verify this patch?