* Generate a table for 0-16 * h. Store the results in the table w/ indexes * bit reversed, and the words striped across the values. */
| 59 | * bit reversed, and the words striped across the values. |
| 60 | */ |
| 61 | void |
| 62 | gf128_genmultable(struct gf128 h, struct gf128table *t) |
| 63 | { |
| 64 | struct gf128 tbl[16]; |
| 65 | int i; |
| 66 | |
| 67 | tbl[0] = MAKE_GF128(0, 0); |
| 68 | tbl[1] = h; |
| 69 | |
| 70 | for (i = 2; i < 16; i += 2) { |
| 71 | tbl[i] = gf128_mulalpha(tbl[i / 2]); |
| 72 | tbl[i + 1] = gf128_add(tbl[i], h); |
| 73 | } |
| 74 | |
| 75 | for (i = 0; i < 16; i++) { |
| 76 | t->a[nib_rev[i]] = tbl[i].v[0] >> 32; |
| 77 | t->b[nib_rev[i]] = tbl[i].v[0]; |
| 78 | t->c[nib_rev[i]] = tbl[i].v[1] >> 32; |
| 79 | t->d[nib_rev[i]] = tbl[i].v[1]; |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | /* |
| 84 | * Generate tables containing h, h^2, h^3 and h^4, starting at 0. |
no test coverage detected