Skip to content

ssl module: QUIC support for HTTP/3 #81229

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
tiran opened this issue May 25, 2019 · 6 comments
Open

ssl module: QUIC support for HTTP/3 #81229

tiran opened this issue May 25, 2019 · 6 comments
Assignees
Labels
extension-modules C modules in the Modules dir topic-SSL type-feature A feature request or enhancement

Comments

@tiran
Copy link
Member

tiran commented May 25, 2019

BPO 37048
Nosy @tiran, @alex, @njsmith, @dstufft, @jlaine

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/tiran'
closed_at = None
created_at = <Date 2019-05-25.19:44:14.320>
labels = ['expert-SSL', 'type-feature', '3.10']
title = 'ssl module: QUIC support for HTTP/3'
updated_at = <Date 2020-10-21.19:01:11.862>
user = 'https://github.com/tiran'

bugs.python.org fields:

activity = <Date 2020-10-21.19:01:11.862>
actor = 'jlaine'
assignee = 'christian.heimes'
closed = False
closed_date = None
closer = None
components = ['SSL']
creation = <Date 2019-05-25.19:44:14.320>
creator = 'christian.heimes'
dependencies = []
files = []
hgrepos = []
issue_num = 37048
keywords = []
message_count = 5.0
messages = ['343505', '343520', '343555', '379221', '379236']
nosy_count = 7.0
nosy_names = ['janssen', 'christian.heimes', 'alex', 'njs', 'SilentGhost', 'dstufft', 'jlaine']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue37048'
versions = ['Python 3.10']

@tiran
Copy link
Member Author

tiran commented May 25, 2019

This ticket collects information for QUIC [1][2] support and tracks, which APIs have to be added to Python in order to implement a QUIC protocol stack on top of Python's ssl and socket module. QUIC is a "UDP-Based Multiplexed and Secure Transport" protocol. It will replace TCP and TLS record layer as transport channels in the upcoming HTTP/3 [3][4] standard. Although it's UDP, QUIC does *not* use DTLS (Datagram TLS, vulgo TLS over UDP).

As far as I understand QUIC at the moment, the ssl module has to gain two additional features:

  1. A way to send/receive TLS messages that are not wrapped in the TLS record layer.
  2. A key callback that gets called whenever key material is exchanged during handshake or updated later on.

OpenSSL does not implement the necessary APIs, yet [5]. Tatsuhiro Tsujikawa's experimental OpenSSL fork [6] implements (1) as a SSL option SSL_MODE_QUIC_HACK and (2) as a callback that acts on five different key types.

(Disclaimer: My current understanding of QUIC is very limited.)

[1] https://tools.ietf.org/html/draft-ietf-quic-transport-20
[2] https://en.wikipedia.org/wiki/QUIC
[2] https://http3-explained.haxx.se/en/
[4] https://en.wikipedia.org/wiki/HTTP/3
[5] https://daniel.haxx.se/blog/2019/01/21/quic-and-missing-apis/
[6] https://github.com/tatsuhiro-t/openssl/commits/quic-draft-17

@tiran tiran added the 3.9 only security fixes label May 25, 2019
@tiran tiran self-assigned this May 25, 2019
@tiran tiran added topic-SSL type-feature A feature request or enhancement labels May 25, 2019
@jlaine
Copy link
Mannequin

jlaine mannequin commented May 25, 2019

I have started implementing a QUIC stack in Python [1] so I'll share a couple of thoughts in addition to Christian's two valid points:

  • SSLSocket is almost certainly not going to be the right entry point. QUIC's interface to TLS is entirely focused on passing in / out handshake messages and extracting secrets. No data is actually encrypted by the TLS engine.

  • In addition to being notified about keying material we will need access to the raw extensions either received in the EncryptedExtensions or the ClientHello. This is because QUIC exchanges its transport parameters in the form of a TLS extension.

  • We will also need additional APIs to manipulate session tickets, both when acting as a client and a server, in order to achieve 0-RTT handshakes. When acting as a client we need to be able to pass in the session ticket to use and be notified when a new session ticket is received. We also need to know the value of the max_early_data_size extension. When acting as a server we need a callback to provide the TLS engine with session tickets and to control issuing new session tickets, and provide the max_early_data_size value.

  • For header protection and payload encryption we need access to a number of crypto primitives including AES, ChaCha20 and a way to use AEAD.

For aioquic I decided to use cryptography's primitives and implemented a minimal TLS 1.3 engine on top of it. This avoids having to wait for some future version of OpenSSL to provide the necessary APIs or having to use a patched version of OpenSSL.

[1] https://github.com/aiortc/aioquic

@tiran
Copy link
Member Author

tiran commented May 26, 2019

Thanks for your feedback!

So far I actively refrained from exposing or implementing any encryption primitives and API like AES, ChaCha20, and ECDSA. I'm worried about potential legal issues and export control restrictions. I have to talk to VanL first.

@tiran
Copy link
Member Author

tiran commented Oct 21, 2020

OpenSSL 3.0.0 is not going support QUIC, https://www.openssl.org/blog/blog/2020/02/17/QUIC-and-OpenSSL/

@tiran tiran added 3.10 only security fixes and removed 3.9 only security fixes labels Oct 21, 2020
@jlaine
Copy link
Mannequin

jlaine mannequin commented Oct 21, 2020

The OpenSSL authors make a fair point, QUIC seems to be taking a long time to stabilize with little consideration for backwards compatibility at this stage.

As stated previously though it's perfectly feasible to implement a QUIC stack by linking to an unpatched OpenSSL if you're willing to implement a stripped-down TLS 1.3 engine yourself.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
@ezio-melotti ezio-melotti moved this to Todo in OpenSSL 3 Jun 15, 2022
@gpotter2
Copy link

gpotter2 commented Nov 25, 2024

Hi !
I'm wondering what's the state of this issue.

The QUIC RFC is now much more stable than back in 2020. Support is still a bit sparse, but Openssl 3.2 has at least added support for the client, and makes it look like it shouldn't be too hard to add support for it in Python's ssl module.

Update: Openssl 3.5 is out with server support. There shouldn't be any more roadblocks from the openssl side :P

@picnixz picnixz added extension-modules C modules in the Modules dir and removed 3.10 only security fixes labels Mar 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extension-modules C modules in the Modules dir topic-SSL type-feature A feature request or enhancement
Projects
Status: Todo
Development

No branches or pull requests

3 participants