Skip to content

feat(webrtc)!: run the vendored WebRTC stack on rind - #8229

Merged
kixelated merged 2 commits into
mainfrom
quest/m1/rind/rtc
Nov 8, 2026
Merged

kixelated merged 2 commits into
mainfrom
quest/m1/rind/rtc

Conversation

@kixelated

@kixelated kixelated commented Nov 8, 2026 •

Copy link
Copy Markdown
Collaborator

Finishes quest/m1/rind/rtc.md: the vendored str0m and dimpl in moq-webrtc run on rind instead of aws-lc-rs.

Summary

  • dimpl (vendor/dimpl/crypto/rind/): replaces crypto/aws_lc_rs/ with rind-dimpl 0.1.12 ported in, trimmed to DTLS 1.2: ECDHE-ECDSA with AES-128/256-GCM and ChaCha20-Poly1305 over X25519, P-256, and P-384, ECDSA P-256/P-384 signing and verifying, SHA-256/384, HMAC, and the system RNG. It puts ChaCha20 first on CPUs without AES instructions, as rind-dimpl does. dimpl's PSK AES-128-CCM-8 suite stays on its RustCrypto ccm cipher, so the same suites are offered. browser-only removes it.
  • str0m (vendor/str0m_rind/): replaces str0m_aws_lc_rs with rind-str0m (at moq-dev/rind@86567aa, which targeted the vendored str0m revision) ported to rind 0.1.12: SRTP AES-CM-HMAC-SHA1-80 and AEAD-AES-128/256-GCM, STUN MESSAGE-INTEGRITY (HMAC-SHA1), SHA-1/SHA-256 fingerprints, and DTLS through dimpl's rind provider. It also refuses an empty certificate or an unloadable key instead of letting dimpl panic.
  • Certificates: dimpl's generate_self_signed_certificate uses rind-rcgen, and rcgen loses its aws_lc_rs feature. str0m's provider reuses that generator.
  • CPU check: rind panics on a CPU that lacks a feature it needs. Every Rtc moq-webrtc builds now goes through session::rtc_config(), which first runs moq_crypto::cpu::check(), so WHIP/WHEP accept and dial and p2p peers fail with UnsupportedCpu instead.
  • HTTP client: reqwest switches from rustls (aws-lc-rs) to rustls-no-provider. Client::new installs rind's rustls provider through moq_crypto::provider::install_default, the same way moq-hls does.
  • Tests: the test-only HMAC-SHA1 helpers in server/mux.rs and is/stun.rs, and the SHA-1 reference in dtls-fingerprint.rs, use rind.
  • Cleanup:
    • Drops str0m's 15-byte CTR output padding, which only aws-lc-rs needed.
    • Drops the der, pkcs8, and sec1 dependencies, which only the aws-lc-rs signer used.
    • Drops the workspace aws-lc-rs, der, and sec1 entries, now unused (cargo-shear fails on them).
    • Regenerates workspace-hack.
  • Latent test bugs: dropping rcgen's aws_lc_rs feature from the unified build showed that 26 moq-tokio and moq-relay tests minted certificates without a serial number. They only passed because moq-webrtc's feature leaked in. They now set serials, as their neighbours already do. Production cert generation already set one.

cargo tree -p moq-webrtc --all-features --target all -e normal,build -i aws-lc-rs (also aws-lc-sys, ring) prints nothing. With moq-webrtc off it, moq-cli's own graph holds none either.

Verification

  • just check: 13660 tests pass, with lint and fmt clean.
  • moq-webrtc nextest: 1678 pass. This includes the vendored dimpl handshake suites, str0m's crypto-compliance vectors (RFC 3711 AES-CM, RFC 7714 GCM, RFC 2202 HMAC-SHA1), SRTP/SRTCP protect and unprotect, and DTLS fingerprint tests.
  • Real browsers. No automated browser-to-moq-webrtc test exists (test/p2p is browser to browser), so I drove headless Playwright against a local moq import rtc --listen … -- export rtc --listen …. Each browser published a fake camera and mic over WHIP, then played the broadcast back over WHEP:
    • Chromium: DTLS connected (TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, DTLS 1.2) with SRTP AEAD_AES_256_GCM in both directions, and 162 video frames decoded on playback.
    • Firefox: the same suite and profile, with 249 video frames decoded.

