Skip to content

Require peer cert for server mode in TLS transport#363

Open
padelsbach wants to merge 1 commit into
wolfSSL:mainfrom
padelsbach:posix-transport-require-peer-cert
Open

Require peer cert for server mode in TLS transport#363
padelsbach wants to merge 1 commit into
wolfSSL:mainfrom
padelsbach:posix-transport-require-peer-cert

Conversation

@padelsbach
Copy link
Copy Markdown
Contributor

Fixes F-3809

@padelsbach padelsbach marked this pull request as ready for review May 12, 2026 23:07
@bigbrett bigbrett requested a review from JacobBarthelmeh May 13, 2026 14:46
@bigbrett bigbrett changed the title Require peer cert for server mode in TLS test Require peer cert for server mode in TLS transport May 13, 2026
Copy link
Copy Markdown

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

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #363

Scan targets checked: wolfhsm-core-bugs, wolfhsm-src

No new issues found in the changed files. ✅

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 adjusts the POSIX TLS transport’s server-side peer verification behavior so that when peer verification is enabled, the server requires the client to present a certificate (mTLS), aligning the transport behavior with “require peer cert” expectations.

Changes:

  • Extends LoadTlsCertificates() with an is_server flag to differentiate client vs server verification behavior.
  • In server mode (and when peer verification is not disabled), sets WOLFSSL_VERIFY_PEER | WOLFSSL_VERIFY_FAIL_IF_NO_PEER_CERT to require a client certificate.
  • Updates TLS client/server initialization paths to pass the new is_server flag.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +107 to +111
else if (is_server) {
wolfSSL_CTX_set_verify(ssl_ctx,
WOLFSSL_VERIFY_PEER |
WOLFSSL_VERIFY_FAIL_IF_NO_PEER_CERT,
NULL);
Comment on lines 63 to +65
static int LoadTlsCertificates(WOLFSSL_CTX* ssl_ctx,
const posixTransportTlsConfig* cfg)
const posixTransportTlsConfig* cfg,
int is_server)
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.

5 participants