F439_CPP_TX-RX_LoRa_Project

Loading...
Searching...
No Matches
Wire v3 TX Processing Pipeline

This page describes the high-level transmit-side processing flow for a Wire v3 frame produced by the RadioLink protocol layer.

The TX path begins with plaintext supplied by the application layer and ends with an authenticated ciphertext frame being handed to the SX1262 radio driver for transmission.

## TX Pipeline Summary

radioApp payload intent
-> RadioLink_Send()
-> TX counter/session initialization
-> RadioLink_BuildWireV3Frame()
-> header encode
-> AES-CTR payload encryption
-> AES-CMAC tag generation
-> SX1262_SendBytes()
-> counter advance + persistence

## TX Pipeline Diagram

## Stage Responsibilities

radioApp payload intent : Supplies application-owned plaintext data for transmission. RadioLink treats this as payload input and does not require the application layer to understand on-air framing details.

RadioLink_Send() : Serves as the transmit orchestration entry point. It validates payload length constraints, selects the runtime node identifier, manages TX counter/session initialization, calls the frame builder, invokes the radio driver, and advances persistent state after a successful send.

TX counter/session initialization : Loads the persisted TX counter when persistence is enabled, increments the session sequence identifier once per boot, and stores the updated session identifier using the epoch-per-boot replay model.

RadioLink_BuildWireV3Frame() : Constructs the complete Wire v3 frame from plaintext input and produces the protected frame bytes consumed by the radio driver.

Header encode : Serializes the fixed 11-byte Wire v3 header in canonical byte order: version, nodeId, sessionSeqId_le, msgCounter_le, and payloadLen. The payload begins immediately after this fixed header region.

radioLinkAesCtrXor() : Encrypts the payload in place using AES-128 CTR mode with a nonce derived from sessionSeqId and msgCounter.

radioLinkAesCmac128() : Computes the authentication tag across header and ciphertext so the receiver can verify integrity and authenticity before decryption.

SX1262_SendBytes() : Hands the final on-air frame to the SX1262 driver for physical transmission.

Counter advance + persistence : Advances the TX counter only after a successful send and stores the next counter value when persistence is enabled.

## Security Invariants

- The application layer never constructs Wire v3 headers directly.
- sessionSeqId is advanced once per boot, not per packet.
- msgCounter advances only after a successful radio transmission.
- Payload encryption occurs before CMAC tag generation.
- The authentication tag covers the header and ciphertext, not plaintext.
- Persisted TX state is updated only after the frame has been sent successfully.