Repository navigation
quest: plan pure-Rust crypto, the C name clash, and the crate split rerun #6659
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
74be2bf
quest: plan pure-Rust crypto, the C name clash, and the crate split r…
kixelated fbec8b9
Merge remote-tracking branch 'origin/main' into plan/pure-crypto-foll…
kixelated 5b7316b
Merge remote-tracking branch 'origin/main' into plan/pure-crypto-foll…
kixelated 43db663
quest: scope the name-clash rename, Swift's modules, and the per-targ…
kixelated 61f90e0
quest: fix the C name clash in the generator
kixelated c7f7130
Merge remote-tracking branch 'origin/main' into plan/pure-crypto-foll…
kixelated 4af4cb0
quest: drop the link to the finished ACME renewal quest
kixelated File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # [S] One C name per moq-ffi item | ||
|
|
||
| ## Goal | ||
|
|
||
| The generated C header gives every moq-ffi item its own name. Today the method | ||
| `MoqAudioEncoder::finish` and the record `MoqAudioEncoderFinish` both map to | ||
| `moq_audio_encoder_finish`. | ||
|
|
||
| ## Plan | ||
|
|
||
| Decided with the maintainer on 2026-10-24: fix the C generator, not moq-ffi. The | ||
| generator derives collision-free names, for example by qualifying a method with | ||
| its type, so no moq-ffi item is renamed. | ||
|
|
||
| The generator lives in [kixelated/rust2](https://github.com/kixelated/rust2)'s | ||
| UniFFI fork (`uniffi/`), so the work lands there. This quest stands in for it | ||
| until moq builds from a fork that ships the fix. | ||
|
|
||
| Public API: the C names of the pairs the generator renames. Wire: none. |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| # [S] Re-run the per-layer crate split decision | ||
|
|
||
| ## Goal | ||
|
|
||
| The maintainer re-decides whether moq-ffi splits into one UniFFI crate per layer, | ||
| so a layer reuses the net noun it wraps (`media.GroupConsumer(group: | ||
| GroupConsumer)`), from a fresh report against rust2's UniFFI fork. | ||
|
|
||
| ## Plan | ||
|
|
||
| [moq-dev/moq#5460](https://github.com/moq-dev/moq/pull/5460) rejected the split | ||
| on 2026-10-13 because UniFFI keyed types by bare name, so no generator could | ||
| take the same noun from two crates. | ||
| [kixelated/rust2#21](https://github.com/kixelated/rust2/pull/21) fixes that in | ||
| every generator of rust2's fork, reusing #5460's two-crate harness. Swift takes | ||
| same-named types only with one module per crate, while moq's Swift package builds | ||
| one module today, so the report covers that packaging change. What #5460 | ||
| measured still stands until re-measured: each extra crate adds about 48 KB of | ||
| scaffolding to the cdylib. | ||
|
|
||
| Public API: none here; a split would rename every binding's namespaces. | ||
| Wire: none. | ||
|
|
||
| ## Related | ||
|
|
||
| - [Switch to rust2's UniFFI](/quest/m2/uniffi-fork.md) - the fork the split would build on |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # Pure-Rust crypto for moq-relay | ||
|
|
||
| ## Goal | ||
|
|
||
| moq-relay's release builds compile no C: its crypto moves off aws-lc-rs onto | ||
| graviola and RustCrypto, with no hand-rolled primitive, and aws-lc-rs stays | ||
| where graviola does not run. | ||
|
|
||
| ## Plan | ||
|
|
||
| Decided with the maintainer on 2026-10-24: adopt all seven recommendations of | ||
| the spike in [kixelated/rust2#13](https://github.com/kixelated/rust2/pull/13), | ||
| which has the numbers, prototyped on moq's | ||
| [`spike/pure-crypto`](https://github.com/moq-dev/moq/tree/spike/pure-crypto) | ||
| branch. In short: a clean `cargo check` of moq-relay retires 24% fewer | ||
| instructions and a build 14% fewer, since aws-lc-sys's build script leaves the | ||
| critical path; handshakes are about a third faster; AES-GCM packets and relay | ||
| throughput are even; ChaCha20-Poly1305 packets are 1.7-3x slower. | ||
|
|
||
| Split into three quests, so the relay can move while the upstream change waits. | ||
| rust2's [no-C check](https://github.com/kixelated/rust2/blob/main/quest/m3/bench-no-c.md) | ||
| keeps C from creeping back into the build it benchmarks. | ||
|
|
||
| ## Required | ||
|
|
||
| - [JWT on graviola](/quest/m2/pure-crypto/jwt-graviola.md) - moq-auth signs and verifies tokens through a graviola-based jsonwebtoken provider, with no `rsa` crate | ||
| - [moq-relay on graviola](/quest/m2/pure-crypto/relay-graviola.md) - moq-relay's x86_64 and aarch64 release builds use graviola as their rustls provider and compile no C | ||
| - [Provider-neutral rustls-acme](/quest/m2/pure-crypto/acme-upstream.md) - rustls-acme takes any rustls crypto provider upstream, and moq drops its patched copy |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # [S] Provider-neutral rustls-acme upstream | ||
|
|
||
| ## Goal | ||
|
|
||
| rustls-acme takes its crypto from any rustls `CryptoProvider` instead of | ||
| hard-requiring ring or aws-lc-rs, in a release moq can depend on, and moq drops | ||
| its patched copy. Check: rustls-acme's latest release builds with neither its | ||
| `ring` nor its `aws-lc-rs` feature. | ||
|
|
||
| ## Plan | ||
|
|
||
| Decided with the maintainer on 2026-10-24, from | ||
| [kixelated/rust2#13](https://github.com/kixelated/rust2/pull/13)'s decision 1: | ||
| upstream a provider-neutral crypto hook, as rustls-acme's own TODO asks, and | ||
| carry the spike's patched copy (crypto on graviola and P-256) only until it | ||
| lands. instant-acme hard-requires ring or aws-lc-rs too. | ||
|
|
||
| Posting upstream is outside the kixelated and moq-dev organizations, so it needs | ||
| the maintainer's approval when this starts. | ||
|
|
||
| Public API: none. Wire: none. | ||
|
|
||
| ## Related | ||
|
|
||
| - [moq-relay on graviola](/quest/m2/pure-crypto/relay-graviola.md) - carries the patched copy until this lands |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| # [M] JWT on graviola | ||
|
|
||
| ## Goal | ||
|
|
||
| moq-auth signs and verifies JWTs through a jsonwebtoken `CryptoProvider` built | ||
| on graviola, so moq-relay's graph holds neither the `rsa` crate nor the second | ||
| RustCrypto generation that jsonwebtoken's `rust_crypto` backend pins, and every | ||
| algorithm moq-auth accepts today still verifies. | ||
|
|
||
| ## Plan | ||
|
|
||
| Decided with the maintainer on 2026-10-24, from | ||
| [kixelated/rust2#13](https://github.com/kixelated/rust2/pull/13)'s decision 3: | ||
| the spike's `rust_crypto` backend signs RS* and PS* with the `rsa` crate, which | ||
| is exposed to the Marvin timing attack (RUSTSEC-2023-0071; `deny.toml`'s ignore | ||
| of it relies on aws-lc-rs), and adds p256/p384 0.13, ecdsa 0.16, crypto-bigint | ||
| 0.5, and ed25519-dalek 2 to the graph. graviola has constant-time RSA, ECDSA, | ||
| Ed25519, and HMAC. | ||
|
|
||
| Never hand-roll a primitive; the provider only adapts graviola to jsonwebtoken's | ||
| traits. | ||
|
|
||
| Public API: none expected; say so if moq-auth's key types change. Wire: none. | ||
|
|
||
| ## Related | ||
|
|
||
| - [moq-relay on graviola](/quest/m2/pure-crypto/relay-graviola.md) - the rest of the relay's crypto |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # [L] moq-relay on graviola | ||
|
|
||
| ## Goal | ||
|
|
||
| moq-relay's release targets on x86_64 and aarch64 use graviola as their rustls | ||
| provider, and their graph compiles no C: no aws-lc-sys, ring, `cc`, or `cmake`, | ||
| checked with `cargo tree -i` for each release target triple. Every other target, and every other crate that uses | ||
| aws-lc-rs today, keeps it. | ||
|
|
||
| ## Plan | ||
|
|
||
| Decided with the maintainer on 2026-10-24: adopt | ||
| [kixelated/rust2#13](https://github.com/kixelated/rust2/pull/13)'s | ||
| recommendations, starting from moq's | ||
| [`spike/pure-crypto`](https://github.com/moq-dev/moq/tree/spike/pure-crypto) | ||
| branch: | ||
|
|
||
| - graviola only supports x86_64 and aarch64, so it is the provider for | ||
| moq-relay's release targets there; aws-lc-rs stays the default elsewhere. | ||
| - moq-tokio refuses `aws-lc-rs` and `graviola` enabled at once. With both on, | ||
| aws-lc-rs won silently, which hid a graviola-only bug in the spike and would | ||
| make a workspace build benchmark aws-lc. CI builds and tests moq-relay alone, | ||
| so feature unification cannot pick the provider. | ||
| - Keep moq-quic's QUIC adapter for graviola (graviola seals packets, RustCrypto | ||
| computes header-protection masks) until rustls-graviola ships QUIC keys | ||
| ([ctz/graviola#156](https://github.com/ctz/graviola/pull/156)), then delete it. | ||
| - rustls-acme refuses to build without ring or aws-lc-rs, so moq carries the | ||
| spike's patched copy until [the upstream hook](/quest/m2/pure-crypto/acme-upstream.md) | ||
| lands. | ||
| - Accept ChaCha20-Poly1305 on graviola being 1.7-3x slower than aws-lc per | ||
| packet, and record it. It only matters for peers that prefer ChaCha20, which | ||
| lack AES hardware. | ||
|
|
||
| Public API: moq-tokio's and moq-quic's crypto features; moq-relay's TLS provider | ||
| on its release targets. Wire: none. | ||
|
|
||
| ## Required | ||
|
|
||
| - [JWT on graviola](/quest/m2/pure-crypto/jwt-graviola.md) - moq-relay never ships the `rust_crypto` backend's `rsa` in between | ||
|
|
||
| ## Related | ||
|
|
||
| - [moq-quic's crypto is rustls](/quest/m1/quic-api/crypto.md) - reshapes the crypto surface the QUIC adapter plugs into | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.