Impact

  • Public API (breaking):
    • moq_webrtc::Client::new(config) now returns moq_webrtc::Result<Client>. Migrate with Client::new(config)?.
    • moq_webrtc::Error and moq_webrtc::p2p::Error gain UnsupportedCpu(moq_crypto::cpu::UnsupportedCpu). Both enums are #[non_exhaustive].
  • Wire: unchanged. The same DTLS 1.2 suites, groups, signature schemes, and SRTP profiles are offered. Only the suite order changes, and only on CPUs without AES instructions, where ChaCha20-Poly1305 goes first.
  • CPU: moq-webrtc now needs a CPU that rind supports, the same as the other transports. doc/bin/rtc.md names rind.

Choices made without asking

  • rind version: I stayed on rind 0.1.12, which the workspace pins, rather than bumping to 0.3. The adapters were ported to that API: rind-dimpl from its 0.1.12 tag, and rind-str0m from its pre-deletion revision with 0.1.12's legacy HMAC and digest paths.
  • PSK suite: I kept dimpl's PSK CCM-8 suite, since the quest says the same suites are offered. Removing it belongs to browser-only.
  • Unset provider: dimpl's Config::build with no provider now returns ConfigError::UnsupportedCpu instead of falling back to aws-lc-rs. str0m's process-default fallback expects rind, which is reached only after moq-webrtc's CPU check.
  • CTR padding: I removed str0m's aws-lc-rs CTR padding instead of rewording its stale comments.
  • Epic size: quest/m1/rind/README.md now has no children, so it is sized [M] for its remaining CI guard and armv7 release work. The dead-api quest no longer lists this quest under Required.

Caused by

No single PR. aws-lc-rs was the backend the vendored stack came with in moq-dev/moq#8163.

Suggested follow-ups

  • Browser interop test for moq-webrtc: recommend planning it. The quest assumed "existing browser interop tests" prove the switch, but none drive a browser against moq-webrtc. The Playwright WHIP-to-WHEP round trip above (fake media, stats on DTLS and SRTP state and decoded frames) would make a cheap test/ recipe that guards the stack's crypto and negotiation against real Chromium and Firefox.

Models

Size: M
Implementer: Claude Code, claude-opus-5-5, high effort

(Written by Claude Opus 5.5 with high effort)

Review

Rewritten by quest review after each round.

  • Reviewer: Codex, gpt-6.1-sol, xhigh effort
  • Session: 01a1b8e2-0e04-75e1-a40c-e5470789d7a0, round 1
  • Head: d4150b9
  • Base: origin/main at 544f144
  • Score: 9/10, No actionable regressions were found, and the crypto adapters and caller updates appear consistent; builds and tests were not run, as instructed.
  • Findings: none

kixelated and others added 2 commits November 7, 2026 16:05
Quest-Claim: 39910b0626c3f809
The vendored str0m and dimpl drop their aws-lc-rs backend for rind:
DTLS 1.2, SRTP (AES-CM-HMAC-SHA1-80, AEAD AES-128/256-GCM), STUN
MESSAGE-INTEGRITY, and the DTLS certificates through rind-rcgen. The
providers are ported from moq-dev/rind's rind-dimpl 0.1.12 and its
rind-str0m, and the WHIP/WHEP client's reqwest takes rind's rustls
provider. moq-webrtc's graph holds no aws-lc-rs.

Every Rtc moq-webrtc builds first refuses a CPU rind can't run on, so
`Client::new` now returns a Result and both error types gain
`UnsupportedCpu`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title moq-webrtc on rind feat(webrtc)!: run the vendored WebRTC stack on rind Nov 8, 2026
@kixelated
kixelated marked this pull request as ready for review November 8, 2026 02:03
@coderabbitai

