1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
//! Golden wire vectors — wire version 1. **Data only.**
//!
//! `SPEC.md` Appendix B freezes these **"for the first time at wire version
//! 1, then held byte-identical"**. There is no external source of truth for
//! slither's wire: whatever this file says the wire *is*, it is. That makes
//! the provenance of every byte below the only thing standing between a
//! misreading and a permanently wrong protocol.
//!
//! # Provenance — read this before changing a byte
//!
//! Every value here comes from a reading that **never saw
//! `src/packet/`**. Nothing in this file was snapshot from the
//! implementation it validates; a vector taken from the code it checks
//! proves only that the code equals itself.
//!
//! | Group | Source |
//! |---|---|
//! | Offsets, lengths, both constant bytes per header, all LE integer encodings | `.slices/01-packets/DERIVATION.md`, derived from `SPEC.md` text alone |
//! | `PROLOGUE`, `MAC1_LABEL` | the same derivation, byte-expanded from the spec's ASCII literals |
//! | `canonical_static::BYTES` | the **P-256 base point** in SEC1 uncompressed form, from SEC 2 / FIPS 186-4 — a published standard any reader can check |
//! | `mac1_init::TAG`, `mac1_resp::TAG` | computed with **Python `hashlib.blake2b`**, an implementation sharing no code with `cryptoxide` |
//! | `sizes::*` | independent literals, deliberately not re-exports of [`crate::constants`] — a vector that reads the constant it checks is vacuous |
//!
//! The little-endian header values reuse the derivation's own worked
//! examples (`0x0A0B0C0D → 0D 0C 0B 0A`, `counter = 0x0102030405060708 →
//! 08 07 06 05 04 03 02 01`) rather than fresh inventions, so a reader can
//! match this file against that document line for line.
//!
//! # Two traps these vectors are shaped to catch
//!
//! `VERSION` and `PKT_HANDSHAKE_INIT` are **both `0x01`**, so a
//! HandshakeInit opens `01 01` and a `type`/`version` transposition is
//! invisible in any Init-only vector. HandshakeResp (`02 01`) and Data
//! (`03 01`) are therefore pinned too, and [`resp_header`] uses **two
//! distinct asymmetric indices** so a `sender`/`receiver` swap cannot hide.
//! No value is palindromic where byte order is the thing under test.
//!
//! # The rule this file carries, so a contributor meets it before the diff
//!
//! **Nobody edits these vectors to make a test pass.** A disagreement
//! between a vector and the implementation is triaged into exactly one of
//! three buckets, written down before anything changes:
//!
//! * the implementation is wrong ⇒ fix the implementation;
//! * the derivation is wrong ⇒ the derivation is corrected, citing the
//! spec line, and states what it misread;
//! * the spec is ambiguous ⇒ **stop, and ask for a ruling.**
//!
//! `CLAUDE.md` states the standing version: *"any change that moves a wire
//! byte turns a test red. That is by design — treat such a red as 'this
//! needs a ruling', not 'update the expectation.'"*
/// §5.1's `PROLOGUE = b"slither\x01"`, byte-expanded.
///
/// Never appears in a datagram: it binds the wire version into the Noise
/// transcript, so a version mismatch fails the handshake *cryptographically*
/// rather than being dropped. Pinned here because Appendix B names it.
pub
/// §4.1's `MAC1_LABEL = b"slither mac1"`, byte-expanded.
pub
/// §2.4's canonical static encoding — the 65-byte uncompressed SEC1 form.
///
/// This is the **P-256 base point** `G` (`0x04 ‖ X ‖ Y`), taken from SEC 2 /
/// FIPS 186-4. It is used because it is a *published* 65-byte point: any
/// reader can verify these bytes against a standard without trusting
/// slither, this file, or the agent that wrote it.
///
/// mac1 keys on the **octets** and never parses them (§4.1 hashes the
/// encoding), so validity as a curve point is not required here — it is
/// chosen anyway, so the vector stays usable when a later slice needs a
/// real static.
pub
/// §3.2's `InitHeader` — `type(1) ‖ version(1) ‖ sender_index(4 LE)`.
pub
/// §3.3's `RespHeader` — `type ‖ version ‖ sender_index(4 LE) ‖
/// receiver_index(4 LE)`.
///
/// The two indices are **deliberately different and asymmetric**: equal or
/// palindromic values would let a field swap pass.
pub
/// §3.4's `DataHeader` — `type ‖ version ‖ receiver_index(4 LE) ‖
/// counter(8 LE)`.
///
/// These 14 bytes are also the AEAD associated data, verbatim.
pub
/// §5.2's msg1 payload — `ts_secs(8, BE) ‖ ts_nanos(4, BE)`.
///
/// **Big-endian, and that is not an oversight** — it is ruling 64's third
/// stated exclusion. §5.3's timestamp test is a strictly-greater
/// *ordering*, and a big-endian `ts_secs` orders correctly when compared as
/// an octet string. This is the crate's only big-endian integer pair
/// outside `varint.rs`, which is why it has its own module and its own
/// vector.
pub
/// mac1 over a HandshakeInit: preimage `[0, 180)`, tag at `[180, 196)`.
///
/// The extent is `INIT_PACKET_LEN − MAC1_LEN`, which is a *constant* only
/// because ruling 65 made the handshake length exact. Under the superseded
/// "fixed minimum" reading the tag's position moved with the received
/// length and this vector could not have been written at all.
pub
/// mac1 over a HandshakeResp: preimage `[0, 91)`, tag at `[91, 107)`.
///
/// Keyed on the **initiator's** static on this side — the recipient's, per
/// §4.1. This vector reuses [`super::canonical_static`] as that recipient,
/// so it pins the extent and the construction, not the direction.
pub
/// §2.3 / §3.5's sizes, as **independent literals**.
///
/// Deliberately not re-exports of [`crate::constants`]: a vector that reads
/// the constant it is checking asserts nothing. These are transcribed from
/// the derivation, and the test that compares them to `constants::*` is
/// what makes the two readings meet.
pub