Skip to content

Commit

Permalink
Handle large cache lines as on s390x
Browse files Browse the repository at this point in the history
  • Loading branch information
jedisct1 committed Nov 19, 2024
1 parent 2594399 commit fc2bdb5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/std/crypto/aes/soft.zig
Original file line number Diff line number Diff line change
Expand Up @@ -683,8 +683,8 @@ inline fn sbox_lookup(sbox: *align(64) const [256]u8, idx0: u8, idx1: u8, idx2:
const stride = switch (side_channels_mitigations) {
.none => unreachable,
.basic => sbox.len / 4,
.medium => sbox.len / (sbox.len / cache_line_bytes) * 2,
.full => sbox.len / (sbox.len / cache_line_bytes),
.medium => @min(sbox.len, 2 * sbox.len / @max(1, sbox.len / cache_line_bytes)),
.full => sbox.len / (@max(1, sbox.len / cache_line_bytes)),
};
const of0 = idx0 % stride;
const of1 = idx1 % stride;
Expand Down

0 comments on commit fc2bdb5

Please sign in to comment.