ext/openssl: add a dtls:// stream transport. Open as Draft.#22638
Draft
GianfriAur wants to merge 15 commits into
Draft
ext/openssl: add a dtls:// stream transport. Open as Draft.#22638GianfriAur wants to merge 15 commits into
GianfriAur wants to merge 15 commits into
Conversation
openssl: Add DTLS version floor and peer_fingerprint to dtls:// openssl: Validate peer_fingerprint openssl: Fix dtls:// non-blocking I/O, handshake timeout and tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
dtls://stream transport (with thedtlsv1.2://alias) toext/openssl:DTLS 1.2 over UDP from the stream API, both client and server. It is the datagram
counterpart of
tls://, with the samesslcontext options where they apply andthe same
Openssl\Sessionobject.Design. No core changes: it only registers the schemes in
ext/openssl,without touching
xp_ssl.cor the stream layer. It is a separate file(
xp_dtls.c) because DTLS is UDP whilexp_ssl.cis TCP, and to avoid risking aregression on the TLS path; it still follows
xp_ssl.c's patterns and style andreuses its shared primitives (
Openssl\Session). The server accept usesDTLSv1_listen(): a stateless cookie exchange (RFC 6347 §4.2.1) againstamplification and spoofing, with a constant-time compare. It is the stable API
present in every released OpenSSL and stays valid for 1.2 even when OpenSSL caps it
in favour of the new listener API for 1.3. The server is single-peer (one peer per
bind); multi-peer is future work.
Features (client and server): peer verification (
verify_peer,verify_peer_name,peer_name,cafile/capath,peer_fingerprint), mutualauthentication (
local_certwithpassphrase), session resumption(
session_dataon the client; an external cache viasession_new_cb/session_get_cb/session_remove_cbplussession_id_context/no_ticket/session_timeouton the server), keying material export (RFC 5705) and Path MTU(
dtls_link_mtu). The session,session_reused, protocol and cipher are exposedin
stream_get_meta_data()['crypto'].Tests. A
.phptsuite underext/openssl/tests/dtls_*(client againstopenssl s_server, PHP server and client against each other, server againstopenssl s_client): handshake and round-trip, verification by CA/name/fingerprint,mutual auth, robustness against bogus datagrams, keying material, MTU, and full
client- and server-side resumption.
Separate follow-ups (outside the scheme-only scope, they touch the core or
OpenSSL's listener API): a multi-peer server, factoring the code
shared between
xp_ssl.candxp_dtls.cinto anxp_common, andenable_cryptoon
udp://. There is also a small TODO:php_openssl_dtls_parse_ip_address()duplicates
parse_ip_address_ex()fromxp_socket.c.Discussed on internals: https://externals.io/message/131514.
TODO before removing Draft status
UPGRADINGandNEWSmaster, green suite, coding standards