Merge pull request #9 from 0xalivecow/dev

fix: add padding to empty ad case
This commit is contained in:
An0nymous 2024-11-03 20:17:29 +01:00 committed by GitHub
commit 766a801071
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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());
}