Skip to content

tlshd: Allow the use of post-quantum cryptography

Scott Mayhew kernel-tls-handshake 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 3 repliesIn review
  2. v15 patches 5 repliesSuperseded

Changes in v2 from the cover letter

- Refactoring to allow the client and server code to use the same tlshd_config_get_* functions
- Removed a lot of "#ifdef HAVE_GNUTLS_MLDSA" statements (I'm pretty sure the handful that are left are necessary)
- Store both the PQ and RSA certs in the same array. The PQ certs (if present) will be first, followed by the RSA certs. Note that I didn't increase TLSHD_MAX_CERTS though.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4tlshd: deduplicate client and server config functionssrc/tlshd/client.c src/tlshd/config.c src/tlshd/server.c +1 more+62 -1910 replies
2/4tlshd: Fix priority string to allow PQCsrc/tlshd/ktls.c+1 -16 replies
3/4tlshd: Server-side dual certificate supportconfigure.ac src/tlshd/client.c src/tlshd/config.c +4 more+225 -140 replies
4/4tlshd: Client-side dual certificate supportsrc/tlshd/client.c src/tlshd/tlshd.conf+39 -80 replies

Reviews trailers per patch

1 of 4 patches has a Reviewed-by or Acked-by.

PatchAlistair FrancisHannes Reinecke
1/4
2/4T-b R-b R-b
3/4
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/4] tlshd: Allow the use of post-quantum cryptography

These patches allow tlshd to use post-quantum cryptography. The first patch does a bit of refactoring to reduce some code duplication. The second fixes the priority string and allows the PQ algorithms to be used. The other two implement dual certificate support. Dual certificates are necessary to enable a smooth transition period, allowing servers to work with both clients that are PQ-enabled and clients that are not. The server will prefer the ML-DSA certificate but will fall back to the traditional certificate for clients that do not support ML-DSA.

Changes since v1:
- Refactoring to allow the client and server code to use the same tlshd_config_get_* functions
- Removed a lot of "#ifdef HAVE_GNUTLS_MLDSA" statements (I'm pretty sure the handful that are left are necessary)
- Store both the PQ and RSA certs in the same array. The PQ certs (if present) will be first, followed by the RSA certs. Note that I didn't increase TLSHD_MAX_CERTS though.

For those who prefer a web UI, these patches are also available in this branch:
https://github.com/scottmayhew/ktls-utils/tree/pqc

To use these patches, you need a recent version of gnutls as well as crypto-policies (if used by your distro). These commands will help you determine if your gnutls has the necessary stuff:

$ gnutls-cli -l | grep ML-DSA
$ gnutls-cli -l | grep MLKEM

You'll need to generate a cert using ML-DSA-44/ML-DSA-65/ML-DSA-87. For example, here's how I generate a self-signed cert using ML-DSA-65:

$ openssl req -new -x509 -newkey mldsa65 -days 365 \
	-keyout /etc/pki/tls/private/rhel10.smayhew.test.mldsa65.key \
	-out /etc/pki/tls/certs/rhel10.smayhew.test.mldsa65.pem \
	-subj "/CN=rhel10.smayhew.test" \
	-addext "subjectAltName=DNS:rhel10.smayhew.test,IP:192.168.124.69" \
	-noenc -quiet

Obviously if you're using openssl to generate your certs, you'll need a recent openssl too. Or you can use certtool if you prefer the gnutls utilities.

You'll need to add the cert and key to the relevant sections of tlshd.conf and you should be good to go.

If you have debug logging turned on, you should see this if you perform a handshake with a PQ-enabled peer you should see something like this:

Aug 28 17:58:25 rhel10.smayhew.test tlshd[3291]: Session description: (TLS1.3)-(HYBRID-X25519-MLKEM768)-(ML-DSA-65)-(AES-256-GCM)

and if you perform a handshake with a non-PQ-enabled peer:

Aug 28 18:04:21 rhel10.smayhew.test tlshd[3352]: Session description: (TLS1.3)-(ECDHE-X25519)-(RSA-PSS-RSAE-SHA256)-(AES-256-GCM)

-Scott

Scott Mayhew (4):
tlshd: deduplicate client and server config functions
tlshd: Fix priority string to allow PQC
tlshd: Server-side dual certificate support
tlshd: Client-side dual certificate support

 configure.ac             |  12 ++
 src/tlshd/client.c       |  48 +++++--
 src/tlshd/config.c       | 281 +++++++++++++++++++--------------------
 src/tlshd/ktls.c         |   2 +-
 src/tlshd/server.c       |  74 ++++++++++-
 src/tlshd/tlshd.conf     |   4 +
 src/tlshd/tlshd.conf.man |  15 +++
 src/tlshd/tlshd.h        |  23 ++--
 8 files changed, 286 insertions(+), 173 deletions(-)
Signature · 1 line
2.50.1