Skip to content

Commit

Permalink
Add a block to the domain separator for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
jedisct1 committed Dec 7, 2024
1 parent 1774bf9 commit bc12b21
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/aegis128x2/aegis128x2_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ aegis128x2_mac_nr(uint8_t *mac, size_t maclen, uint64_t adlen, aes_block_t *stat
aegis128x2_absorb(r, state);
}
tmp = AES_BLOCK_LOAD_64x2(d, maclen);
tmp = AES_BLOCK_XOR(tmp, state[2]);
for (i = 0; i < 7; i++) {
aegis128x2_update(state, tmp, tmp);
}
Expand All @@ -228,6 +229,7 @@ aegis128x2_mac_nr(uint8_t *mac, size_t maclen, uint64_t adlen, aes_block_t *stat
aegis128x2_absorb(r, state);
}
tmp = AES_BLOCK_LOAD_64x2(d, maclen);
tmp = AES_BLOCK_XOR(tmp, state[2]);
for (i = 0; i < 7; i++) {
aegis128x2_update(state, tmp, tmp);
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -790,8 +790,8 @@ test "aegis128x2 - MAC test vector" {
try testing.expectEqual(ret, 0);
ret = aegis.aegis128x2_mac_final(&st, &mac256, mac256.len);
try testing.expectEqual(ret, 0);
const expected128_hex = "30ff53a9e8fe94705b753598b4899ded";
const expected256_hex = "cfcd370c2f182244b512ec5c7e71f54e2b56ae9e8462e845ec02d4f65bc346c0";
const expected128_hex = "f472304012396667f51ab7450d87f460";
const expected256_hex = "f376288f13b51c73ecb814922919a31f2cbe1fd322a0062ef7860327a2bc3159";
var expected128: [16]u8 = undefined;
var expected256: [32]u8 = undefined;
_ = try std.fmt.hexToBytes(&expected128, expected128_hex);
Expand Down

0 comments on commit bc12b21

Please sign in to comment.