(
magic: &[u8; 4],
epoch: &[u8; 4],
)
| 374 | const SEGMENT_ENVELOPE_NONCE_LSN: u64 = 0; |
| 375 | |
| 376 | fn encode_envelope_preamble( |
| 377 | magic: &[u8; 4], |
| 378 | epoch: &[u8; 4], |
| 379 | ) -> [u8; SEGMENT_ENVELOPE_PREAMBLE_SIZE] { |
| 380 | let mut buf = [0u8; SEGMENT_ENVELOPE_PREAMBLE_SIZE]; |
| 381 | buf[0..4].copy_from_slice(magic); |
| 382 | buf[4..6].copy_from_slice(&SEGMENT_ENVELOPE_VERSION.to_le_bytes()); |
| 383 | buf[6] = SEGMENT_ENVELOPE_CIPHER_AES_256_GCM; |
| 384 | buf[7] = 0; // kid = 0 (current KEK) |
| 385 | buf[8..12].copy_from_slice(epoch); |
| 386 | // buf[12..16] = reserved zeros |
| 387 | buf |
| 388 | } |
| 389 | |
| 390 | /// Encrypt `plaintext` into a self-describing segment envelope. |
| 391 | /// |
no outgoing calls
no test coverage detected