- /* XOR to c->tag */
- grasshopper_plus128(&h, (grasshopper_w128_t *) c->tag, &tmp);
- grasshopper_copy128((grasshopper_w128_t *) c->tag, &h);
- hexdump(stderr, "Tag", c->tag, 16);
+ hexdump(stderr, "Hnext", h.b, 16);
+ hexdump(stderr, "Ciphertext", currentOutputBlock->b, 16);
+ /* Galois multiply Hi * Ai */
+ gf128_mul_uint64(tmp.q, h.q, currentOutputBlock->q);
+
+ /* XOR to c->tag */
+ grasshopper_plus128(&h, (grasshopper_w128_t *) c->tag, &tmp);
+ grasshopper_copy128((grasshopper_w128_t *) c->tag, &h);
+ hexdump(stderr, "Tag", c->tag, 16);
+ } else {
+ grasshopper_w128_t tmpin;
+ grasshopper_copy128(&tmpin, currentInputBlock);
+ grasshopper_copy128(currentOutputBlock, &tmp);
+
+ hexdump(stderr, "Hnext", h.b, 16);
+ hexdump(stderr, "Ciphertext", tmpin.b, 16);
+ /* Galois multiply Hi * Ai */
+ gf128_mul_uint64(tmp.q, h.q, tmpin.q);
+
+ /* XOR to c->tag */
+ grasshopper_plus128(&h, (grasshopper_w128_t *) c->tag, &tmp);
+ grasshopper_copy128((grasshopper_w128_t *) c->tag, &h);
+ hexdump(stderr, "Tag", c->tag, 16);
+ }