| ... | @@ -18,7 +18,7 @@ pub const Ghash = struct { | ... | @@ -18,7 +18,7 @@ pub const Ghash = struct { |
| 18 | pub const mac_length = 16; | 18 | pub const mac_length = 16; |
| 19 | pub const key_length = 16; | 19 | pub const key_length = 16; |
| 20 | | 20 | |
| 21 | const pc_count = if (builtin.mode != .ReleaseSmall) 16 else 2; | 21 | const pc_count = if (builtin.mode != .ReleaseSmall) 16 else 4; |
| 22 | const agg_2_treshold = 5; | 22 | const agg_2_treshold = 5; |
| 23 | const agg_4_treshold = 22; | 23 | const agg_4_treshold = 22; |
| 24 | const agg_8_treshold = 84; | 24 | const agg_8_treshold = 84; |
| ... | @@ -42,14 +42,11 @@ pub const Ghash = struct { | ... | @@ -42,14 +42,11 @@ pub const Ghash = struct { |
| 42 | | 42 | |
| 43 | var hx: [pc_count]Precomp = undefined; | 43 | var hx: [pc_count]Precomp = undefined; |
| 44 | hx[0] = h; | 44 | hx[0] = h; |
| 45 | if (block_count >= agg_2_treshold) { | 45 | hx[1] = gcmReduce(clsq128(hx[0])); // h^2 |
| 46 | hx[1] = gcmReduce(clsq128(hx[0])); // h^2 | 46 | hx[2] = gcmReduce(clmul128(hx[1], h)); // h^3 |
| 47 | } | 47 | hx[3] = gcmReduce(clsq128(hx[1])); // h^4 = h^2^2 |
| | 48 | |
| 48 | if (builtin.mode != .ReleaseSmall) { | 49 | if (builtin.mode != .ReleaseSmall) { |
| 49 | if (block_count >= agg_4_treshold) { | | |
| 50 | hx[2] = gcmReduce(clmul128(hx[1], h)); // h^3 | | |
| 51 | hx[3] = gcmReduce(clsq128(hx[1])); // h^4 = h^2^2 | | |
| 52 | } | | |
| 53 | if (block_count >= agg_8_treshold) { | 50 | if (block_count >= agg_8_treshold) { |
| 54 | hx[4] = gcmReduce(clmul128(hx[3], h)); // h^5 | 51 | hx[4] = gcmReduce(clmul128(hx[3], h)); // h^5 |
| 55 | hx[5] = gcmReduce(clsq128(hx[2])); // h^6 = h^3^2 | 52 | hx[5] = gcmReduce(clsq128(hx[2])); // h^6 = h^3^2 |