pub fn aes_ctr_apply(
sek: &[u8],
salt: &[u8; 16],
pkt_seq_no: u32,
data: &mut [u8],
) -> Result<()>Available on crate feature
crypto only.Expand description
AES-CTR encrypt/decrypt one data packet’s payload in place
(draft-sharabayko-srt-01 §6.2.2/§6.3.2). CTR mode is its own inverse —
EncryptedPayload = AES_CTR_Encrypt(SEK, IV, UnencryptedPayload) and
DecryptedPayload = AES_CTR_Encrypt(SEK, IV, EncryptedPayload) are the
same operation (XOR with the same keystream), so this one function serves
both directions.
sek selects AES-128/192/256 by its length (16/24/32 bytes); salt and
pkt_seq_no feed packet_counter. No padding is applied or expected —
CTR is a stream cipher (§6.1.1).
§Errors
Error::InvalidField if sek.len() is not 16, 24, or 32.