Skip to content

Protocol Overview

finthetechguy edited this page Nov 24, 2026 · 2 revisions

Protocol Overview

Pages in the Protocol section, in reading order:

The StreetPass protocol

The ctrpass library

The Linux backend

What this section covers

StreetPass is the 3DS feature that trades small messages between consoles that pass each other. Each game that uses it keeps a message box. When two consoles meet, they find each other over 802.11, set up an encrypted link, and trade the messages each side has for the games both sides run.

The section has three parts:

  1. The protocol. How consoles find each other, bring up the link, carry data over it, and what the messages look like. This part is independent of ctrpass.
  2. The ctrpass library. How the ctrpass crate implements the protocol. This code is platform-neutral. It talks to the radio only through a small trait and never runs system commands.
  3. The Linux backend. One implementation of that radio trait, for Linux. It lives in the same crate as the radio::linux module, is compiled only on Linux, and nothing else in the crate depends on it. It sets up monitor interfaces with iw and ip and injects frames on a raw packet socket. The desktop app runs it in a helper process started through polkit.

The stack

flowchart TB
    subgraph content["Content"]
        plaza["Mii Plaza body and other game bodies"]
        mii["Mii record, AES-CCM wrapped"]
        container["CEC message container, HMAC-SHA256 signed"]
        envelope["Envelope: containers of one title"]
    end
    subgraph exchange["Exchange"]
        objects["Exchange objects: session open, services, offer, verdict, message list"]
    end
    subgraph transport["Transport"]
        yy["YY segments: SYN, ACK, END, window"]
    end
    subgraph link["Link"]
        ccmp["802.11 data frames, CCMP with the link key"]
        setup["Probe, offer, accept, directed probe, link-up"]
        disc["Broadcast probes with the Nintendo vendor element"]
    end
    subgraph radio["Radio"]
        trait["Radio trait: mac, set_channel, send, recv"]
        backend["Backend, for example Linux monitor mode"]
    end
    plaza --> mii
    plaza --> container
    container --> envelope
    envelope --> objects
    objects --> yy
    yy --> ccmp
    setup --> ccmp
    disc --> setup
    ccmp --> trait
    disc --> trait
    trait --> backend
Loading

From the bottom up:

Layer What it does Page
Radio Sends and receives raw 802.11 frames on a 2.4 GHz channel. Radio Interface
Discovery Consoles send broadcast probe requests with a fixed SSID and a Nintendo vendor element listing a token and the titles they offer. Discovery
Link setup One console offers to host a link. The other accepts, polls with directed probes, and the host announces the link. Both derive a CCMP key from the two tokens and MACs. Link Setup
802.11 and CCMP Unicast data frames between the two MACs, protected with CCMP. 802.11 Frames and CCMP
YY transport A small TCP-like transport. Each object travels in its own connection, with sequence numbers, acknowledgements and a window. YY Transport
Exchange Typed objects traded in turn: session open, capabilities, services, console ID, offer, verdict, message list, then envelopes. Exchange Flow, Exchange Objects
CEC messages Envelopes of signed containers, one envelope per title. CEC Messages
Message boxes How a console keeps messages on disk. CEC Message Boxes
Game content The body of a container. Its format belongs to the game. ctrpass reads and builds bodies through game plugins, such as the built-in Mii Plaza one, whose body holds an encrypted Mii record. Mii Plaza Messages, Mii Records, Plugins

Keys used at each layer are listed on Keys.

Exchange example

sequenceDiagram
    participant A as Console A
    participant B as Console B
    A->>B: Broadcast probe with token and services
    B->>A: Offer: probe response with token and services
    A->>B: Accept: vendor action frame
    A->>B: Directed probes
    B->>A: Link-up: probe response with privacy bit
    Note over A,B: Both sides derive the CCMP link key
    A->>B: Objects 0x41, 0x43, 0x11, 0x21, 0x23, 0x31
    B->>A: Replies 0x42, 0x43, 0x12, 0x22, 0x24, 0x32
    A->>B: Verdict 0x33
    B->>A: Verdict reply 0x34
    A->>B: Message list 0x81
    B->>A: Message list 0x81
    A-->>B: Envelopes
    B-->>A: Envelopes
Loading

Every arrow after the link-up is one YY connection carried in CCMP data frames. The full sequence and the rules each side follows are on Exchange Flow.

Terms

Term Meaning
Title A game or system application, named by a 32-bit CEC title ID such as 00020800 for Mii Plaza.
Token 8 random bytes each side sends during discovery. It feeds the link key.
Service record One title a console offers to exchange, with a mode and argument masks.
Host The side that sends the offer and the link-up. Its MAC is the BSSID of the link.
Lead ctrpass's name for the side that probes, accepts the offer and opens each object.
Wait ctrpass's name for the side that answers a probe, hosts the link and answers each object.
Container One CEC message: header, extension headers, body and HMAC trailer.
Envelope One or more containers of a single title, as sent over the link.
Pass One run of ctrpass waiting for a console and exchanging with it.

Clone this wiki locally