From 1dfed264e9436367fb4a375cd541c11d41f9b82b Mon Sep 17 00:00:00 2001 From: 0xalivecow Date: Sun, 3 Nov 2024 20:15:55 +0100 Subject: [PATCH] fix: add padding to empty ad case --- src/utils/ciphers.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/ciphers.rs b/src/utils/ciphers.rs index 7fb6e63..56b4ead 100644 --- a/src/utils/ciphers.rs +++ b/src/utils/ciphers.rs @@ -334,7 +334,7 @@ pub fn ghash( eprintln!("{:?}", (ad.len() % 16) as u8); eprintln!("{:001X?}", ad); - if ad.len() % 16 != 0 { + if ad.len() % 16 != 0 || ad.is_empty() { ad.append(vec![0u8; 16 - (ad.len() % 16)].as_mut()); }