Skip to content

Hybrid (PQ) TLS#8097

Open
eddyashton wants to merge 7 commits into
microsoft:mainfrom
eddyashton:tls_context_pq_groups
Open

Hybrid (PQ) TLS#8097
eddyashton wants to merge 7 commits into
microsoft:mainfrom
eddyashton:tls_context_pq_groups

Conversation

@eddyashton

Copy link
Copy Markdown
Member

While looking at alternatives to #8076, following @achamayou's proposed design:

I think this is ideally moved to the code, where we detect if we crypto provider support PQC values, and extend the list in that case.

I spotted that [SSL_CTX_set1_curves](https://docs.openssl.org/master/man3/SSL_CTX_set1_curves/) has a ? syntax that handles this detection automagically.

If a group name is prefixed with the ? character, it will be ignored if an implementation is missing. Otherwise, listing an unknown group name will cause a failure to parse the list. Note that whether a group is known or not may depend on the OpenSSL version, how OpenSSL was compiled and/or which providers are loaded. Make sure you have the correct spelling of the group name and when in doubt prefix it with a ? to handle configurations in which it might nevertheless be unknown.

I think this is exactly what we want? And may even resolve #8061? But looking for input from @maxtropets.

@eddyashton
eddyashton requested a review from a team as a code owner July 24, 2026 11:52
Copilot AI review requested due to automatic review settings July 24, 2026 11:52

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

Updates CCF’s TLS configuration to prefer hybrid post-quantum (PQ) key exchange groups when supported by the linked OpenSSL build, while keeping the current classical ECDHE groups as fallbacks. This aligns with the goal of enabling hybrid secret exchange (per #8061) without hard-failing on OpenSSL builds/providers that don’t recognize PQ group names.

Changes:

  • Switch TLS group configuration from SSL_CTX_set1_curves_list to SSL_CTX_set1_groups_list, adding ?-prefixed hybrid PQ group names ahead of existing P-521/P-384/P-256.
  • Refactor TLS test handshake logic and add a test asserting that a hybrid PQ group is negotiated when OpenSSL supports them.
  • Add a CHANGELOG entry describing the behavior change.

Custom instructions used:

  • .github/copilot-instructions.md
  • .github/instructions/reviewing.instructions.md
  • .github/instructions/changelog.instructions.md

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/tls/context.h Prefer hybrid PQ TLS groups via SSL_CTX_set1_groups_list with ?-prefixed optional group names, retaining classical fallbacks.
src/tls/test/main.cpp Extract handshake helper and add a test checking negotiation prefers a hybrid PQ group when supported.
CHANGELOG.md Document the TLS group preference change.

Comment thread src/tls/test/main.cpp
Comment on lines +484 to +494
std::string negotiated_group_name()
{
const auto nid = SSL_get_negotiated_group(get_ssl());
if (nid == NID_undef)
{
return {};
}

const auto* name = OBJ_nid2sn(nid);
return name == nullptr ? std::to_string(nid) : name;
}
Comment thread CHANGELOG.md Outdated

### Changed

- TLS handshakes now prefer OpenSSL hybrid post-quantum key exchange groups when the linked OpenSSL version supports them, while retaining the existing P-521/P-384/P-256 groups as fallbacks (#0000).
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.

Hybrid (classical crypto + PQ) TLS in CCF

2 participants