chat: pin the classical and hybrid frame floors under padding
Padding and the hybrid header are independent layers: the bucket is inside the ratchet AEAD, the 2312-byte header is outside it. tests/padding.rs now drives the ladder through a real hybrid step and asserts 2601 bytes in the Noise body (2622 on the wire) against the classical 329/350, plus the 35113-byte largest-bucket frame under the 65535 cap. The node-level PQ round-trip is corrected to say what it actually proves: epoch 0 stays classical, so its frame does not widen.
This commit is contained in:
parent
b22abd7b2b
commit
7a3c0055b3
2 changed files with 123 additions and 3 deletions
|
|
@ -3264,14 +3264,17 @@ pub(crate) mod tests {
|
|||
.expect("node kem");
|
||||
}
|
||||
|
||||
// The ML-KEM ciphertext is a handshake prelude, not part of the `rat `
|
||||
// header: the chat frame still fits the 256-byte bucket.
|
||||
// Epoch 0 is always classical, even for a KEM friend: the first `rat `
|
||||
// frame carries the 40-byte header and the PQ prelude lives in the
|
||||
// one-shot handshake. The 2312-byte hybrid header only appears on the
|
||||
// first rotation (`tests/padding.rs` pins that 2601-byte floor).
|
||||
let frame =
|
||||
encode_chat_frame(&peer_store, &peer, &node.identity_pk(), b"pq").expect("encode");
|
||||
assert_eq!(frame[4], crate::ratchet::FRAME_VERSION);
|
||||
assert_eq!(
|
||||
frame.len(),
|
||||
RAT_OVERHEAD + 256,
|
||||
"the hybrid prelude does not widen the ratchet frame"
|
||||
"epoch 0 is classical, so the hybrid prelude does not widen it"
|
||||
);
|
||||
let nk = node_kem_pk(&node);
|
||||
deliver_frame(&node, &peer, &frame, Some(&nk))
|
||||
|
|
|
|||
Loading…
Reference in a new issue