diff options
author | Salman Qazi <sqazi@google.com> | 2012-10-05 17:24:14 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2012-10-15 10:33:20 -0400 |
commit | ba1ee070909fae01248b8117da1706f3cf2bfd1b (patch) | |
tree | 98d982702fdc17a9699387c59583e9a5ecf0b984 /crypto/testmgr.h | |
parent | 7291a932c6e27d9768e374e9d648086636daf61c (diff) |
crypto: vmac - Make VMAC work when blocks aren't aligned
VMAC implementation, as it is, does not work with blocks that
are not multiples of 128-bytes. Furthermore, this is a problem
when using the implementation on scatterlists, even
when the complete plain text is 128-byte multiple, as the pieces
that get passed to vmac_update can be pretty much any size.
I also added test cases for unaligned blocks.
Signed-off-by: Salman Qazi <sqazi@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/testmgr.h')
-rw-r--r-- | crypto/testmgr.h | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/crypto/testmgr.h b/crypto/testmgr.h index 76d7f6cc82f5..f8365e913de9 100644 --- a/crypto/testmgr.h +++ b/crypto/testmgr.h | |||
@@ -1707,7 +1707,7 @@ static struct hash_testvec aes_xcbc128_tv_template[] = { | |||
1707 | } | 1707 | } |
1708 | }; | 1708 | }; |
1709 | 1709 | ||
1710 | #define VMAC_AES_TEST_VECTORS 8 | 1710 | #define VMAC_AES_TEST_VECTORS 11 |
1711 | static char vmac_string1[128] = {'\x01', '\x01', '\x01', '\x01', | 1711 | static char vmac_string1[128] = {'\x01', '\x01', '\x01', '\x01', |
1712 | '\x02', '\x03', '\x02', '\x02', | 1712 | '\x02', '\x03', '\x02', '\x02', |
1713 | '\x02', '\x04', '\x01', '\x07', | 1713 | '\x02', '\x04', '\x01', '\x07', |
@@ -1723,6 +1723,19 @@ static char vmac_string3[128] = {'a', 'b', 'c', 'a', 'b', 'c', | |||
1723 | 'a', 'b', 'c', 'a', 'b', 'c', | 1723 | 'a', 'b', 'c', 'a', 'b', 'c', |
1724 | }; | 1724 | }; |
1725 | 1725 | ||
1726 | static char vmac_string4[17] = {'b', 'c', 'e', 'f', | ||
1727 | 'i', 'j', 'l', 'm', | ||
1728 | 'o', 'p', 'r', 's', | ||
1729 | 't', 'u', 'w', 'x', 'z'}; | ||
1730 | |||
1731 | static char vmac_string5[127] = {'r', 'm', 'b', 't', 'c', | ||
1732 | 'o', 'l', 'k', ']', '%', | ||
1733 | '9', '2', '7', '!', 'A'}; | ||
1734 | |||
1735 | static char vmac_string6[129] = {'p', 't', '*', '7', 'l', | ||
1736 | 'i', '!', '#', 'w', '0', | ||
1737 | 'z', '/', '4', 'A', 'n'}; | ||
1738 | |||
1726 | static struct hash_testvec aes_vmac128_tv_template[] = { | 1739 | static struct hash_testvec aes_vmac128_tv_template[] = { |
1727 | { | 1740 | { |
1728 | .key = "\x00\x01\x02\x03\x04\x05\x06\x07" | 1741 | .key = "\x00\x01\x02\x03\x04\x05\x06\x07" |
@@ -1776,6 +1789,24 @@ static struct hash_testvec aes_vmac128_tv_template[] = { | |||
1776 | .digest = "\x8b\x32\x8f\xe1\xed\x8f\xfa\xd4", | 1789 | .digest = "\x8b\x32\x8f\xe1\xed\x8f\xfa\xd4", |
1777 | .psize = 128, | 1790 | .psize = 128, |
1778 | .ksize = 16, | 1791 | .ksize = 16, |
1792 | }, { | ||
1793 | .key = "a09b5cd!f#07K\x00\x00\x00", | ||
1794 | .plaintext = vmac_string4, | ||
1795 | .digest = "\xab\xa5\x0f\xea\x42\x4e\xa1\x5f", | ||
1796 | .psize = sizeof(vmac_string4), | ||
1797 | .ksize = 16, | ||
1798 | }, { | ||
1799 | .key = "a09b5cd!f#07K\x00\x00\x00", | ||
1800 | .plaintext = vmac_string5, | ||
1801 | .digest = "\x25\x31\x98\xbc\x1d\xe8\x67\x60", | ||
1802 | .psize = sizeof(vmac_string5), | ||
1803 | .ksize = 16, | ||
1804 | }, { | ||
1805 | .key = "a09b5cd!f#07K\x00\x00\x00", | ||
1806 | .plaintext = vmac_string6, | ||
1807 | .digest = "\xc4\xae\x9b\x47\x95\x65\xeb\x41", | ||
1808 | .psize = sizeof(vmac_string6), | ||
1809 | .ksize = 16, | ||
1779 | }, | 1810 | }, |
1780 | }; | 1811 | }; |
1781 | 1812 | ||