Skip to content

Guard wolfSSL_CTX_set_alpn_protos with HAVE_ALPN - #11232

Open
holtrop-wolfssl wants to merge 1 commit into
wolfSSL:masterfrom
holtrop-wolfssl:f-10717
Open

Guard wolfSSL_CTX_set_alpn_protos with HAVE_ALPN#11232
holtrop-wolfssl wants to merge 1 commit into
wolfSSL:masterfrom
holtrop-wolfssl:f-10717

Conversation

@holtrop-wolfssl

Copy link
Copy Markdown
Contributor

Description

This was found while investigating F-10717.

This does not change the default build options which is the main thing that F-10717 is identifying. Rather, a secondary finding related was that the wolfSSL_CTX_set_alpn_protos function was not guarded by HAVE_ALPN. I moved the guard in ssl_api_ext.c up so that wolfSSL_CTX_set_alpn_protos is guarded the same as wolfSSL_set_alpn_protos below it.

Testing

How did you test?

Checklist

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

@holtrop-wolfssl holtrop-wolfssl self-assigned this Aug 21, 2026
Copilot AI lite review requested due to automatic review settings August 21, 2026 14:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR aligns the OpenSSL-compat ALPN API surface so wolfSSL_CTX_set_alpn_protos() is only available when ALPN support is actually compiled in (HAVE_ALPN) and BIO is available (!NO_BIO), matching the existing guard pattern used for wolfSSL_set_alpn_protos().

Changes:

  • Guarded wolfSSL_CTX_set_alpn_protos() (and its header declaration) with HAVE_ALPN && !NO_BIO.
  • Moved the implementation guard in src/ssl_api_ext.c so both ALPN “set protos” functions share the same compile-time conditions.
  • Updated API tests to only reference wolfSSL_CTX_set_alpn_protos() when the symbol is available.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
wolfssl/ssl.h Wraps wolfSSL_CTX_set_alpn_protos() / wolfSSL_set_alpn_protos() declarations with HAVE_ALPN && !NO_BIO under OPENSSL_EXTRA.
src/ssl_api_ext.c Moves HAVE_ALPN / !NO_BIO guards upward to include wolfSSL_CTX_set_alpn_protos().
tests/api/test_ssl_ext.c Updates the invalid-args test guard to include HAVE_ALPN && !NO_BIO.
tests/api.c Avoids defining/using ALPN protos variables unless OPENSSL_EXTRA && HAVE_ALPN && !NO_BIO, matching availability.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@holtrop-wolfssl

Copy link
Copy Markdown
Contributor Author

retest this please (ERROR: Build 'PRB-generic-config-parser' failed with result: FAILURE)

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #11232

Scan targets checked: wolfcrypt-rs-bugs, wolfssl-bugs, wolfssl-src

No new issues found in the changed files. ✅

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