Hybrid (PQ) TLS#8097
Conversation
There was a problem hiding this comment.
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_listtoSSL_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. |
| 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; | ||
| } |
|
|
||
| ### 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). |
| // approved classical groups as fallbacks | ||
| CHECK1(SSL_CTX_set1_groups_list( | ||
| cfg, | ||
| "?X25519MLKEM768:?SecP256r1MLKEM768:?SecP384r1MLKEM1024:" |
There was a problem hiding this comment.
Not sure about the relative order of 25519 to the NIST curves, but 384hybrid should be before 256hybrid (same as for the EC ones)? If a client supports the stronger/larger variants, we probably want to use those, same as for pure EC.
While looking at alternatives to #8076, following @achamayou's proposed design:
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.I think this is exactly what we want? And may even resolve #8061? But looking for input from @maxtropets.