diff options
author | Eric Biggers <ebiggers@google.com> | 2019-02-01 02:51:46 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2019-02-08 02:30:09 -0500 |
commit | 4e7babba30d820c4195b1d58cf51dce3c22ecf2b (patch) | |
tree | 06905c2fe390c6f34e8489007ca3a7677c77737e /crypto | |
parent | 25f9dddb928aee83effd18d6d3093f6c0beb65a4 (diff) |
crypto: testmgr - convert skcipher testing to use testvec_configs
Convert alg_test_skcipher() to use the new test framework, adding a list
of testvec_configs to test by default. When the extra self-tests are
enabled, randomly generated testvec_configs are tested as well.
This improves skcipher test coverage mainly because now all algorithms
have a variety of data layouts tested, whereas before each algorithm was
responsible for declaring its own chunked test cases which were often
missing or provided poor test coverage. The new code also tests both
the MAY_SLEEP and !MAY_SLEEP cases, different IV alignments, and buffers
that cross pages.
This has already found a bug in the arm64 ctr-aes-neonbs algorithm.
It would have easily found many past bugs.
I removed the skcipher chunked test vectors that were the same as
non-chunked ones, but left the ones that were unique.
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/testmgr.c | 515 | ||||
-rw-r--r-- | crypto/testmgr.h | 253 |
2 files changed, 245 insertions, 523 deletions
diff --git a/crypto/testmgr.c b/crypto/testmgr.c index ca3fd5f0c094..a275c7c2c371 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c | |||
@@ -284,6 +284,68 @@ struct testvec_config { | |||
284 | 284 | ||
285 | #define TESTVEC_CONFIG_NAMELEN 192 | 285 | #define TESTVEC_CONFIG_NAMELEN 192 |
286 | 286 | ||
287 | /* | ||
288 | * The following are the lists of testvec_configs to test for each algorithm | ||
289 | * type when the basic crypto self-tests are enabled, i.e. when | ||
290 | * CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is unset. They aim to provide good test | ||
291 | * coverage, while keeping the test time much shorter than the full fuzz tests | ||
292 | * so that the basic tests can be enabled in a wider range of circumstances. | ||
293 | */ | ||
294 | |||
295 | /* Configs for skciphers and aeads */ | ||
296 | static const struct testvec_config default_cipher_testvec_configs[] = { | ||
297 | { | ||
298 | .name = "in-place", | ||
299 | .inplace = true, | ||
300 | .src_divs = { { .proportion_of_total = 10000 } }, | ||
301 | }, { | ||
302 | .name = "out-of-place", | ||
303 | .src_divs = { { .proportion_of_total = 10000 } }, | ||
304 | }, { | ||
305 | .name = "unaligned buffer, offset=1", | ||
306 | .src_divs = { { .proportion_of_total = 10000, .offset = 1 } }, | ||
307 | .iv_offset = 1, | ||
308 | }, { | ||
309 | .name = "buffer aligned only to alignmask", | ||
310 | .src_divs = { | ||
311 | { | ||
312 | .proportion_of_total = 10000, | ||
313 | .offset = 1, | ||
314 | .offset_relative_to_alignmask = true, | ||
315 | }, | ||
316 | }, | ||
317 | .iv_offset = 1, | ||
318 | .iv_offset_relative_to_alignmask = true, | ||
319 | }, { | ||
320 | .name = "two even aligned splits", | ||
321 | .src_divs = { | ||
322 | { .proportion_of_total = 5000 }, | ||
323 | { .proportion_of_total = 5000 }, | ||
324 | }, | ||
325 | }, { | ||
326 | .name = "uneven misaligned splits, may sleep", | ||
327 | .req_flags = CRYPTO_TFM_REQ_MAY_SLEEP, | ||
328 | .src_divs = { | ||
329 | { .proportion_of_total = 1900, .offset = 33 }, | ||
330 | { .proportion_of_total = 3300, .offset = 7 }, | ||
331 | { .proportion_of_total = 4800, .offset = 18 }, | ||
332 | }, | ||
333 | .iv_offset = 3, | ||
334 | }, { | ||
335 | .name = "misaligned splits crossing pages, inplace", | ||
336 | .inplace = true, | ||
337 | .src_divs = { | ||
338 | { | ||
339 | .proportion_of_total = 7500, | ||
340 | .offset = PAGE_SIZE - 32 | ||
341 | }, { | ||
342 | .proportion_of_total = 2500, | ||
343 | .offset = PAGE_SIZE - 7 | ||
344 | }, | ||
345 | }, | ||
346 | } | ||
347 | }; | ||
348 | |||
287 | static unsigned int count_test_sg_divisions(const struct test_sg_division *divs) | 349 | static unsigned int count_test_sg_divisions(const struct test_sg_division *divs) |
288 | { | 350 | { |
289 | unsigned int remaining = TEST_SG_TOTAL; | 351 | unsigned int remaining = TEST_SG_TOTAL; |
@@ -1608,8 +1670,6 @@ static int test_cipher(struct crypto_cipher *tfm, int enc, | |||
1608 | 1670 | ||
1609 | j = 0; | 1671 | j = 0; |
1610 | for (i = 0; i < tcount; i++) { | 1672 | for (i = 0; i < tcount; i++) { |
1611 | if (template[i].np) | ||
1612 | continue; | ||
1613 | 1673 | ||
1614 | if (fips_enabled && template[i].fips_skip) | 1674 | if (fips_enabled && template[i].fips_skip) |
1615 | continue; | 1675 | continue; |
@@ -1667,282 +1727,214 @@ out_nobuf: | |||
1667 | return ret; | 1727 | return ret; |
1668 | } | 1728 | } |
1669 | 1729 | ||
1670 | static int __test_skcipher(struct crypto_skcipher *tfm, int enc, | 1730 | static int test_skcipher_vec_cfg(const char *driver, int enc, |
1671 | const struct cipher_testvec *template, | 1731 | const struct cipher_testvec *vec, |
1672 | unsigned int tcount, | 1732 | unsigned int vec_num, |
1673 | const bool diff_dst, const int align_offset) | 1733 | const struct testvec_config *cfg, |
1734 | struct skcipher_request *req, | ||
1735 | struct cipher_test_sglists *tsgls) | ||
1674 | { | 1736 | { |
1675 | const char *algo = | 1737 | struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); |
1676 | crypto_tfm_alg_driver_name(crypto_skcipher_tfm(tfm)); | 1738 | const unsigned int alignmask = crypto_skcipher_alignmask(tfm); |
1677 | unsigned int i, j, k, n, temp; | 1739 | const unsigned int ivsize = crypto_skcipher_ivsize(tfm); |
1678 | char *q; | 1740 | const u32 req_flags = CRYPTO_TFM_REQ_MAY_BACKLOG | cfg->req_flags; |
1679 | struct skcipher_request *req; | 1741 | const char *op = enc ? "encryption" : "decryption"; |
1680 | struct scatterlist sg[8]; | 1742 | DECLARE_CRYPTO_WAIT(wait); |
1681 | struct scatterlist sgout[8]; | 1743 | u8 _iv[3 * (MAX_ALGAPI_ALIGNMASK + 1) + MAX_IVLEN]; |
1682 | const char *e, *d; | 1744 | u8 *iv = PTR_ALIGN(&_iv[0], 2 * (MAX_ALGAPI_ALIGNMASK + 1)) + |
1683 | struct crypto_wait wait; | 1745 | cfg->iv_offset + |
1684 | const char *input, *result; | 1746 | (cfg->iv_offset_relative_to_alignmask ? alignmask : 0); |
1685 | void *data; | 1747 | struct kvec input; |
1686 | char iv[MAX_IVLEN]; | 1748 | int err; |
1687 | char *xbuf[XBUFSIZE]; | ||
1688 | char *xoutbuf[XBUFSIZE]; | ||
1689 | int ret = -ENOMEM; | ||
1690 | unsigned int ivsize = crypto_skcipher_ivsize(tfm); | ||
1691 | |||
1692 | if (testmgr_alloc_buf(xbuf)) | ||
1693 | goto out_nobuf; | ||
1694 | |||
1695 | if (diff_dst && testmgr_alloc_buf(xoutbuf)) | ||
1696 | goto out_nooutbuf; | ||
1697 | |||
1698 | if (diff_dst) | ||
1699 | d = "-ddst"; | ||
1700 | else | ||
1701 | d = ""; | ||
1702 | 1749 | ||
1703 | if (enc == ENCRYPT) | 1750 | /* Set the key */ |
1704 | e = "encryption"; | 1751 | if (vec->wk) |
1752 | crypto_skcipher_set_flags(tfm, CRYPTO_TFM_REQ_FORBID_WEAK_KEYS); | ||
1705 | else | 1753 | else |
1706 | e = "decryption"; | 1754 | crypto_skcipher_clear_flags(tfm, |
1707 | 1755 | CRYPTO_TFM_REQ_FORBID_WEAK_KEYS); | |
1708 | crypto_init_wait(&wait); | 1756 | err = crypto_skcipher_setkey(tfm, vec->key, vec->klen); |
1709 | 1757 | if (err) { | |
1710 | req = skcipher_request_alloc(tfm, GFP_KERNEL); | 1758 | if (vec->fail) /* expectedly failed to set key? */ |
1711 | if (!req) { | 1759 | return 0; |
1712 | pr_err("alg: skcipher%s: Failed to allocate request for %s\n", | 1760 | pr_err("alg: skcipher: %s setkey failed with err %d on test vector %u; flags=%#x\n", |
1713 | d, algo); | 1761 | driver, err, vec_num, crypto_skcipher_get_flags(tfm)); |
1714 | goto out; | 1762 | return err; |
1763 | } | ||
1764 | if (vec->fail) { | ||
1765 | pr_err("alg: skcipher: %s setkey unexpectedly succeeded on test vector %u\n", | ||
1766 | driver, vec_num); | ||
1767 | return -EINVAL; | ||
1715 | } | 1768 | } |
1716 | 1769 | ||
1717 | skcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG, | 1770 | /* The IV must be copied to a buffer, as the algorithm may modify it */ |
1718 | crypto_req_done, &wait); | 1771 | if (ivsize) { |
1719 | 1772 | if (WARN_ON(ivsize > MAX_IVLEN)) | |
1720 | j = 0; | 1773 | return -EINVAL; |
1721 | for (i = 0; i < tcount; i++) { | 1774 | if (vec->iv && !(vec->generates_iv && enc)) |
1722 | if (template[i].np && !template[i].also_non_np) | 1775 | memcpy(iv, vec->iv, ivsize); |
1723 | continue; | ||
1724 | |||
1725 | if (fips_enabled && template[i].fips_skip) | ||
1726 | continue; | ||
1727 | |||
1728 | if (template[i].iv && !(template[i].generates_iv && enc)) | ||
1729 | memcpy(iv, template[i].iv, ivsize); | ||
1730 | else | 1776 | else |
1731 | memset(iv, 0, MAX_IVLEN); | 1777 | memset(iv, 0, ivsize); |
1732 | 1778 | } else { | |
1733 | input = enc ? template[i].ptext : template[i].ctext; | 1779 | if (vec->generates_iv) { |
1734 | result = enc ? template[i].ctext : template[i].ptext; | 1780 | pr_err("alg: skcipher: %s has ivsize=0 but test vector %u generates IV!\n", |
1735 | j++; | 1781 | driver, vec_num); |
1736 | ret = -EINVAL; | 1782 | return -EINVAL; |
1737 | if (WARN_ON(align_offset + template[i].len > PAGE_SIZE)) | ||
1738 | goto out; | ||
1739 | |||
1740 | data = xbuf[0]; | ||
1741 | data += align_offset; | ||
1742 | memcpy(data, input, template[i].len); | ||
1743 | |||
1744 | crypto_skcipher_clear_flags(tfm, ~0); | ||
1745 | if (template[i].wk) | ||
1746 | crypto_skcipher_set_flags(tfm, CRYPTO_TFM_REQ_FORBID_WEAK_KEYS); | ||
1747 | |||
1748 | ret = crypto_skcipher_setkey(tfm, template[i].key, | ||
1749 | template[i].klen); | ||
1750 | if (template[i].fail == !ret) { | ||
1751 | pr_err("alg: skcipher%s: setkey failed on test %d for %s: flags=%x\n", | ||
1752 | d, j, algo, crypto_skcipher_get_flags(tfm)); | ||
1753 | goto out; | ||
1754 | } else if (ret) | ||
1755 | continue; | ||
1756 | |||
1757 | sg_init_one(&sg[0], data, template[i].len); | ||
1758 | if (diff_dst) { | ||
1759 | data = xoutbuf[0]; | ||
1760 | data += align_offset; | ||
1761 | sg_init_one(&sgout[0], data, template[i].len); | ||
1762 | } | ||
1763 | |||
1764 | skcipher_request_set_crypt(req, sg, (diff_dst) ? sgout : sg, | ||
1765 | template[i].len, iv); | ||
1766 | ret = crypto_wait_req(enc ? crypto_skcipher_encrypt(req) : | ||
1767 | crypto_skcipher_decrypt(req), &wait); | ||
1768 | |||
1769 | if (ret) { | ||
1770 | pr_err("alg: skcipher%s: %s failed on test %d for %s: ret=%d\n", | ||
1771 | d, e, j, algo, -ret); | ||
1772 | goto out; | ||
1773 | } | ||
1774 | |||
1775 | q = data; | ||
1776 | if (memcmp(q, result, template[i].len)) { | ||
1777 | pr_err("alg: skcipher%s: Test %d failed (invalid result) on %s for %s\n", | ||
1778 | d, j, e, algo); | ||
1779 | hexdump(q, template[i].len); | ||
1780 | ret = -EINVAL; | ||
1781 | goto out; | ||
1782 | } | ||
1783 | |||
1784 | if (template[i].generates_iv && enc && | ||
1785 | memcmp(iv, template[i].iv, crypto_skcipher_ivsize(tfm))) { | ||
1786 | pr_err("alg: skcipher%s: Test %d failed (invalid output IV) on %s for %s\n", | ||
1787 | d, j, e, algo); | ||
1788 | hexdump(iv, crypto_skcipher_ivsize(tfm)); | ||
1789 | ret = -EINVAL; | ||
1790 | goto out; | ||
1791 | } | 1783 | } |
1784 | iv = NULL; | ||
1792 | } | 1785 | } |
1793 | 1786 | ||
1794 | j = 0; | 1787 | /* Build the src/dst scatterlists */ |
1795 | for (i = 0; i < tcount; i++) { | 1788 | input.iov_base = enc ? (void *)vec->ptext : (void *)vec->ctext; |
1796 | /* alignment tests are only done with continuous buffers */ | 1789 | input.iov_len = vec->len; |
1797 | if (align_offset != 0) | 1790 | err = build_cipher_test_sglists(tsgls, cfg, alignmask, |
1798 | break; | 1791 | vec->len, vec->len, &input, 1); |
1799 | 1792 | if (err) { | |
1800 | if (!template[i].np) | 1793 | pr_err("alg: skcipher: %s %s: error preparing scatterlists for test vector %u, cfg=\"%s\"\n", |
1801 | continue; | 1794 | driver, op, vec_num, cfg->name); |
1802 | 1795 | return err; | |
1803 | if (fips_enabled && template[i].fips_skip) | 1796 | } |
1804 | continue; | ||
1805 | |||
1806 | if (template[i].iv && !(template[i].generates_iv && enc)) | ||
1807 | memcpy(iv, template[i].iv, ivsize); | ||
1808 | else | ||
1809 | memset(iv, 0, MAX_IVLEN); | ||
1810 | |||
1811 | input = enc ? template[i].ptext : template[i].ctext; | ||
1812 | result = enc ? template[i].ctext : template[i].ptext; | ||
1813 | j++; | ||
1814 | crypto_skcipher_clear_flags(tfm, ~0); | ||
1815 | if (template[i].wk) | ||
1816 | crypto_skcipher_set_flags(tfm, CRYPTO_TFM_REQ_FORBID_WEAK_KEYS); | ||
1817 | |||
1818 | ret = crypto_skcipher_setkey(tfm, template[i].key, | ||
1819 | template[i].klen); | ||
1820 | if (template[i].fail == !ret) { | ||
1821 | pr_err("alg: skcipher%s: setkey failed on chunk test %d for %s: flags=%x\n", | ||
1822 | d, j, algo, crypto_skcipher_get_flags(tfm)); | ||
1823 | goto out; | ||
1824 | } else if (ret) | ||
1825 | continue; | ||
1826 | |||
1827 | temp = 0; | ||
1828 | ret = -EINVAL; | ||
1829 | sg_init_table(sg, template[i].np); | ||
1830 | if (diff_dst) | ||
1831 | sg_init_table(sgout, template[i].np); | ||
1832 | for (k = 0; k < template[i].np; k++) { | ||
1833 | if (WARN_ON(offset_in_page(IDX[k]) + | ||
1834 | template[i].tap[k] > PAGE_SIZE)) | ||
1835 | goto out; | ||
1836 | |||
1837 | q = xbuf[IDX[k] >> PAGE_SHIFT] + offset_in_page(IDX[k]); | ||
1838 | |||
1839 | memcpy(q, input + temp, template[i].tap[k]); | ||
1840 | |||
1841 | if (offset_in_page(q) + template[i].tap[k] < PAGE_SIZE) | ||
1842 | q[template[i].tap[k]] = 0; | ||
1843 | |||
1844 | sg_set_buf(&sg[k], q, template[i].tap[k]); | ||
1845 | if (diff_dst) { | ||
1846 | q = xoutbuf[IDX[k] >> PAGE_SHIFT] + | ||
1847 | offset_in_page(IDX[k]); | ||
1848 | |||
1849 | sg_set_buf(&sgout[k], q, template[i].tap[k]); | ||
1850 | 1797 | ||
1851 | memset(q, 0, template[i].tap[k]); | 1798 | /* Do the actual encryption or decryption */ |
1852 | if (offset_in_page(q) + | 1799 | testmgr_poison(req->__ctx, crypto_skcipher_reqsize(tfm)); |
1853 | template[i].tap[k] < PAGE_SIZE) | 1800 | skcipher_request_set_callback(req, req_flags, crypto_req_done, &wait); |
1854 | q[template[i].tap[k]] = 0; | 1801 | skcipher_request_set_crypt(req, tsgls->src.sgl_ptr, tsgls->dst.sgl_ptr, |
1855 | } | 1802 | vec->len, iv); |
1803 | err = crypto_wait_req(enc ? crypto_skcipher_encrypt(req) : | ||
1804 | crypto_skcipher_decrypt(req), &wait); | ||
1805 | if (err) { | ||
1806 | pr_err("alg: skcipher: %s %s failed with err %d on test vector %u, cfg=\"%s\"\n", | ||
1807 | driver, op, err, vec_num, cfg->name); | ||
1808 | return err; | ||
1809 | } | ||
1856 | 1810 | ||
1857 | temp += template[i].tap[k]; | 1811 | /* Check for the correct output (ciphertext or plaintext) */ |
1858 | } | 1812 | err = verify_correct_output(&tsgls->dst, enc ? vec->ctext : vec->ptext, |
1813 | vec->len, 0, true); | ||
1814 | if (err == -EOVERFLOW) { | ||
1815 | pr_err("alg: skcipher: %s %s overran dst buffer on test vector %u, cfg=\"%s\"\n", | ||
1816 | driver, op, vec_num, cfg->name); | ||
1817 | return err; | ||
1818 | } | ||
1819 | if (err) { | ||
1820 | pr_err("alg: skcipher: %s %s test failed (wrong result) on test vector %u, cfg=\"%s\"\n", | ||
1821 | driver, op, vec_num, cfg->name); | ||
1822 | return err; | ||
1823 | } | ||
1859 | 1824 | ||
1860 | skcipher_request_set_crypt(req, sg, (diff_dst) ? sgout : sg, | 1825 | /* If applicable, check that the algorithm generated the correct IV */ |
1861 | template[i].len, iv); | 1826 | if (vec->generates_iv && enc && memcmp(iv, vec->iv, ivsize) != 0) { |
1827 | pr_err("alg: skcipher: %s %s test failed (wrong output IV) on test vector %u, cfg=\"%s\"\n", | ||
1828 | driver, op, vec_num, cfg->name); | ||
1829 | hexdump(iv, ivsize); | ||
1830 | return -EINVAL; | ||
1831 | } | ||
1862 | 1832 | ||
1863 | ret = crypto_wait_req(enc ? crypto_skcipher_encrypt(req) : | 1833 | return 0; |
1864 | crypto_skcipher_decrypt(req), &wait); | 1834 | } |
1865 | 1835 | ||
1866 | if (ret) { | 1836 | static int test_skcipher_vec(const char *driver, int enc, |
1867 | pr_err("alg: skcipher%s: %s failed on chunk test %d for %s: ret=%d\n", | 1837 | const struct cipher_testvec *vec, |
1868 | d, e, j, algo, -ret); | 1838 | unsigned int vec_num, |
1869 | goto out; | 1839 | struct skcipher_request *req, |
1870 | } | 1840 | struct cipher_test_sglists *tsgls) |
1841 | { | ||
1842 | unsigned int i; | ||
1843 | int err; | ||
1871 | 1844 | ||
1872 | temp = 0; | 1845 | if (fips_enabled && vec->fips_skip) |
1873 | ret = -EINVAL; | 1846 | return 0; |
1874 | for (k = 0; k < template[i].np; k++) { | ||
1875 | if (diff_dst) | ||
1876 | q = xoutbuf[IDX[k] >> PAGE_SHIFT] + | ||
1877 | offset_in_page(IDX[k]); | ||
1878 | else | ||
1879 | q = xbuf[IDX[k] >> PAGE_SHIFT] + | ||
1880 | offset_in_page(IDX[k]); | ||
1881 | 1847 | ||
1882 | if (memcmp(q, result + temp, template[i].tap[k])) { | 1848 | for (i = 0; i < ARRAY_SIZE(default_cipher_testvec_configs); i++) { |
1883 | pr_err("alg: skcipher%s: Chunk test %d failed on %s at page %u for %s\n", | 1849 | err = test_skcipher_vec_cfg(driver, enc, vec, vec_num, |
1884 | d, j, e, k, algo); | 1850 | &default_cipher_testvec_configs[i], |
1885 | hexdump(q, template[i].tap[k]); | 1851 | req, tsgls); |
1886 | goto out; | 1852 | if (err) |
1887 | } | 1853 | return err; |
1854 | } | ||
1888 | 1855 | ||
1889 | q += template[i].tap[k]; | 1856 | #ifdef CONFIG_CRYPTO_MANAGER_EXTRA_TESTS |
1890 | for (n = 0; offset_in_page(q + n) && q[n]; n++) | 1857 | if (!noextratests) { |
1891 | ; | 1858 | struct testvec_config cfg; |
1892 | if (n) { | 1859 | char cfgname[TESTVEC_CONFIG_NAMELEN]; |
1893 | pr_err("alg: skcipher%s: Result buffer corruption in chunk test %d on %s at page %u for %s: %u bytes:\n", | 1860 | |
1894 | d, j, e, k, algo, n); | 1861 | for (i = 0; i < fuzz_iterations; i++) { |
1895 | hexdump(q, n); | 1862 | generate_random_testvec_config(&cfg, cfgname, |
1896 | goto out; | 1863 | sizeof(cfgname)); |
1897 | } | 1864 | err = test_skcipher_vec_cfg(driver, enc, vec, vec_num, |
1898 | temp += template[i].tap[k]; | 1865 | &cfg, req, tsgls); |
1866 | if (err) | ||
1867 | return err; | ||
1899 | } | 1868 | } |
1900 | } | 1869 | } |
1870 | #endif | ||
1871 | return 0; | ||
1872 | } | ||
1901 | 1873 | ||
1902 | ret = 0; | 1874 | static int test_skcipher(const char *driver, int enc, |
1875 | const struct cipher_test_suite *suite, | ||
1876 | struct skcipher_request *req, | ||
1877 | struct cipher_test_sglists *tsgls) | ||
1878 | { | ||
1879 | unsigned int i; | ||
1880 | int err; | ||
1903 | 1881 | ||
1904 | out: | 1882 | for (i = 0; i < suite->count; i++) { |
1905 | skcipher_request_free(req); | 1883 | err = test_skcipher_vec(driver, enc, &suite->vecs[i], i, req, |
1906 | if (diff_dst) | 1884 | tsgls); |
1907 | testmgr_free_buf(xoutbuf); | 1885 | if (err) |
1908 | out_nooutbuf: | 1886 | return err; |
1909 | testmgr_free_buf(xbuf); | 1887 | } |
1910 | out_nobuf: | 1888 | return 0; |
1911 | return ret; | ||
1912 | } | 1889 | } |
1913 | 1890 | ||
1914 | static int test_skcipher(struct crypto_skcipher *tfm, int enc, | 1891 | static int alg_test_skcipher(const struct alg_test_desc *desc, |
1915 | const struct cipher_testvec *template, | 1892 | const char *driver, u32 type, u32 mask) |
1916 | unsigned int tcount) | ||
1917 | { | 1893 | { |
1918 | unsigned int alignmask; | 1894 | const struct cipher_test_suite *suite = &desc->suite.cipher; |
1919 | int ret; | 1895 | struct crypto_skcipher *tfm; |
1896 | struct skcipher_request *req = NULL; | ||
1897 | struct cipher_test_sglists *tsgls = NULL; | ||
1898 | int err; | ||
1920 | 1899 | ||
1921 | /* test 'dst == src' case */ | 1900 | if (suite->count <= 0) { |
1922 | ret = __test_skcipher(tfm, enc, template, tcount, false, 0); | 1901 | pr_err("alg: skcipher: empty test suite for %s\n", driver); |
1923 | if (ret) | 1902 | return -EINVAL; |
1924 | return ret; | 1903 | } |
1925 | 1904 | ||
1926 | /* test 'dst != src' case */ | 1905 | tfm = crypto_alloc_skcipher(driver, type, mask); |
1927 | ret = __test_skcipher(tfm, enc, template, tcount, true, 0); | 1906 | if (IS_ERR(tfm)) { |
1928 | if (ret) | 1907 | pr_err("alg: skcipher: failed to allocate transform for %s: %ld\n", |
1929 | return ret; | 1908 | driver, PTR_ERR(tfm)); |
1909 | return PTR_ERR(tfm); | ||
1910 | } | ||
1930 | 1911 | ||
1931 | /* test unaligned buffers, check with one byte offset */ | 1912 | req = skcipher_request_alloc(tfm, GFP_KERNEL); |
1932 | ret = __test_skcipher(tfm, enc, template, tcount, true, 1); | 1913 | if (!req) { |
1933 | if (ret) | 1914 | pr_err("alg: skcipher: failed to allocate request for %s\n", |
1934 | return ret; | 1915 | driver); |
1916 | err = -ENOMEM; | ||
1917 | goto out; | ||
1918 | } | ||
1935 | 1919 | ||
1936 | alignmask = crypto_tfm_alg_alignmask(&tfm->base); | 1920 | tsgls = alloc_cipher_test_sglists(); |
1937 | if (alignmask) { | 1921 | if (!tsgls) { |
1938 | /* Check if alignment mask for tfm is correctly set. */ | 1922 | pr_err("alg: skcipher: failed to allocate test buffers for %s\n", |
1939 | ret = __test_skcipher(tfm, enc, template, tcount, true, | 1923 | driver); |
1940 | alignmask + 1); | 1924 | err = -ENOMEM; |
1941 | if (ret) | 1925 | goto out; |
1942 | return ret; | ||
1943 | } | 1926 | } |
1944 | 1927 | ||
1945 | return 0; | 1928 | err = test_skcipher(driver, ENCRYPT, suite, req, tsgls); |
1929 | if (err) | ||
1930 | goto out; | ||
1931 | |||
1932 | err = test_skcipher(driver, DECRYPT, suite, req, tsgls); | ||
1933 | out: | ||
1934 | free_cipher_test_sglists(tsgls); | ||
1935 | skcipher_request_free(req); | ||
1936 | crypto_free_skcipher(tfm); | ||
1937 | return err; | ||
1946 | } | 1938 | } |
1947 | 1939 | ||
1948 | static int test_comp(struct crypto_comp *tfm, | 1940 | static int test_comp(struct crypto_comp *tfm, |
@@ -2326,28 +2318,6 @@ static int alg_test_cipher(const struct alg_test_desc *desc, | |||
2326 | return err; | 2318 | return err; |
2327 | } | 2319 | } |
2328 | 2320 | ||
2329 | static int alg_test_skcipher(const struct alg_test_desc *desc, | ||
2330 | const char *driver, u32 type, u32 mask) | ||
2331 | { | ||
2332 | const struct cipher_test_suite *suite = &desc->suite.cipher; | ||
2333 | struct crypto_skcipher *tfm; | ||
2334 | int err; | ||
2335 | |||
2336 | tfm = crypto_alloc_skcipher(driver, type, mask); | ||
2337 | if (IS_ERR(tfm)) { | ||
2338 | printk(KERN_ERR "alg: skcipher: Failed to load transform for " | ||
2339 | "%s: %ld\n", driver, PTR_ERR(tfm)); | ||
2340 | return PTR_ERR(tfm); | ||
2341 | } | ||
2342 | |||
2343 | err = test_skcipher(tfm, ENCRYPT, suite->vecs, suite->count); | ||
2344 | if (!err) | ||
2345 | err = test_skcipher(tfm, DECRYPT, suite->vecs, suite->count); | ||
2346 | |||
2347 | crypto_free_skcipher(tfm); | ||
2348 | return err; | ||
2349 | } | ||
2350 | |||
2351 | static int alg_test_comp(const struct alg_test_desc *desc, const char *driver, | 2321 | static int alg_test_comp(const struct alg_test_desc *desc, const char *driver, |
2352 | u32 type, u32 mask) | 2322 | u32 type, u32 mask) |
2353 | { | 2323 | { |
@@ -4224,6 +4194,11 @@ static void alg_check_test_descs_order(void) | |||
4224 | 4194 | ||
4225 | static void alg_check_testvec_configs(void) | 4195 | static void alg_check_testvec_configs(void) |
4226 | { | 4196 | { |
4197 | int i; | ||
4198 | |||
4199 | for (i = 0; i < ARRAY_SIZE(default_cipher_testvec_configs); i++) | ||
4200 | WARN_ON(!valid_testvec_config( | ||
4201 | &default_cipher_testvec_configs[i])); | ||
4227 | } | 4202 | } |
4228 | 4203 | ||
4229 | static void testmgr_onetime_init(void) | 4204 | static void testmgr_onetime_init(void) |
diff --git a/crypto/testmgr.h b/crypto/testmgr.h index d8f6035c7ff2..1a73af8a79f7 100644 --- a/crypto/testmgr.h +++ b/crypto/testmgr.h | |||
@@ -52,10 +52,6 @@ struct hash_testvec { | |||
52 | * @fail: If set to one, the test need to fail | 52 | * @fail: If set to one, the test need to fail |
53 | * @wk: Does the test need CRYPTO_TFM_REQ_FORBID_WEAK_KEYS? | 53 | * @wk: Does the test need CRYPTO_TFM_REQ_FORBID_WEAK_KEYS? |
54 | * ( e.g. test needs to fail due to a weak key ) | 54 | * ( e.g. test needs to fail due to a weak key ) |
55 | * @np: numbers of SG to distribute data in (from 1 to MAX_TAP) | ||
56 | * @tap: How to distribute data in @np SGs | ||
57 | * @also_non_np: if set to 1, the test will be also done without | ||
58 | * splitting data in @np SGs | ||
59 | * @fips_skip: Skip the test vector in FIPS mode | 55 | * @fips_skip: Skip the test vector in FIPS mode |
60 | * @generates_iv: Encryption should ignore the given IV, and output @iv. | 56 | * @generates_iv: Encryption should ignore the given IV, and output @iv. |
61 | * Decryption takes @iv. Needed for AES Keywrap ("kw(aes)"). | 57 | * Decryption takes @iv. Needed for AES Keywrap ("kw(aes)"). |
@@ -65,9 +61,6 @@ struct cipher_testvec { | |||
65 | const char *iv; | 61 | const char *iv; |
66 | const char *ptext; | 62 | const char *ptext; |
67 | const char *ctext; | 63 | const char *ctext; |
68 | unsigned short tap[MAX_TAP]; | ||
69 | int np; | ||
70 | unsigned char also_non_np; | ||
71 | bool fail; | 64 | bool fail; |
72 | unsigned char wk; /* weak key flag */ | 65 | unsigned char wk; /* weak key flag */ |
73 | unsigned char klen; | 66 | unsigned char klen; |
@@ -7011,18 +7004,6 @@ static const struct cipher_testvec des_tv_template[] = { | |||
7011 | .ctext = "\xc9\x57\x44\x25\x6a\x5e\xd3\x1d" | 7004 | .ctext = "\xc9\x57\x44\x25\x6a\x5e\xd3\x1d" |
7012 | "\xf7\x9c\x89\x2a\x33\x8f\x4a\x8b", | 7005 | "\xf7\x9c\x89\x2a\x33\x8f\x4a\x8b", |
7013 | .len = 16, | 7006 | .len = 16, |
7014 | .np = 2, | ||
7015 | .tap = { 8, 8 } | ||
7016 | }, { | ||
7017 | .key = "\x01\x23\x45\x67\x89\xab\xcd\xef", | ||
7018 | .klen = 8, | ||
7019 | .ptext = "\x01\x23\x45\x67\x89\xab\xcd\xe7" | ||
7020 | "\xa3\x99\x7b\xca\xaf\x69\xa0\xf5", | ||
7021 | .ctext = "\xc9\x57\x44\x25\x6a\x5e\xd3\x1d" | ||
7022 | "\x69\x0f\x5b\x0d\x9a\x26\x93\x9b", | ||
7023 | .len = 16, | ||
7024 | .np = 2, | ||
7025 | .tap = { 8, 8 } | ||
7026 | }, { | 7007 | }, { |
7027 | .key = "\x01\x23\x45\x67\x89\xab\xcd\xef", | 7008 | .key = "\x01\x23\x45\x67\x89\xab\xcd\xef", |
7028 | .klen = 8, | 7009 | .klen = 8, |
@@ -7031,8 +7012,6 @@ static const struct cipher_testvec des_tv_template[] = { | |||
7031 | .ctext = "\xc9\x57\x44\x25\x6a\x5e\xd3\x1d" | 7012 | .ctext = "\xc9\x57\x44\x25\x6a\x5e\xd3\x1d" |
7032 | "\x69\x0f\x5b\x0d\x9a\x26\x93\x9b", | 7013 | "\x69\x0f\x5b\x0d\x9a\x26\x93\x9b", |
7033 | .len = 16, | 7014 | .len = 16, |
7034 | .np = 3, | ||
7035 | .tap = { 3, 12, 1 } | ||
7036 | }, { /* Four blocks -- for testing encryption with chunking */ | 7015 | }, { /* Four blocks -- for testing encryption with chunking */ |
7037 | .key = "\x01\x23\x45\x67\x89\xab\xcd\xef", | 7016 | .key = "\x01\x23\x45\x67\x89\xab\xcd\xef", |
7038 | .klen = 8, | 7017 | .klen = 8, |
@@ -7045,38 +7024,6 @@ static const struct cipher_testvec des_tv_template[] = { | |||
7045 | "\xb4\x99\x26\xf7\x1f\xe1\xd4\x90" | 7024 | "\xb4\x99\x26\xf7\x1f\xe1\xd4\x90" |
7046 | "\xf7\x9c\x89\x2a\x33\x8f\x4a\x8b", | 7025 | "\xf7\x9c\x89\x2a\x33\x8f\x4a\x8b", |
7047 | .len = 32, | 7026 | .len = 32, |
7048 | .np = 3, | ||
7049 | .tap = { 14, 10, 8 } | ||
7050 | }, { | ||
7051 | .key = "\x01\x23\x45\x67\x89\xab\xcd\xef", | ||
7052 | .klen = 8, | ||
7053 | .ptext = "\x01\x23\x45\x67\x89\xab\xcd\xe7" | ||
7054 | "\x22\x33\x44\x55\x66\x77\x88\x99" | ||
7055 | "\xca\xfe\xba\xbe\xfe\xed\xbe\xef", | ||
7056 | .ctext = "\xc9\x57\x44\x25\x6a\x5e\xd3\x1d" | ||
7057 | "\xf7\x9c\x89\x2a\x33\x8f\x4a\x8b" | ||
7058 | "\xb4\x99\x26\xf7\x1f\xe1\xd4\x90", | ||
7059 | .len = 24, | ||
7060 | .np = 4, | ||
7061 | .tap = { 2, 1, 3, 18 } | ||
7062 | }, { | ||
7063 | .key = "\x01\x23\x45\x67\x89\xab\xcd\xef", | ||
7064 | .klen = 8, | ||
7065 | .ptext = "\x01\x23\x45\x67\x89\xab\xcd\xe7" | ||
7066 | "\x22\x33\x44\x55\x66\x77\x88\x99", | ||
7067 | .ctext = "\xc9\x57\x44\x25\x6a\x5e\xd3\x1d" | ||
7068 | "\xf7\x9c\x89\x2a\x33\x8f\x4a\x8b", | ||
7069 | .len = 16, | ||
7070 | .np = 5, | ||
7071 | .tap = { 2, 2, 2, 2, 8 } | ||
7072 | }, { | ||
7073 | .key = "\x01\x23\x45\x67\x89\xab\xcd\xef", | ||
7074 | .klen = 8, | ||
7075 | .ptext = "\x01\x23\x45\x67\x89\xab\xcd\xe7", | ||
7076 | .ctext = "\xc9\x57\x44\x25\x6a\x5e\xd3\x1d", | ||
7077 | .len = 8, | ||
7078 | .np = 8, | ||
7079 | .tap = { 1, 1, 1, 1, 1, 1, 1, 1 } | ||
7080 | }, { /* Generated with Crypto++ */ | 7027 | }, { /* Generated with Crypto++ */ |
7081 | .key = "\xC9\x83\xA6\xC9\xEC\x0F\x32\x55", | 7028 | .key = "\xC9\x83\xA6\xC9\xEC\x0F\x32\x55", |
7082 | .klen = 8, | 7029 | .klen = 8, |
@@ -7143,9 +7090,6 @@ static const struct cipher_testvec des_tv_template[] = { | |||
7143 | "\xE1\x58\x39\x09\xB4\x8B\x40\xAC" | 7090 | "\xE1\x58\x39\x09\xB4\x8B\x40\xAC" |
7144 | "\x5F\x62\xC7\x72\xD9\xFC\xCB\x9A", | 7091 | "\x5F\x62\xC7\x72\xD9\xFC\xCB\x9A", |
7145 | .len = 248, | 7092 | .len = 248, |
7146 | .also_non_np = 1, | ||
7147 | .np = 3, | ||
7148 | .tap = { 248 - 10, 2, 8 }, | ||
7149 | }, | 7093 | }, |
7150 | }; | 7094 | }; |
7151 | 7095 | ||
@@ -7182,23 +7126,6 @@ static const struct cipher_testvec des_cbc_tv_template[] = { | |||
7182 | .ptext = "\x66\x6f\x72\x20\x61\x6c\x6c\x20", | 7126 | .ptext = "\x66\x6f\x72\x20\x61\x6c\x6c\x20", |
7183 | .ctext = "\x68\x37\x88\x49\x9a\x7c\x05\xf6", | 7127 | .ctext = "\x68\x37\x88\x49\x9a\x7c\x05\xf6", |
7184 | .len = 8, | 7128 | .len = 8, |
7185 | .np = 2, | ||
7186 | .tap = { 4, 4 }, | ||
7187 | .also_non_np = 1, | ||
7188 | }, { /* Copy of openssl vector for chunk testing */ | ||
7189 | /* From OpenSSL */ | ||
7190 | .key = "\x01\x23\x45\x67\x89\xab\xcd\xef", | ||
7191 | .klen = 8, | ||
7192 | .iv = "\xfe\xdc\xba\x98\x76\x54\x32\x10", | ||
7193 | .ptext = "\x37\x36\x35\x34\x33\x32\x31\x20" | ||
7194 | "\x4e\x6f\x77\x20\x69\x73\x20\x74" | ||
7195 | "\x68\x65\x20\x74\x69\x6d\x65\x20", | ||
7196 | .ctext = "\xcc\xd1\x73\xff\xab\x20\x39\xf4" | ||
7197 | "\xac\xd8\xae\xfd\xdf\xd8\xa1\xeb" | ||
7198 | "\x46\x8e\x91\x15\x78\x88\xba\x68", | ||
7199 | .len = 24, | ||
7200 | .np = 2, | ||
7201 | .tap = { 13, 11 } | ||
7202 | }, { /* Generated with Crypto++ */ | 7129 | }, { /* Generated with Crypto++ */ |
7203 | .key = "\xC9\x83\xA6\xC9\xEC\x0F\x32\x55", | 7130 | .key = "\xC9\x83\xA6\xC9\xEC\x0F\x32\x55", |
7204 | .klen = 8, | 7131 | .klen = 8, |
@@ -7266,9 +7193,6 @@ static const struct cipher_testvec des_cbc_tv_template[] = { | |||
7266 | "\x82\xA9\xBD\x6A\x31\x91\x39\x11" | 7193 | "\x82\xA9\xBD\x6A\x31\x91\x39\x11" |
7267 | "\xC6\x4A\xF3\x55\xC7\x29\x2E\x63", | 7194 | "\xC6\x4A\xF3\x55\xC7\x29\x2E\x63", |
7268 | .len = 248, | 7195 | .len = 248, |
7269 | .also_non_np = 1, | ||
7270 | .np = 3, | ||
7271 | .tap = { 248 - 10, 2, 8 }, | ||
7272 | }, | 7196 | }, |
7273 | }; | 7197 | }; |
7274 | 7198 | ||
@@ -7340,9 +7264,6 @@ static const struct cipher_testvec des_ctr_tv_template[] = { | |||
7340 | "\x19\x7F\x99\x19\x53\xCE\x1D\x14" | 7264 | "\x19\x7F\x99\x19\x53\xCE\x1D\x14" |
7341 | "\x69\x74\xA1\x06\x46\x0F\x4E\x75", | 7265 | "\x69\x74\xA1\x06\x46\x0F\x4E\x75", |
7342 | .len = 248, | 7266 | .len = 248, |
7343 | .also_non_np = 1, | ||
7344 | .np = 3, | ||
7345 | .tap = { 248 - 10, 2, 8 }, | ||
7346 | }, { /* Generated with Crypto++ */ | 7267 | }, { /* Generated with Crypto++ */ |
7347 | .key = "\xC9\x83\xA6\xC9\xEC\x0F\x32\x55", | 7268 | .key = "\xC9\x83\xA6\xC9\xEC\x0F\x32\x55", |
7348 | .klen = 8, | 7269 | .klen = 8, |
@@ -7410,9 +7331,6 @@ static const struct cipher_testvec des_ctr_tv_template[] = { | |||
7410 | "\xA5\xA6\xE7\xB0\x51\x36\x52\x37" | 7331 | "\xA5\xA6\xE7\xB0\x51\x36\x52\x37" |
7411 | "\x91\x45\x05\x3E\x58\xBF\x32", | 7332 | "\x91\x45\x05\x3E\x58\xBF\x32", |
7412 | .len = 247, | 7333 | .len = 247, |
7413 | .also_non_np = 1, | ||
7414 | .np = 2, | ||
7415 | .tap = { 247 - 8, 8 }, | ||
7416 | }, | 7334 | }, |
7417 | }; | 7335 | }; |
7418 | 7336 | ||
@@ -7571,9 +7489,6 @@ static const struct cipher_testvec des3_ede_tv_template[] = { | |||
7571 | "\x93\x03\xD7\x51\x09\xFA\xBE\x68" | 7489 | "\x93\x03\xD7\x51\x09\xFA\xBE\x68" |
7572 | "\xD8\x45\xFF\x33\xBA\xBB\x2B\x63", | 7490 | "\xD8\x45\xFF\x33\xBA\xBB\x2B\x63", |
7573 | .len = 496, | 7491 | .len = 496, |
7574 | .also_non_np = 1, | ||
7575 | .np = 3, | ||
7576 | .tap = { 496 - 20, 4, 16 }, | ||
7577 | }, | 7492 | }, |
7578 | }; | 7493 | }; |
7579 | 7494 | ||
@@ -7749,9 +7664,6 @@ static const struct cipher_testvec des3_ede_cbc_tv_template[] = { | |||
7749 | "\x83\x70\xFF\x86\xE6\xAA\x0F\x1F" | 7664 | "\x83\x70\xFF\x86\xE6\xAA\x0F\x1F" |
7750 | "\x95\x63\x73\xA2\x44\xAC\xF8\xA5", | 7665 | "\x95\x63\x73\xA2\x44\xAC\xF8\xA5", |
7751 | .len = 496, | 7666 | .len = 496, |
7752 | .also_non_np = 1, | ||
7753 | .np = 3, | ||
7754 | .tap = { 496 - 20, 4, 16 }, | ||
7755 | }, | 7667 | }, |
7756 | }; | 7668 | }; |
7757 | 7669 | ||
@@ -7888,9 +7800,6 @@ static const struct cipher_testvec des3_ede_ctr_tv_template[] = { | |||
7888 | "\xFD\x51\xB0\xC6\x2C\x63\x13\x78" | 7800 | "\xFD\x51\xB0\xC6\x2C\x63\x13\x78" |
7889 | "\x5C\xEE\xFC\xCF\xC4\x70\x00\x34", | 7801 | "\x5C\xEE\xFC\xCF\xC4\x70\x00\x34", |
7890 | .len = 496, | 7802 | .len = 496, |
7891 | .also_non_np = 1, | ||
7892 | .np = 3, | ||
7893 | .tap = { 496 - 20, 4, 16 }, | ||
7894 | }, { /* Generated with Crypto++ */ | 7803 | }, { /* Generated with Crypto++ */ |
7895 | .key = "\x9C\xD6\xF3\x9C\xB9\x5A\x67\x00" | 7804 | .key = "\x9C\xD6\xF3\x9C\xB9\x5A\x67\x00" |
7896 | "\x5A\x67\x00\x2D\xCE\xEB\x2D\xCE" | 7805 | "\x5A\x67\x00\x2D\xCE\xEB\x2D\xCE" |
@@ -8025,9 +7934,6 @@ static const struct cipher_testvec des3_ede_ctr_tv_template[] = { | |||
8025 | "\x32\x0F\x05\x2F\xF2\x4C\x95\x3B" | 7934 | "\x32\x0F\x05\x2F\xF2\x4C\x95\x3B" |
8026 | "\xF2\x79\xD9", | 7935 | "\xF2\x79\xD9", |
8027 | .len = 499, | 7936 | .len = 499, |
8028 | .also_non_np = 1, | ||
8029 | .np = 2, | ||
8030 | .tap = { 499 - 16, 16 }, | ||
8031 | }, | 7937 | }, |
8032 | }; | 7938 | }; |
8033 | 7939 | ||
@@ -8213,9 +8119,6 @@ static const struct cipher_testvec bf_tv_template[] = { | |||
8213 | "\x56\xEB\x36\x77\x3D\xAA\xB8\xF5" | 8119 | "\x56\xEB\x36\x77\x3D\xAA\xB8\xF5" |
8214 | "\xC9\x1A\xFB\x5D\xDE\xBB\x43\xF4", | 8120 | "\xC9\x1A\xFB\x5D\xDE\xBB\x43\xF4", |
8215 | .len = 504, | 8121 | .len = 504, |
8216 | .also_non_np = 1, | ||
8217 | .np = 3, | ||
8218 | .tap = { 504 - 10, 2, 8 }, | ||
8219 | }, | 8122 | }, |
8220 | }; | 8123 | }; |
8221 | 8124 | ||
@@ -8368,9 +8271,6 @@ static const struct cipher_testvec bf_cbc_tv_template[] = { | |||
8368 | "\x93\x9B\xEE\xB5\x97\x41\xD2\xA0" | 8271 | "\x93\x9B\xEE\xB5\x97\x41\xD2\xA0" |
8369 | "\xB4\x98\xD8\x6B\x74\xE7\x65\xF4", | 8272 | "\xB4\x98\xD8\x6B\x74\xE7\x65\xF4", |
8370 | .len = 504, | 8273 | .len = 504, |
8371 | .also_non_np = 1, | ||
8372 | .np = 3, | ||
8373 | .tap = { 504 - 10, 2, 8 }, | ||
8374 | }, | 8274 | }, |
8375 | }; | 8275 | }; |
8376 | 8276 | ||
@@ -8643,9 +8543,6 @@ static const struct cipher_testvec bf_ctr_tv_template[] = { | |||
8643 | "\x32\x44\x96\x1C\xD8\xEB\x95\xD2" | 8543 | "\x32\x44\x96\x1C\xD8\xEB\x95\xD2" |
8644 | "\xF3\x71\xEF\xEB\x4E\xBB\x4D", | 8544 | "\xF3\x71\xEF\xEB\x4E\xBB\x4D", |
8645 | .len = 503, | 8545 | .len = 503, |
8646 | .also_non_np = 1, | ||
8647 | .np = 2, | ||
8648 | .tap = { 503 - 8, 8 }, | ||
8649 | }, { /* Generated with Crypto++ */ | 8546 | }, { /* Generated with Crypto++ */ |
8650 | .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" | 8547 | .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" |
8651 | "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" | 8548 | "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" |
@@ -8944,9 +8841,6 @@ static const struct cipher_testvec tf_tv_template[] = { | |||
8944 | "\x58\x33\x9B\x78\xC7\x58\x48\x6B" | 8841 | "\x58\x33\x9B\x78\xC7\x58\x48\x6B" |
8945 | "\x2C\x75\x64\xC4\xCA\xC1\x7E\xD5", | 8842 | "\x2C\x75\x64\xC4\xCA\xC1\x7E\xD5", |
8946 | .len = 496, | 8843 | .len = 496, |
8947 | .also_non_np = 1, | ||
8948 | .np = 3, | ||
8949 | .tap = { 496 - 20, 4, 16 }, | ||
8950 | }, | 8844 | }, |
8951 | }; | 8845 | }; |
8952 | 8846 | ||
@@ -9122,9 +9016,6 @@ static const struct cipher_testvec tf_cbc_tv_template[] = { | |||
9122 | "\x30\x70\x56\xA4\x37\xDD\x7C\xC0" | 9016 | "\x30\x70\x56\xA4\x37\xDD\x7C\xC0" |
9123 | "\x0A\xA3\x30\x10\x26\x25\x41\x2C", | 9017 | "\x0A\xA3\x30\x10\x26\x25\x41\x2C", |
9124 | .len = 496, | 9018 | .len = 496, |
9125 | .also_non_np = 1, | ||
9126 | .np = 3, | ||
9127 | .tap = { 496 - 20, 4, 16 }, | ||
9128 | }, | 9019 | }, |
9129 | }; | 9020 | }; |
9130 | 9021 | ||
@@ -9530,9 +9421,6 @@ static const struct cipher_testvec tf_ctr_tv_template[] = { | |||
9530 | "\xC5\xC9\x7F\x9E\xCF\x33\x7A\xDF" | 9421 | "\xC5\xC9\x7F\x9E\xCF\x33\x7A\xDF" |
9531 | "\x6C\x82\x9D", | 9422 | "\x6C\x82\x9D", |
9532 | .len = 499, | 9423 | .len = 499, |
9533 | .also_non_np = 1, | ||
9534 | .np = 2, | ||
9535 | .tap = { 499 - 16, 16 }, | ||
9536 | }, | 9424 | }, |
9537 | }; | 9425 | }; |
9538 | 9426 | ||
@@ -9774,9 +9662,6 @@ static const struct cipher_testvec tf_lrw_tv_template[] = { | |||
9774 | "\x80\x18\xc4\x6c\x03\xd3\xb7\xba" | 9662 | "\x80\x18\xc4\x6c\x03\xd3\xb7\xba" |
9775 | "\x11\xd7\xb8\x6e\xea\xe1\x80\x30", | 9663 | "\x11\xd7\xb8\x6e\xea\xe1\x80\x30", |
9776 | .len = 512, | 9664 | .len = 512, |
9777 | .also_non_np = 1, | ||
9778 | .np = 3, | ||
9779 | .tap = { 512 - 20, 4, 16 }, | ||
9780 | }, | 9665 | }, |
9781 | }; | 9666 | }; |
9782 | 9667 | ||
@@ -10111,9 +9996,6 @@ static const struct cipher_testvec tf_xts_tv_template[] = { | |||
10111 | "\xa4\x05\x0b\xb2\xb3\xa8\x30\x97" | 9996 | "\xa4\x05\x0b\xb2\xb3\xa8\x30\x97" |
10112 | "\x37\x30\xe1\x91\x8d\xb3\x2a\xff", | 9997 | "\x37\x30\xe1\x91\x8d\xb3\x2a\xff", |
10113 | .len = 512, | 9998 | .len = 512, |
10114 | .also_non_np = 1, | ||
10115 | .np = 3, | ||
10116 | .tap = { 512 - 20, 4, 16 }, | ||
10117 | }, | 9999 | }, |
10118 | }; | 10000 | }; |
10119 | 10001 | ||
@@ -10286,9 +10168,6 @@ static const struct cipher_testvec serpent_tv_template[] = { | |||
10286 | "\x75\x55\x9B\xFF\x36\x73\xAB\x7C" | 10168 | "\x75\x55\x9B\xFF\x36\x73\xAB\x7C" |
10287 | "\xF4\x46\x2E\xEB\xAC\xF3\xD2\xB7", | 10169 | "\xF4\x46\x2E\xEB\xAC\xF3\xD2\xB7", |
10288 | .len = 496, | 10170 | .len = 496, |
10289 | .also_non_np = 1, | ||
10290 | .np = 3, | ||
10291 | .tap = { 496 - 20, 4, 16 }, | ||
10292 | }, | 10171 | }, |
10293 | }; | 10172 | }; |
10294 | 10173 | ||
@@ -10505,9 +10384,6 @@ static const struct cipher_testvec serpent_cbc_tv_template[] = { | |||
10505 | "\xFC\x66\xAA\x37\xF2\x37\x39\x6B" | 10384 | "\xFC\x66\xAA\x37\xF2\x37\x39\x6B" |
10506 | "\xBC\x08\x3A\xA2\x29\xB3\xDF\xD1", | 10385 | "\xBC\x08\x3A\xA2\x29\xB3\xDF\xD1", |
10507 | .len = 496, | 10386 | .len = 496, |
10508 | .also_non_np = 1, | ||
10509 | .np = 3, | ||
10510 | .tap = { 496 - 20, 4, 16 }, | ||
10511 | }, | 10387 | }, |
10512 | }; | 10388 | }; |
10513 | 10389 | ||
@@ -10780,9 +10656,6 @@ static const struct cipher_testvec serpent_ctr_tv_template[] = { | |||
10780 | "\x40\x53\x77\x8C\x15\xF8\x8D\x13" | 10656 | "\x40\x53\x77\x8C\x15\xF8\x8D\x13" |
10781 | "\x38\xE2\xE5", | 10657 | "\x38\xE2\xE5", |
10782 | .len = 499, | 10658 | .len = 499, |
10783 | .also_non_np = 1, | ||
10784 | .np = 2, | ||
10785 | .tap = { 499 - 16, 16 }, | ||
10786 | }, { /* Generated with Crypto++ */ | 10659 | }, { /* Generated with Crypto++ */ |
10787 | .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" | 10660 | .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" |
10788 | "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" | 10661 | "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" |
@@ -11157,9 +11030,6 @@ static const struct cipher_testvec serpent_lrw_tv_template[] = { | |||
11157 | "\x5c\xc6\x84\xfe\x7c\xcb\x26\xfd" | 11030 | "\x5c\xc6\x84\xfe\x7c\xcb\x26\xfd" |
11158 | "\xd9\x51\x0f\xd7\x94\x2f\xc5\xa7", | 11031 | "\xd9\x51\x0f\xd7\x94\x2f\xc5\xa7", |
11159 | .len = 512, | 11032 | .len = 512, |
11160 | .also_non_np = 1, | ||
11161 | .np = 3, | ||
11162 | .tap = { 512 - 20, 4, 16 }, | ||
11163 | }, | 11033 | }, |
11164 | }; | 11034 | }; |
11165 | 11035 | ||
@@ -11494,9 +11364,6 @@ static const struct cipher_testvec serpent_xts_tv_template[] = { | |||
11494 | "\xaf\x43\x0b\xc5\x20\x41\x92\x20" | 11364 | "\xaf\x43\x0b\xc5\x20\x41\x92\x20" |
11495 | "\xd4\xa0\x91\x98\x11\x5f\x4d\xb1", | 11365 | "\xd4\xa0\x91\x98\x11\x5f\x4d\xb1", |
11496 | .len = 512, | 11366 | .len = 512, |
11497 | .also_non_np = 1, | ||
11498 | .np = 3, | ||
11499 | .tap = { 512 - 20, 4, 16 }, | ||
11500 | }, | 11367 | }, |
11501 | }; | 11368 | }; |
11502 | 11369 | ||
@@ -11836,9 +11703,6 @@ static const struct cipher_testvec cast6_tv_template[] = { | |||
11836 | "\x84\x52\x6D\x68\xDE\xC6\x64\xB2" | 11703 | "\x84\x52\x6D\x68\xDE\xC6\x64\xB2" |
11837 | "\x11\x74\x93\x57\xB4\x7E\xC6\x00", | 11704 | "\x11\x74\x93\x57\xB4\x7E\xC6\x00", |
11838 | .len = 496, | 11705 | .len = 496, |
11839 | .also_non_np = 1, | ||
11840 | .np = 3, | ||
11841 | .tap = { 496 - 20, 4, 16 }, | ||
11842 | }, | 11706 | }, |
11843 | }; | 11707 | }; |
11844 | 11708 | ||
@@ -11976,9 +11840,6 @@ static const struct cipher_testvec cast6_cbc_tv_template[] = { | |||
11976 | "\x4D\x59\x7D\xC5\x28\x69\xFA\x92" | 11840 | "\x4D\x59\x7D\xC5\x28\x69\xFA\x92" |
11977 | "\x22\x46\x89\x2D\x0F\x2B\x08\x24", | 11841 | "\x22\x46\x89\x2D\x0F\x2B\x08\x24", |
11978 | .len = 496, | 11842 | .len = 496, |
11979 | .also_non_np = 1, | ||
11980 | .np = 3, | ||
11981 | .tap = { 496 - 20, 4, 16 }, | ||
11982 | }, | 11843 | }, |
11983 | }; | 11844 | }; |
11984 | 11845 | ||
@@ -12131,9 +11992,6 @@ static const struct cipher_testvec cast6_ctr_tv_template[] = { | |||
12131 | "\x0E\x74\x33\x30\x62\xB9\x89\xDF" | 11992 | "\x0E\x74\x33\x30\x62\xB9\x89\xDF" |
12132 | "\xF9\xC5\xDD\x27\xB3\x39\xCB\xCB", | 11993 | "\xF9\xC5\xDD\x27\xB3\x39\xCB\xCB", |
12133 | .len = 496, | 11994 | .len = 496, |
12134 | .also_non_np = 1, | ||
12135 | .np = 3, | ||
12136 | .tap = { 496 - 20, 4, 16 }, | ||
12137 | }, | 11995 | }, |
12138 | }; | 11996 | }; |
12139 | 11997 | ||
@@ -12277,9 +12135,6 @@ static const struct cipher_testvec cast6_lrw_tv_template[] = { | |||
12277 | "\x8D\xD9\xCD\x3B\x22\x67\x18\xC7" | 12135 | "\x8D\xD9\xCD\x3B\x22\x67\x18\xC7" |
12278 | "\xC4\xF5\x99\x61\xBC\xBB\x5B\x46", | 12136 | "\xC4\xF5\x99\x61\xBC\xBB\x5B\x46", |
12279 | .len = 512, | 12137 | .len = 512, |
12280 | .also_non_np = 1, | ||
12281 | .np = 3, | ||
12282 | .tap = { 512 - 20, 4, 16 }, | ||
12283 | }, | 12138 | }, |
12284 | }; | 12139 | }; |
12285 | 12140 | ||
@@ -12425,9 +12280,6 @@ static const struct cipher_testvec cast6_xts_tv_template[] = { | |||
12425 | "\xA1\xAC\xE8\xCF\xC6\x74\xCF\xDC" | 12280 | "\xA1\xAC\xE8\xCF\xC6\x74\xCF\xDC" |
12426 | "\x22\x60\x4E\xE8\xA4\x5D\x85\xB9", | 12281 | "\x22\x60\x4E\xE8\xA4\x5D\x85\xB9", |
12427 | .len = 512, | 12282 | .len = 512, |
12428 | .also_non_np = 1, | ||
12429 | .np = 3, | ||
12430 | .tap = { 512 - 20, 4, 16 }, | ||
12431 | }, | 12283 | }, |
12432 | }; | 12284 | }; |
12433 | 12285 | ||
@@ -12596,9 +12448,6 @@ static const struct cipher_testvec aes_tv_template[] = { | |||
12596 | "\x09\x79\xA0\x43\x5C\x0D\x08\x58" | 12448 | "\x09\x79\xA0\x43\x5C\x0D\x08\x58" |
12597 | "\x17\xBB\xC0\x6B\x62\x3F\x56\xE9", | 12449 | "\x17\xBB\xC0\x6B\x62\x3F\x56\xE9", |
12598 | .len = 496, | 12450 | .len = 496, |
12599 | .also_non_np = 1, | ||
12600 | .np = 3, | ||
12601 | .tap = { 496 - 20, 4, 16 }, | ||
12602 | }, | 12451 | }, |
12603 | }; | 12452 | }; |
12604 | 12453 | ||
@@ -12613,9 +12462,6 @@ static const struct cipher_testvec aes_cbc_tv_template[] = { | |||
12613 | .ctext = "\xe3\x53\x77\x9c\x10\x79\xae\xb8" | 12462 | .ctext = "\xe3\x53\x77\x9c\x10\x79\xae\xb8" |
12614 | "\x27\x08\x94\x2d\xbe\x77\x18\x1a", | 12463 | "\x27\x08\x94\x2d\xbe\x77\x18\x1a", |
12615 | .len = 16, | 12464 | .len = 16, |
12616 | .also_non_np = 1, | ||
12617 | .np = 8, | ||
12618 | .tap = { 3, 2, 3, 2, 3, 1, 1, 1 }, | ||
12619 | }, { | 12465 | }, { |
12620 | .key = "\xc2\x86\x69\x6d\x88\x7c\x9a\xa0" | 12466 | .key = "\xc2\x86\x69\x6d\x88\x7c\x9a\xa0" |
12621 | "\x61\x1b\xbb\x3e\x20\x25\xa4\x5a", | 12467 | "\x61\x1b\xbb\x3e\x20\x25\xa4\x5a", |
@@ -12813,9 +12659,6 @@ static const struct cipher_testvec aes_cbc_tv_template[] = { | |||
12813 | "\xE0\x1F\x91\xF8\x82\x96\x2D\x65" | 12659 | "\xE0\x1F\x91\xF8\x82\x96\x2D\x65" |
12814 | "\xA3\xAA\x13\xCC\x50\xFF\x7B\x02", | 12660 | "\xA3\xAA\x13\xCC\x50\xFF\x7B\x02", |
12815 | .len = 496, | 12661 | .len = 496, |
12816 | .also_non_np = 1, | ||
12817 | .np = 3, | ||
12818 | .tap = { 496 - 20, 4, 16 }, | ||
12819 | }, | 12662 | }, |
12820 | }; | 12663 | }; |
12821 | 12664 | ||
@@ -12892,9 +12735,6 @@ static const struct cipher_testvec aes_cfb_tv_template[] = { | |||
12892 | "\x75\xa3\x85\x74\x1a\xb9\xce\xf8" | 12735 | "\x75\xa3\x85\x74\x1a\xb9\xce\xf8" |
12893 | "\x20\x31\x62\x3d\x55\xb1\xe4\x71", | 12736 | "\x20\x31\x62\x3d\x55\xb1\xe4\x71", |
12894 | .len = 64, | 12737 | .len = 64, |
12895 | .also_non_np = 1, | ||
12896 | .np = 2, | ||
12897 | .tap = { 31, 33 }, | ||
12898 | }, { /* > 16 bytes, not a multiple of 16 bytes */ | 12738 | }, { /* > 16 bytes, not a multiple of 16 bytes */ |
12899 | .key = "\x2b\x7e\x15\x16\x28\xae\xd2\xa6" | 12739 | .key = "\x2b\x7e\x15\x16\x28\xae\xd2\xa6" |
12900 | "\xab\xf7\x15\x88\x09\xcf\x4f\x3c", | 12740 | "\xab\xf7\x15\x88\x09\xcf\x4f\x3c", |
@@ -14795,9 +14635,6 @@ static const struct cipher_testvec aes_lrw_tv_template[] = { | |||
14795 | "\xcd\x7e\x2b\x5d\x43\xea\x42\xe7" | 14635 | "\xcd\x7e\x2b\x5d\x43\xea\x42\xe7" |
14796 | "\x74\x3f\x7d\x58\x88\x75\xde\x3e", | 14636 | "\x74\x3f\x7d\x58\x88\x75\xde\x3e", |
14797 | .len = 512, | 14637 | .len = 512, |
14798 | .also_non_np = 1, | ||
14799 | .np = 3, | ||
14800 | .tap = { 512 - 20, 4, 16 }, | ||
14801 | } | 14638 | } |
14802 | }; | 14639 | }; |
14803 | 14640 | ||
@@ -15133,9 +14970,6 @@ static const struct cipher_testvec aes_xts_tv_template[] = { | |||
15133 | "\xc4\xf3\x6f\xfd\xa9\xfc\xea\x70" | 14970 | "\xc4\xf3\x6f\xfd\xa9\xfc\xea\x70" |
15134 | "\xb9\xc6\xe6\x93\xe1\x48\xc1\x51", | 14971 | "\xb9\xc6\xe6\x93\xe1\x48\xc1\x51", |
15135 | .len = 512, | 14972 | .len = 512, |
15136 | .also_non_np = 1, | ||
15137 | .np = 3, | ||
15138 | .tap = { 512 - 20, 4, 16 }, | ||
15139 | } | 14973 | } |
15140 | }; | 14974 | }; |
15141 | 14975 | ||
@@ -15345,9 +15179,6 @@ static const struct cipher_testvec aes_ctr_tv_template[] = { | |||
15345 | "\xFA\x3A\x05\x4C\xFA\xD1\xFF\xFE" | 15179 | "\xFA\x3A\x05\x4C\xFA\xD1\xFF\xFE" |
15346 | "\xF1\x4C\xE5\xB2\x91\x64\x0C\x51", | 15180 | "\xF1\x4C\xE5\xB2\x91\x64\x0C\x51", |
15347 | .len = 496, | 15181 | .len = 496, |
15348 | .also_non_np = 1, | ||
15349 | .np = 3, | ||
15350 | .tap = { 496 - 20, 4, 16 }, | ||
15351 | }, { /* Generated with Crypto++ */ | 15182 | }, { /* Generated with Crypto++ */ |
15352 | .key = "\xC9\x83\xA6\xC9\xEC\x0F\x32\x55" | 15183 | .key = "\xC9\x83\xA6\xC9\xEC\x0F\x32\x55" |
15353 | "\x0F\x32\x55\x78\x9B\xBE\x78\x9B" | 15184 | "\x0F\x32\x55\x78\x9B\xBE\x78\x9B" |
@@ -15483,9 +15314,6 @@ static const struct cipher_testvec aes_ctr_tv_template[] = { | |||
15483 | "\xD8\xFE\xC9\x5B\x5C\x25\xE5\x76" | 15314 | "\xD8\xFE\xC9\x5B\x5C\x25\xE5\x76" |
15484 | "\xFB\xF2\x3F", | 15315 | "\xFB\xF2\x3F", |
15485 | .len = 499, | 15316 | .len = 499, |
15486 | .also_non_np = 1, | ||
15487 | .np = 2, | ||
15488 | .tap = { 499 - 16, 16 }, | ||
15489 | }, | 15317 | }, |
15490 | }; | 15318 | }; |
15491 | 15319 | ||
@@ -16609,8 +16437,6 @@ static const struct cipher_testvec aes_ctr_rfc3686_tv_template[] = { | |||
16609 | "\x4b\xef\x31\x18\xea\xac\xb1\x84" | 16437 | "\x4b\xef\x31\x18\xea\xac\xb1\x84" |
16610 | "\x21\xed\xda\x86", | 16438 | "\x21\xed\xda\x86", |
16611 | .len = 4100, | 16439 | .len = 4100, |
16612 | .np = 2, | ||
16613 | .tap = { 4064, 36 }, | ||
16614 | }, | 16440 | }, |
16615 | }; | 16441 | }; |
16616 | 16442 | ||
@@ -16638,9 +16464,6 @@ static const struct cipher_testvec aes_ofb_tv_template[] = { | |||
16638 | "\x30\x4c\x65\x28\xf6\x59\xc7\x78" | 16464 | "\x30\x4c\x65\x28\xf6\x59\xc7\x78" |
16639 | "\x66\xa5\x10\xd9\xc1\xd6\xae\x5e", | 16465 | "\x66\xa5\x10\xd9\xc1\xd6\xae\x5e", |
16640 | .len = 64, | 16466 | .len = 64, |
16641 | .also_non_np = 1, | ||
16642 | .np = 2, | ||
16643 | .tap = { 31, 33 }, | ||
16644 | }, { /* > 16 bytes, not a multiple of 16 bytes */ | 16467 | }, { /* > 16 bytes, not a multiple of 16 bytes */ |
16645 | .key = "\x2b\x7e\x15\x16\x28\xae\xd2\xa6" | 16468 | .key = "\x2b\x7e\x15\x16\x28\xae\xd2\xa6" |
16646 | "\xab\xf7\x15\x88\x09\xcf\x4f\x3c", | 16469 | "\xab\xf7\x15\x88\x09\xcf\x4f\x3c", |
@@ -23174,9 +22997,6 @@ static const struct cipher_testvec cast5_tv_template[] = { | |||
23174 | "\x4F\xFE\x24\x9C\x9A\x02\xE5\x57" | 22997 | "\x4F\xFE\x24\x9C\x9A\x02\xE5\x57" |
23175 | "\xF5\xBC\x25\xD6\x02\x56\x57\x1C", | 22998 | "\xF5\xBC\x25\xD6\x02\x56\x57\x1C", |
23176 | .len = 496, | 22999 | .len = 496, |
23177 | .also_non_np = 1, | ||
23178 | .np = 3, | ||
23179 | .tap = { 496 - 20, 4, 16 }, | ||
23180 | }, | 23000 | }, |
23181 | }; | 23001 | }; |
23182 | 23002 | ||
@@ -23311,9 +23131,6 @@ static const struct cipher_testvec cast5_cbc_tv_template[] = { | |||
23311 | "\x15\x5F\xDB\xE9\xB1\x83\xD2\xE6" | 23131 | "\x15\x5F\xDB\xE9\xB1\x83\xD2\xE6" |
23312 | "\x1D\x18\x66\x44\x5B\x8F\x14\xEB", | 23132 | "\x1D\x18\x66\x44\x5B\x8F\x14\xEB", |
23313 | .len = 496, | 23133 | .len = 496, |
23314 | .also_non_np = 1, | ||
23315 | .np = 3, | ||
23316 | .tap = { 496 - 20, 4, 16 }, | ||
23317 | }, | 23134 | }, |
23318 | }; | 23135 | }; |
23319 | 23136 | ||
@@ -23460,9 +23277,6 @@ static const struct cipher_testvec cast5_ctr_tv_template[] = { | |||
23460 | "\x8C\x98\xDB\xDE\xFC\x72\x94\xAA" | 23277 | "\x8C\x98\xDB\xDE\xFC\x72\x94\xAA" |
23461 | "\xC0\x0D\x96\xAA\x23\xF8\xFE\x13", | 23278 | "\xC0\x0D\x96\xAA\x23\xF8\xFE\x13", |
23462 | .len = 496, | 23279 | .len = 496, |
23463 | .also_non_np = 1, | ||
23464 | .np = 3, | ||
23465 | .tap = { 496 - 20, 4, 16 }, | ||
23466 | }, | 23280 | }, |
23467 | }; | 23281 | }; |
23468 | 23282 | ||
@@ -23835,20 +23649,6 @@ static const struct cipher_testvec fcrypt_pcbc_tv_template[] = { | |||
23835 | "\x19\x89\x09\x1c\x2a\x8e\x8c\x94" | 23649 | "\x19\x89\x09\x1c\x2a\x8e\x8c\x94" |
23836 | "\xfc\xc7\x68\xe4\x88\xaa\xde\x0f", | 23650 | "\xfc\xc7\x68\xe4\x88\xaa\xde\x0f", |
23837 | .len = 48, | 23651 | .len = 48, |
23838 | }, { /* split-page version */ | ||
23839 | .key = "\xfe\xdc\xba\x98\x76\x54\x32\x10", | ||
23840 | .klen = 8, | ||
23841 | .iv = "\xf0\xe1\xd2\xc3\xb4\xa5\x96\x87", | ||
23842 | .ptext = "The quick brown fox jumps over the lazy dogs.\0\0", | ||
23843 | .ctext = "\xca\x90\xf5\x9d\xcb\xd4\xd2\x3c" | ||
23844 | "\x01\x88\x7f\x3e\x31\x6e\x62\x9d" | ||
23845 | "\xd8\xe0\x57\xa3\x06\x3a\x42\x58" | ||
23846 | "\x2a\x28\xfe\x72\x52\x2f\xdd\xe0" | ||
23847 | "\x19\x89\x09\x1c\x2a\x8e\x8c\x94" | ||
23848 | "\xfc\xc7\x68\xe4\x88\xaa\xde\x0f", | ||
23849 | .len = 48, | ||
23850 | .np = 2, | ||
23851 | .tap = { 20, 28 }, | ||
23852 | } | 23652 | } |
23853 | }; | 23653 | }; |
23854 | 23654 | ||
@@ -24145,9 +23945,6 @@ static const struct cipher_testvec camellia_tv_template[] = { | |||
24145 | "\xF8\xB2\xAA\x7A\xD6\xFF\xFA\x55" | 23945 | "\xF8\xB2\xAA\x7A\xD6\xFF\xFA\x55" |
24146 | "\x33\x1A\xBB\xD3\xA2\x7E\x97\x66", | 23946 | "\x33\x1A\xBB\xD3\xA2\x7E\x97\x66", |
24147 | .len = 1008, | 23947 | .len = 1008, |
24148 | .also_non_np = 1, | ||
24149 | .np = 3, | ||
24150 | .tap = { 1008 - 20, 4, 16 }, | ||
24151 | }, | 23948 | }, |
24152 | }; | 23949 | }; |
24153 | 23950 | ||
@@ -24438,9 +24235,6 @@ static const struct cipher_testvec camellia_cbc_tv_template[] = { | |||
24438 | "\x55\x01\xD4\x58\xB2\xF2\x85\x49" | 24235 | "\x55\x01\xD4\x58\xB2\xF2\x85\x49" |
24439 | "\x70\xC5\xB9\x0B\x3B\x7A\x6E\x6C", | 24236 | "\x70\xC5\xB9\x0B\x3B\x7A\x6E\x6C", |
24440 | .len = 1008, | 24237 | .len = 1008, |
24441 | .also_non_np = 1, | ||
24442 | .np = 3, | ||
24443 | .tap = { 1008 - 20, 4, 16 }, | ||
24444 | }, | 24238 | }, |
24445 | }; | 24239 | }; |
24446 | 24240 | ||
@@ -24841,9 +24635,6 @@ static const struct cipher_testvec camellia_ctr_tv_template[] = { | |||
24841 | "\xE7\x2C\x49\x08\x8B\x72\xFA\x5C" | 24635 | "\xE7\x2C\x49\x08\x8B\x72\xFA\x5C" |
24842 | "\xF1\x6B\xD9", | 24636 | "\xF1\x6B\xD9", |
24843 | .len = 1011, | 24637 | .len = 1011, |
24844 | .also_non_np = 1, | ||
24845 | .np = 2, | ||
24846 | .tap = { 1011 - 16, 16 }, | ||
24847 | }, { /* Generated with Crypto++ */ | 24638 | }, { /* Generated with Crypto++ */ |
24848 | .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" | 24639 | .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" |
24849 | "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" | 24640 | "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" |
@@ -25346,9 +25137,6 @@ static const struct cipher_testvec camellia_lrw_tv_template[] = { | |||
25346 | "\xb2\x1a\xd8\x4c\xbd\x1d\x10\xe9" | 25137 | "\xb2\x1a\xd8\x4c\xbd\x1d\x10\xe9" |
25347 | "\x5a\xa8\x92\x7f\xba\xe6\x0c\x95", | 25138 | "\x5a\xa8\x92\x7f\xba\xe6\x0c\x95", |
25348 | .len = 512, | 25139 | .len = 512, |
25349 | .also_non_np = 1, | ||
25350 | .np = 3, | ||
25351 | .tap = { 512 - 20, 4, 16 }, | ||
25352 | }, | 25140 | }, |
25353 | }; | 25141 | }; |
25354 | 25142 | ||
@@ -25683,9 +25471,6 @@ static const struct cipher_testvec camellia_xts_tv_template[] = { | |||
25683 | "\xb7\x16\xd8\x12\x5c\xcd\x7d\x4e" | 25471 | "\xb7\x16\xd8\x12\x5c\xcd\x7d\x4e" |
25684 | "\xd5\xc6\x99\xcc\x4e\x6c\x94\x95", | 25472 | "\xd5\xc6\x99\xcc\x4e\x6c\x94\x95", |
25685 | .len = 512, | 25473 | .len = 512, |
25686 | .also_non_np = 1, | ||
25687 | .np = 3, | ||
25688 | .tap = { 512 - 20, 4, 16 }, | ||
25689 | }, | 25474 | }, |
25690 | }; | 25475 | }; |
25691 | 25476 | ||
@@ -26889,8 +26674,6 @@ static const struct cipher_testvec salsa20_stream_tv_template[] = { | |||
26889 | "\x87\x13\xc6\x5b\x59\x8d\xf2\xc8" | 26674 | "\x87\x13\xc6\x5b\x59\x8d\xf2\xc8" |
26890 | "\xaf\xdf\x11\x95", | 26675 | "\xaf\xdf\x11\x95", |
26891 | .len = 4100, | 26676 | .len = 4100, |
26892 | .np = 2, | ||
26893 | .tap = { 4064, 36 }, | ||
26894 | }, | 26677 | }, |
26895 | }; | 26678 | }; |
26896 | 26679 | ||
@@ -27023,9 +26806,6 @@ static const struct cipher_testvec chacha20_tv_template[] = { | |||
27023 | "\x5b\x86\x2f\x37\x30\xe3\x7c\xfd" | 26806 | "\x5b\x86\x2f\x37\x30\xe3\x7c\xfd" |
27024 | "\xc4\xfd\x80\x6c\x22\xf2\x21", | 26807 | "\xc4\xfd\x80\x6c\x22\xf2\x21", |
27025 | .len = 375, | 26808 | .len = 375, |
27026 | .also_non_np = 1, | ||
27027 | .np = 3, | ||
27028 | .tap = { 375 - 20, 4, 16 }, | ||
27029 | 26809 | ||
27030 | }, { /* RFC7539 A.2. Test Vector #3 */ | 26810 | }, { /* RFC7539 A.2. Test Vector #3 */ |
27031 | .key = "\x1c\x92\x40\xa5\xeb\x55\xd3\x8a" | 26811 | .key = "\x1c\x92\x40\xa5\xeb\x55\xd3\x8a" |
@@ -27399,9 +27179,6 @@ static const struct cipher_testvec chacha20_tv_template[] = { | |||
27399 | "\xa1\xed\xad\xd5\x76\xfa\x24\x8f" | 27179 | "\xa1\xed\xad\xd5\x76\xfa\x24\x8f" |
27400 | "\x98", | 27180 | "\x98", |
27401 | .len = 1281, | 27181 | .len = 1281, |
27402 | .also_non_np = 1, | ||
27403 | .np = 3, | ||
27404 | .tap = { 1200, 1, 80 }, | ||
27405 | }, | 27182 | }, |
27406 | }; | 27183 | }; |
27407 | 27184 | ||
@@ -27594,9 +27371,6 @@ static const struct cipher_testvec xchacha20_tv_template[] = { | |||
27594 | "\xab\xff\x1f\x12\xc3\xee\xe5\x65" | 27371 | "\xab\xff\x1f\x12\xc3\xee\xe5\x65" |
27595 | "\x12\x8d\x7b\x61\xe5\x1f\x98", | 27372 | "\x12\x8d\x7b\x61\xe5\x1f\x98", |
27596 | .len = 375, | 27373 | .len = 375, |
27597 | .also_non_np = 1, | ||
27598 | .np = 3, | ||
27599 | .tap = { 375 - 20, 4, 16 }, | ||
27600 | 27374 | ||
27601 | }, { /* Derived from a ChaCha20 test vector, via the process above */ | 27375 | }, { /* Derived from a ChaCha20 test vector, via the process above */ |
27602 | .key = "\x1c\x92\x40\xa5\xeb\x55\xd3\x8a" | 27376 | .key = "\x1c\x92\x40\xa5\xeb\x55\xd3\x8a" |
@@ -27974,9 +27748,6 @@ static const struct cipher_testvec xchacha20_tv_template[] = { | |||
27974 | "\xba\xd0\x34\xc9\x2d\x91\xc5\x17" | 27748 | "\xba\xd0\x34\xc9\x2d\x91\xc5\x17" |
27975 | "\x11", | 27749 | "\x11", |
27976 | .len = 1281, | 27750 | .len = 1281, |
27977 | .also_non_np = 1, | ||
27978 | .np = 3, | ||
27979 | .tap = { 1200, 1, 80 }, | ||
27980 | }, { /* test vector from https://tools.ietf.org/html/draft-arciszewski-xchacha-02#appendix-A.3.2 */ | 27751 | }, { /* test vector from https://tools.ietf.org/html/draft-arciszewski-xchacha-02#appendix-A.3.2 */ |
27981 | .key = "\x80\x81\x82\x83\x84\x85\x86\x87" | 27752 | .key = "\x80\x81\x82\x83\x84\x85\x86\x87" |
27982 | "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" | 27753 | "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" |
@@ -28259,9 +28030,6 @@ static const struct cipher_testvec xchacha12_tv_template[] = { | |||
28259 | "\xda\x4e\xc9\xab\x9b\x8a\x7b", | 28030 | "\xda\x4e\xc9\xab\x9b\x8a\x7b", |
28260 | 28031 | ||
28261 | .len = 375, | 28032 | .len = 375, |
28262 | .also_non_np = 1, | ||
28263 | .np = 3, | ||
28264 | .tap = { 375 - 20, 4, 16 }, | ||
28265 | 28033 | ||
28266 | }, { | 28034 | }, { |
28267 | .key = "\x1c\x92\x40\xa5\xeb\x55\xd3\x8a" | 28035 | .key = "\x1c\x92\x40\xa5\xeb\x55\xd3\x8a" |
@@ -28639,9 +28407,6 @@ static const struct cipher_testvec xchacha12_tv_template[] = { | |||
28639 | "\xf0\xfc\x5e\x1c\xf1\xf5\xf9\xf3" | 28407 | "\xf0\xfc\x5e\x1c\xf1\xf5\xf9\xf3" |
28640 | "\x5b", | 28408 | "\x5b", |
28641 | .len = 1281, | 28409 | .len = 1281, |
28642 | .also_non_np = 1, | ||
28643 | .np = 3, | ||
28644 | .tap = { 1200, 1, 80 }, | ||
28645 | }, { | 28410 | }, { |
28646 | .key = "\x80\x81\x82\x83\x84\x85\x86\x87" | 28411 | .key = "\x80\x81\x82\x83\x84\x85\x86\x87" |
28647 | "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" | 28412 | "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" |
@@ -28749,9 +28514,6 @@ static const struct cipher_testvec adiantum_xchacha12_aes_tv_template[] = { | |||
28749 | .ctext = "\x6d\x32\x86\x18\x67\x86\x0f\x3f" | 28514 | .ctext = "\x6d\x32\x86\x18\x67\x86\x0f\x3f" |
28750 | "\x96\x7c\x9d\x28\x0d\x53\xec\x9f", | 28515 | "\x96\x7c\x9d\x28\x0d\x53\xec\x9f", |
28751 | .len = 16, | 28516 | .len = 16, |
28752 | .also_non_np = 1, | ||
28753 | .np = 2, | ||
28754 | .tap = { 14, 2 }, | ||
28755 | }, { | 28517 | }, { |
28756 | .key = "\x36\x2b\x57\x97\xf8\x5d\xcd\x99" | 28518 | .key = "\x36\x2b\x57\x97\xf8\x5d\xcd\x99" |
28757 | "\x5f\x1a\x5a\x44\x1d\x92\x0f\x27" | 28519 | "\x5f\x1a\x5a\x44\x1d\x92\x0f\x27" |
@@ -28814,9 +28576,6 @@ static const struct cipher_testvec adiantum_xchacha12_aes_tv_template[] = { | |||
28814 | "\x74\xa6\xaa\xa3\xac\xdc\xc2\xf5" | 28576 | "\x74\xa6\xaa\xa3\xac\xdc\xc2\xf5" |
28815 | "\x8d\xde\x34\x86\x78\x60\x75\x8d", | 28577 | "\x8d\xde\x34\x86\x78\x60\x75\x8d", |
28816 | .len = 128, | 28578 | .len = 128, |
28817 | .also_non_np = 1, | ||
28818 | .np = 4, | ||
28819 | .tap = { 104, 16, 4, 4 }, | ||
28820 | }, { | 28579 | }, { |
28821 | .key = "\xd3\x81\x72\x18\x23\xff\x6f\x4a" | 28580 | .key = "\xd3\x81\x72\x18\x23\xff\x6f\x4a" |
28822 | "\x25\x74\x29\x0d\x51\x8a\x0e\x13" | 28581 | "\x25\x74\x29\x0d\x51\x8a\x0e\x13" |
@@ -28956,9 +28715,6 @@ static const struct cipher_testvec adiantum_xchacha12_aes_tv_template[] = { | |||
28956 | "\x21\xb0\x21\x52\xba\xa7\x37\xaa" | 28715 | "\x21\xb0\x21\x52\xba\xa7\x37\xaa" |
28957 | "\xcc\xbf\x95\xa8\xf4\xd0\x91\xf6", | 28716 | "\xcc\xbf\x95\xa8\xf4\xd0\x91\xf6", |
28958 | .len = 512, | 28717 | .len = 512, |
28959 | .also_non_np = 1, | ||
28960 | .np = 2, | ||
28961 | .tap = { 144, 368 }, | ||
28962 | } | 28718 | } |
28963 | }; | 28719 | }; |
28964 | 28720 | ||
@@ -28980,9 +28736,6 @@ static const struct cipher_testvec adiantum_xchacha20_aes_tv_template[] = { | |||
28980 | .ctext = "\xf6\x78\x97\xd6\xaa\x94\x01\x27" | 28736 | .ctext = "\xf6\x78\x97\xd6\xaa\x94\x01\x27" |
28981 | "\x2e\x4d\x83\xe0\x6e\x64\x9a\xdf", | 28737 | "\x2e\x4d\x83\xe0\x6e\x64\x9a\xdf", |
28982 | .len = 16, | 28738 | .len = 16, |
28983 | .also_non_np = 1, | ||
28984 | .np = 3, | ||
28985 | .tap = { 5, 2, 9 }, | ||
28986 | }, { | 28739 | }, { |
28987 | .key = "\x36\x2b\x57\x97\xf8\x5d\xcd\x99" | 28740 | .key = "\x36\x2b\x57\x97\xf8\x5d\xcd\x99" |
28988 | "\x5f\x1a\x5a\x44\x1d\x92\x0f\x27" | 28741 | "\x5f\x1a\x5a\x44\x1d\x92\x0f\x27" |
@@ -29002,9 +28755,6 @@ static const struct cipher_testvec adiantum_xchacha20_aes_tv_template[] = { | |||
29002 | "\x57\x72\xb5\xfd\xb5\x5d\xb8\x28" | 28755 | "\x57\x72\xb5\xfd\xb5\x5d\xb8\x28" |
29003 | "\x0c\x04\x91\x14\x91\xe9\x37", | 28756 | "\x0c\x04\x91\x14\x91\xe9\x37", |
29004 | .len = 31, | 28757 | .len = 31, |
29005 | .also_non_np = 1, | ||
29006 | .np = 2, | ||
29007 | .tap = { 16, 15 }, | ||
29008 | }, { | 28758 | }, { |
29009 | .key = "\xa5\x28\x24\x34\x1a\x3c\xd8\xf7" | 28759 | .key = "\xa5\x28\x24\x34\x1a\x3c\xd8\xf7" |
29010 | "\x05\x91\x8f\xee\x85\x1f\x35\x7f" | 28760 | "\x05\x91\x8f\xee\x85\x1f\x35\x7f" |
@@ -29048,9 +28798,6 @@ static const struct cipher_testvec adiantum_xchacha20_aes_tv_template[] = { | |||
29048 | "\x29\x62\x0d\xb2\xf6\x3c\x58\x57" | 28798 | "\x29\x62\x0d\xb2\xf6\x3c\x58\x57" |
29049 | "\xc1\xd5\x5a\xbb\xd6\xa6\x2a\xe5", | 28799 | "\xc1\xd5\x5a\xbb\xd6\xa6\x2a\xe5", |
29050 | .len = 128, | 28800 | .len = 128, |
29051 | .also_non_np = 1, | ||
29052 | .np = 4, | ||
29053 | .tap = { 112, 7, 8, 1 }, | ||
29054 | }, { | 28801 | }, { |
29055 | .key = "\xd3\x81\x72\x18\x23\xff\x6f\x4a" | 28802 | .key = "\xd3\x81\x72\x18\x23\xff\x6f\x4a" |
29056 | "\x25\x74\x29\x0d\x51\x8a\x0e\x13" | 28803 | "\x25\x74\x29\x0d\x51\x8a\x0e\x13" |