mirror of
https://github.com/ziglang/zig.git
synced 2026-01-20 14:25:16 +00:00
crypto.AesGcm: provision ghash for the final block
This commit is contained in:
parent
4f285d4dac
commit
df7223c7f2
@ -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();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user