Commit df7223c7f2
Changed files (1)
lib
std
crypto
lib/std/crypto/aes_gcm.zig
@@ -35,7 +35,7 @@ fn AesGcm(comptime Aes: anytype) type {
mem.writeIntBig(u32, j[nonce_length..][0..4], 1);
aes.encrypt(&t, &j);
- const block_count = (math.divCeil(usize, ad.len, Ghash.block_length) catch unreachable) + (math.divCeil(usize, c.len, Ghash.block_length) catch unreachable);
+ const block_count = (math.divCeil(usize, ad.len, Ghash.block_length) catch unreachable) + (math.divCeil(usize, c.len, Ghash.block_length) catch unreachable) + 1;
var mac = Ghash.initForBlockCount(&h, block_count);
mac.update(ad);
mac.pad();