| ... | ... | @@ -470,8 +470,8 @@ fn AegisMac(comptime T: type) type { |
| 470 | 470 | self.state.absorb(b[i..][0..block_length]); |
| 471 | 471 | } |
| 472 | 472 | if (i != b.len) { |
| 473 | | @memcpy(self.buf[0..], b[i..]); |
| 474 | 473 | self.off = b.len - i; |
| 474 | @memcpy(self.buf[0..self.off], b[i..]); |
| 475 | 475 | } |
| 476 | 476 | } |
| 477 | 477 | |
| ... | ... | @@ -653,4 +653,10 @@ test "Aegis MAC" { |
| 653 | 653 | const nonce = [_]u8{0x00} ** Aegis128L_256.nonce_length; |
| 654 | 654 | Aegis128L_256.encrypt(&empty, &tag, &empty, &msg, nonce, key); |
| 655 | 655 | try htest.assertEqual("f8840849602738d81037cbaa0f584ea95759e2ac60263ce77346bcdc79fe4319", &tag); |
| 656 | |
| 657 | // An update whose size is not a multiple of the block size |
| 658 | st = st_init; |
| 659 | st.update(msg[0..33]); |
| 660 | st.final(&tag); |
| 661 | try htest.assertEqual("c7cf649a844c1a6676cf6d91b1658e0aee54a4da330b0a8d3bc7ea4067551d1b", &tag); |
| 656 | 662 | } |