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

Support for building without wolfssl/openssl header files #8182

Merged
merged 4 commits into from
Nov 21, 2024

Conversation

dgarske
Copy link
Contributor

@dgarske dgarske commented Nov 13, 2024

Description

Support for building without wolfssl/openssl header files.

  • Fix for TlsSessionCacheGetAndLock that was not checking the sessionIDSz, so could return a pointer to an invalid session (if 0's). Resolves issue with test_wolfSSL_CTX_sess_set_remove_cb test.
  • Fix for size increase on X509 small.
  • Fix for CRL test with NO_RSA.
  • Fix for building with HAVE_SECRET_CALLBACK only.
  • Fix cast warning with HAVE_EX_DATA in Windows VS.
  • Fix openssl_extra without PKCS12.
  • Refactor the EX data crypto and session API's to gate on HAVE_EX_DATA_CRYPTO.
  • Grouped the EX data API's in ssl.h
  • Moved API's in ssl.h to separate the compatibility ones from ours.

Fixes ZD 18465

Testing

Support building with wolfssl/openssl/*.h files removed.

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@dgarske dgarske self-assigned this Nov 13, 2024
@dgarske
Copy link
Contributor Author

dgarske commented Nov 15, 2024

Retest this please

* Fix for `TlsSessionCacheGetAndLock` that was not checking the sessionIDSz, so could return a pointer to an invalid session (if 0's). Resolves issue with `test_wolfSSL_CTX_sess_set_remove_cb` test.
* Fix cast warning with `HAVE_EX_DATA` in Windows VS.
* Fix openssl_extra without PKCS12.
* Refactor the EX data crypto and session API's to gate on `HAVE_EX_DATA_CRYPTO`.
* Grouped the EX data API's in ssl.h
* Moved API's in ssl.h to separate the compatibility ones from ours.
@@ -1120,7 +1120,9 @@ static int TlsSessionCacheGetAndLock(const byte *id,
#else
s = &sessRow->Sessions[idx];
#endif
if (s && XMEMCMP(s->sessionID, id, ID_LEN) == 0 && s->side == side) {
/* match session ID value and length */
if (s && s->sessionIDSz == ID_LEN && s->side == side &&
Copy link
Contributor Author

@dgarske dgarske Nov 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@julek-wolfssl , please review this change. I spent over 8 hours tracking down this long standing bug. Occasionally this would be called with a session id of 0's and return an old released session and messing up the ex_data. The only solution I could find was to also check sessionIDSz since it is set to 0 when the session is released.

Copy link
Contributor

@JacobBarthelmeh JacobBarthelmeh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice refactor!

The only thing that I had to bring up is that this slightly increases the code size of the OPENSSL_EXTRA_X509_SMALL build. Adding the API's

wolfSSL_CTX_get_ex_data
wolfSSL_CTX_set_ex_data

Tested with ./configure --enable-opensslextra=x509small --enable-static --disable-shared && make && nm ./src/.libs/libwolfssl.a

Copy link
Contributor

@JacobBarthelmeh JacobBarthelmeh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks David!

@JacobBarthelmeh JacobBarthelmeh merged commit c06f65a into wolfSSL:master Nov 21, 2024
143 checks passed
dgarske added a commit to dgarske/wolfssl that referenced this pull request Nov 21, 2024
…ue with wolfEngine and wolfProvider. Change behavior for openssl compatibility headers to be installed unless `--enable-opensslextra=noinstall` is used. Removed dependency on X509 small with SESSION_CERTS, KEEP_PEER_CERTS and KEEP_OUR_CERT.
dgarske added a commit to dgarske/wolfssl that referenced this pull request Nov 21, 2024
…ue with wolfEngine and wolfProvider. Change behavior for openssl compatibility headers to be installed unless `--enable-opensslextra=noinstall` is used. Removed dependency on X509 small with SESSION_CERTS, KEEP_PEER_CERTS and KEEP_OUR_CERT.
bandi13 pushed a commit to bandi13/wolfssl that referenced this pull request Nov 22, 2024
In PR wolfSSL#8182 this line was accidentally wrapped in `#ifdef OPENSSL_EXTRA`
@bandi13 bandi13 mentioned this pull request Nov 22, 2024
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 this pull request may close these issues.

4 participants