From 1a323204e3d4bc1325fe9782139f7ad0fde3b5ab Mon Sep 17 00:00:00 2001 From: Matthew LeVan Date: Mon, 8 Jan 2024 18:18:04 -0500 Subject: [PATCH] jets: add comment explaining length matching --- rust/ares/src/jets/lock/aes.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rust/ares/src/jets/lock/aes.rs b/rust/ares/src/jets/lock/aes.rs index f5ffff0..8e67abb 100644 --- a/rust/ares/src/jets/lock/aes.rs +++ b/rust/ares/src/jets/lock/aes.rs @@ -183,6 +183,8 @@ mod util { let (mut iv, iv_bytes) = IndirectAtom::new_raw_mut_bytearray::<16, NockStack>(stack); + // We match on length here and elsewhere where a similar pattern is followed + // to avoid panicking when a zero length is passed to IndirectAtom::new_raw_mut_bytes. match txt_len { 0 => { ac_aes_siv_en::(key, &mut [], siv_data, iv_bytes, &mut [0u8; 0]).unwrap();