|
SH2SC-EDT
Self-Healing Hardware and Software Complex for Encrypted Data Transmission
|
Authenticated data packet (FLAG_DAT) and session-close packet (FLAG_FIN). More...
#include <protocol.h>
Data Fields | |
| uint8_t | flags |
| Frame type — FLAG_DAT (0x02) for data; FLAG_FIN (0x04) for teardown. Part of plaintext AAD. | |
| uint16_t | seq_num |
| 16-bit packet sequence number (little-endian). Part of plaintext AAD. | |
| uint16_t | payload [2] |
| ChaCha20-encrypted payload: [0] = note_index, [1] = duration_ms. | |
| uint8_t | mac [TRUNCATED_MAC_SIZE] |
| First 8 bytes of the Poly1305 authentication tag. | |
Authenticated data packet (FLAG_DAT) and session-close packet (FLAG_FIN).
Carries one encrypted note authenticated with a truncated Poly1305 MAC. The seq_num field resides in the plaintext AAD so both nodes can independently derive the per-packet nonce without decrypting the payload:
Wire layout (15 bytes, preceded by 2-byte sync preamble = 17 bytes total):
flags or seq_num causes MAC verification to fail and the packet is discarded with a NACK response.Carries one encrypted note authenticated with a truncated Poly1305 MAC. The seq_num field resides in the plaintext AAD so both nodes can independently derive the per-packet nonce without decrypting the payload:
Wire layout (15 bytes, preceded by 2-byte sync preamble = 17 bytes total):
flags or seq_num causes MAC verification to fail and the packet is discarded with a NACK response. Definition at line 122 of file protocol.h.
| uint8_t DataPacket::flags |
Frame type — FLAG_DAT (0x02) for data; FLAG_FIN (0x04) for teardown. Part of plaintext AAD.
Definition at line 123 of file protocol.h.
Referenced by authenticateAndPlay(), sendFinPacket(), and sendPacket().
| uint8_t DataPacket::mac |
First 8 bytes of the Poly1305 authentication tag.
Definition at line 126 of file protocol.h.
Referenced by authenticateAndPlay(), processFinPacket(), sendFinPacket(), and sendPacket().
| uint16_t DataPacket::payload |
ChaCha20-encrypted payload: [0] = note_index, [1] = duration_ms.
Definition at line 125 of file protocol.h.
Referenced by authenticateAndPlay(), processFinPacket(), sendFinPacket(), and sendPacket().
| uint16_t DataPacket::seq_num |
16-bit packet sequence number (little-endian). Part of plaintext AAD.
Definition at line 124 of file protocol.h.
Referenced by authenticateAndPlay(), processFinPacket(), sendFinPacket(), and sendPacket().