coderabbitai Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 10 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1aafe902-62f0-4579-bcdf-1a4b13ad9830
Commits

Reviewing files that changed from the base of the PR and between fe00d62 and d4150b9.

Files ignored due to path filters: 1

  • Cargo.lock is excluded by !**/*.lock
Files selected for processing: 62

  • Cargo.toml
  • doc/bin/rtc.md
  • quest/m1/rind/README.md
  • quest/m1/rind/rtc.md
  • quest/m3/webrtc/README.md
  • quest/m3/webrtc/dead-api.md
  • rs/moq-cli/src/rtc.rs
  • rs/moq-relay/src/auth.rs
  • rs/moq-relay/tests/integration/main.rs
  • rs/moq-tokio/src/tls.rs
  • rs/moq-webrtc/Cargo.toml
  • rs/moq-webrtc/src/client/mod.rs
  • rs/moq-webrtc/src/client/whep.rs
  • rs/moq-webrtc/src/client/whip.rs
  • rs/moq-webrtc/src/error.rs
  • rs/moq-webrtc/src/lib.rs
  • rs/moq-webrtc/src/p2p/mod.rs
  • rs/moq-webrtc/src/server/mux.rs
  • rs/moq-webrtc/src/server/whep.rs
  • rs/moq-webrtc/src/server/whip.rs
  • rs/moq-webrtc/src/session.rs
  • rs/moq-webrtc/src/vendor/dimpl/buffer.rs
  • rs/moq-webrtc/src/vendor/dimpl/certificate.rs
  • rs/moq-webrtc/src/vendor/dimpl/config.rs
  • rs/moq-webrtc/src/vendor/dimpl/crypto/aws_lc_rs/cipher_suite.rs
  • rs/moq-webrtc/src/vendor/dimpl/crypto/aws_lc_rs/hash.rs
  • rs/moq-webrtc/src/vendor/dimpl/crypto/aws_lc_rs/hmac.rs
  • rs/moq-webrtc/src/vendor/dimpl/crypto/aws_lc_rs/kx_group.rs
  • rs/moq-webrtc/src/vendor/dimpl/crypto/aws_lc_rs/mod.rs
  • rs/moq-webrtc/src/vendor/dimpl/crypto/aws_lc_rs/random.rs
  • rs/moq-webrtc/src/vendor/dimpl/crypto/aws_lc_rs/sign.rs
  • rs/moq-webrtc/src/vendor/dimpl/crypto/ccm_cipher.rs
  • rs/moq-webrtc/src/vendor/dimpl/crypto/mod.rs
  • rs/moq-webrtc/src/vendor/dimpl/crypto/prf_hkdf.rs
  • rs/moq-webrtc/src/vendor/dimpl/crypto/provider.rs
  • rs/moq-webrtc/src/vendor/dimpl/crypto/rind/digest.rs
  • rs/moq-webrtc/src/vendor/dimpl/crypto/rind/kx.rs
  • rs/moq-webrtc/src/vendor/dimpl/crypto/rind/mod.rs
  • rs/moq-webrtc/src/vendor/dimpl/crypto/rind/sign.rs
  • rs/moq-webrtc/src/vendor/dimpl/crypto/rind/suite.rs
  • rs/moq-webrtc/src/vendor/dimpl/crypto/validation/mod.rs
  • rs/moq-webrtc/src/vendor/dimpl/error.rs
  • rs/moq-webrtc/src/vendor/dimpl/tests/dtls12/handshake.rs
  • rs/moq-webrtc/src/vendor/is/hmac_provider.rs
  • rs/moq-webrtc/src/vendor/is/stun.rs
  • rs/moq-webrtc/src/vendor/mod.rs
  • rs/moq-webrtc/src/vendor/str0m/crypto/mod.rs
  • rs/moq-webrtc/src/vendor/str0m/lib.rs
  • rs/moq-webrtc/src/vendor/str0m/rtp/srtp.rs
  • rs/moq-webrtc/src/vendor/str0m/tests/common.rs
  • rs/moq-webrtc/src/vendor/str0m/tests/dtls-fingerprint.rs
  • rs/moq-webrtc/src/vendor/str0m/tests/handshake-direct.rs
  • rs/moq-webrtc/src/vendor/str0m_aws_lc_rs/dtls.rs
  • rs/moq-webrtc/src/vendor/str0m_aws_lc_rs/lib.rs
  • rs/moq-webrtc/src/vendor/str0m_aws_lc_rs/sha1.rs
  • rs/moq-webrtc/src/vendor/str0m_aws_lc_rs/sha256.rs
  • rs/moq-webrtc/src/vendor/str0m_aws_lc_rs/srtp.rs
  • rs/moq-webrtc/src/vendor/str0m_rind/dtls.rs
  • rs/moq-webrtc/src/vendor/str0m_rind/hash.rs
  • rs/moq-webrtc/src/vendor/str0m_rind/lib.rs
  • rs/moq-webrtc/src/vendor/str0m_rind/srtp.rs
  • rs/workspace-hack/Cargo.toml
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@kixelated kixelated left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review by review (OpenAI)

Reviewed d4150b9. No actionable regressions found in the inspected changes. The DTLS cipher/key adapters, SRTP/SRTCP buffer and authentication handling, certificate generation, and fallible CPU/provider initialization paths appear consistent with their callers.

Verification limits: GitHub-only static review; I did not run builds, tests, crypto vectors, or browser interoperability checks. The implementation's reported test and browser results were not independently reproduced. Direction: no corrective change requested from this review.

@pullfrog pullfrog Bot 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.

✅ No new issues found.

Reviewed changes

  • Vendored crypto providers — vendor/dimpl/crypto/rind/ and vendor/str0m_rind/ replace the aws-lc-rs providers, keeping the same DTLS 1.2 suites, SRTP profiles (AES-CM-HMAC-SHA1-80, AEAD GCM), signature schemes, and key-exchange groups. The SRTP adapter matches upstream rind-str0m at 86567aa semantically, including the 96-bit nonce / 32-bit counter split for AES-CM.
  • CPU guard — Every Rtc moq-webrtc builds now goes through session::rtc_config(), which runs moq_crypto::cpu::check() before str0m falls back to rind's provider; WHIP/WHEP accept/dial and p2p surface Error::UnsupportedCpu. This holds on the epic's Pi 4 and non-AVX2 targets because rind 0.1.12's missing_cpu_feature() requires nothing on x86_64 and only NEON on aarch64.
  • Client and HTTP — Client::new is fallible, installs rind's rustls provider before building reqwest, and rustls-no-provider keeps rustls-platform-verifier as the root store, so https WHIP/WHEP still verifies.
  • Certificates — dimpl's self-signed generator uses rind-rcgen and rind::rand::fill; the 26 fixture certs in moq-tokio/moq-relay/moq-webrtc now set serials explicitly, while production generation already did.
  • Cleanup — aws-lc-rs, der, pkcs8, and sec1 leave the workspace and moq-webrtc, workspace-hack is regenerated, the CTR scratch padding is gone, doc/bin/rtc.md names rind, and quest/m1/rind/rtc.md is deleted with the epic, dead-api, and m3 WebRTC README reconciled.

Verified the rind 0.1.12 API against the calls the port makes, the remaining aws-lc-rs in the workspace (dev-only via jsonwebtoken), and that no production Rtc construction or stale str0m_aws_lc_rs reference remains. The only public API changes are Client::new -> Result and the two UnsupportedCpu variants, both listed under Impact on #[non_exhaustive] enums.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

@kixelated
kixelated added this pull request to the merge queue Nov 8, 2026
Merged via the queue into main with commit be1c32f Nov 8, 2026
14 checks passed
@kixelated
kixelated deleted the quest/m1/rind/rtc branch November 8, 2026 05:28
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.

1 participant