| ... | ... | @@ -19,10 +19,10 @@ pub const Ghash = struct { |
| 19 | 19 | pub const key_length = 16; |
| 20 | 20 | |
| 21 | 21 | const pc_count = if (builtin.mode != .ReleaseSmall) 16 else 2; |
| 22 | | const agg_2_treshold = 5 * block_length; |
| 23 | | const agg_4_treshold = 22 * block_length; |
| 24 | | const agg_8_treshold = 84 * block_length; |
| 25 | | const agg_16_treshold = 328 * block_length; |
| 22 | const agg_2_treshold = 5; |
| 23 | const agg_4_treshold = 22; |
| 24 | const agg_8_treshold = 84; |
| 25 | const agg_16_treshold = 328; |
| 26 | 26 | |
| 27 | 27 | hx: [pc_count]Precomp, |
| 28 | 28 | acc: u128 = 0, |
| ... | ... | @@ -199,7 +199,7 @@ pub const Ghash = struct { |
| 199 | 199 | |
| 200 | 200 | var i: usize = 0; |
| 201 | 201 | |
| 202 | | if (builtin.mode != .ReleaseSmall and msg.len >= agg_16_treshold) { |
| 202 | if (builtin.mode != .ReleaseSmall and msg.len >= agg_16_treshold * block_length) { |
| 203 | 203 | // 16-blocks aggregated reduction |
| 204 | 204 | while (i + 256 <= msg.len) : (i += 256) { |
| 205 | 205 | var u = clmul128(acc ^ mem.readIntBig(u128, msg[i..][0..16]), st.hx[15 - 0]); |
| ... | ... | @@ -209,7 +209,7 @@ pub const Ghash = struct { |
| 209 | 209 | } |
| 210 | 210 | acc = gcmReduce(u); |
| 211 | 211 | } |
| 212 | | } else if (builtin.mode != .ReleaseSmall and msg.len >= agg_8_treshold) { |
| 212 | } else if (builtin.mode != .ReleaseSmall and msg.len >= agg_8_treshold * block_length) { |
| 213 | 213 | // 8-blocks aggregated reduction |
| 214 | 214 | while (i + 128 <= msg.len) : (i += 128) { |
| 215 | 215 | var u = clmul128(acc ^ mem.readIntBig(u128, msg[i..][0..16]), st.hx[7 - 0]); |
| ... | ... | @@ -219,7 +219,7 @@ pub const Ghash = struct { |
| 219 | 219 | } |
| 220 | 220 | acc = gcmReduce(u); |
| 221 | 221 | } |
| 222 | | } else if (builtin.mode != .ReleaseSmall and msg.len >= agg_4_treshold) { |
| 222 | } else if (builtin.mode != .ReleaseSmall and msg.len >= agg_4_treshold * block_length) { |
| 223 | 223 | // 4-blocks aggregated reduction |
| 224 | 224 | while (i + 64 <= msg.len) : (i += 64) { |
| 225 | 225 | var u = clmul128(acc ^ mem.readIntBig(u128, msg[i..][0..16]), st.hx[3 - 0]); |
| ... | ... | @@ -229,7 +229,7 @@ pub const Ghash = struct { |
| 229 | 229 | } |
| 230 | 230 | acc = gcmReduce(u); |
| 231 | 231 | } |
| 232 | | } else if (msg.len >= agg_2_treshold) { |
| 232 | } else if (msg.len >= agg_2_treshold * block_length) { |
| 233 | 233 | // 2-blocks aggregated reduction |
| 234 | 234 | while (i + 32 <= msg.len) : (i += 32) { |
| 235 | 235 | var u = clmul128(acc ^ mem.readIntBig(u128, msg[i..][0..16]), st.hx[1 - 0]); |