summaryrefslogtreecommitdiffstats
path: root/crypto/testmgr.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2016-11-22 07:08:31 -0500
committerHerbert Xu <herbert@gondor.apana.org.au>2016-11-28 08:23:20 -0500
commiteed93e0ce335fbe69b8e6847eca3f2c643010112 (patch)
treec5f4f38bc7f63343e21f46b2e0b4ad3b6354a211 /crypto/testmgr.c
parent065ce3273782b632f3e16ab789b432e12deb6823 (diff)
crypto: testmgr - Do not test internal algorithms
Currently we manually filter out internal algorithms using a list in testmgr. This is dangerous as internal algorithms cannot be safely used even by testmgr. This patch ensures that they're never processed by testmgr at all. This patch also removes an obsolete bypass for nivciphers which no longer exist. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/testmgr.c')
-rw-r--r--crypto/testmgr.c153
1 files changed, 9 insertions, 144 deletions
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index ded50b67c757..6ac46966800b 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -1625,7 +1625,7 @@ static int alg_test_aead(const struct alg_test_desc *desc, const char *driver,
1625 struct crypto_aead *tfm; 1625 struct crypto_aead *tfm;
1626 int err = 0; 1626 int err = 0;
1627 1627
1628 tfm = crypto_alloc_aead(driver, type | CRYPTO_ALG_INTERNAL, mask); 1628 tfm = crypto_alloc_aead(driver, type, mask);
1629 if (IS_ERR(tfm)) { 1629 if (IS_ERR(tfm)) {
1630 printk(KERN_ERR "alg: aead: Failed to load transform for %s: " 1630 printk(KERN_ERR "alg: aead: Failed to load transform for %s: "
1631 "%ld\n", driver, PTR_ERR(tfm)); 1631 "%ld\n", driver, PTR_ERR(tfm));
@@ -1654,7 +1654,7 @@ static int alg_test_cipher(const struct alg_test_desc *desc,
1654 struct crypto_cipher *tfm; 1654 struct crypto_cipher *tfm;
1655 int err = 0; 1655 int err = 0;
1656 1656
1657 tfm = crypto_alloc_cipher(driver, type | CRYPTO_ALG_INTERNAL, mask); 1657 tfm = crypto_alloc_cipher(driver, type, mask);
1658 if (IS_ERR(tfm)) { 1658 if (IS_ERR(tfm)) {
1659 printk(KERN_ERR "alg: cipher: Failed to load transform for " 1659 printk(KERN_ERR "alg: cipher: Failed to load transform for "
1660 "%s: %ld\n", driver, PTR_ERR(tfm)); 1660 "%s: %ld\n", driver, PTR_ERR(tfm));
@@ -1683,7 +1683,7 @@ static int alg_test_skcipher(const struct alg_test_desc *desc,
1683 struct crypto_skcipher *tfm; 1683 struct crypto_skcipher *tfm;
1684 int err = 0; 1684 int err = 0;
1685 1685
1686 tfm = crypto_alloc_skcipher(driver, type | CRYPTO_ALG_INTERNAL, mask); 1686 tfm = crypto_alloc_skcipher(driver, type, mask);
1687 if (IS_ERR(tfm)) { 1687 if (IS_ERR(tfm)) {
1688 printk(KERN_ERR "alg: skcipher: Failed to load transform for " 1688 printk(KERN_ERR "alg: skcipher: Failed to load transform for "
1689 "%s: %ld\n", driver, PTR_ERR(tfm)); 1689 "%s: %ld\n", driver, PTR_ERR(tfm));
@@ -1750,7 +1750,7 @@ static int alg_test_hash(const struct alg_test_desc *desc, const char *driver,
1750 struct crypto_ahash *tfm; 1750 struct crypto_ahash *tfm;
1751 int err; 1751 int err;
1752 1752
1753 tfm = crypto_alloc_ahash(driver, type | CRYPTO_ALG_INTERNAL, mask); 1753 tfm = crypto_alloc_ahash(driver, type, mask);
1754 if (IS_ERR(tfm)) { 1754 if (IS_ERR(tfm)) {
1755 printk(KERN_ERR "alg: hash: Failed to load transform for %s: " 1755 printk(KERN_ERR "alg: hash: Failed to load transform for %s: "
1756 "%ld\n", driver, PTR_ERR(tfm)); 1756 "%ld\n", driver, PTR_ERR(tfm));
@@ -1778,7 +1778,7 @@ static int alg_test_crc32c(const struct alg_test_desc *desc,
1778 if (err) 1778 if (err)
1779 goto out; 1779 goto out;
1780 1780
1781 tfm = crypto_alloc_shash(driver, type | CRYPTO_ALG_INTERNAL, mask); 1781 tfm = crypto_alloc_shash(driver, type, mask);
1782 if (IS_ERR(tfm)) { 1782 if (IS_ERR(tfm)) {
1783 printk(KERN_ERR "alg: crc32c: Failed to load transform for %s: " 1783 printk(KERN_ERR "alg: crc32c: Failed to load transform for %s: "
1784 "%ld\n", driver, PTR_ERR(tfm)); 1784 "%ld\n", driver, PTR_ERR(tfm));
@@ -1820,7 +1820,7 @@ static int alg_test_cprng(const struct alg_test_desc *desc, const char *driver,
1820 struct crypto_rng *rng; 1820 struct crypto_rng *rng;
1821 int err; 1821 int err;
1822 1822
1823 rng = crypto_alloc_rng(driver, type | CRYPTO_ALG_INTERNAL, mask); 1823 rng = crypto_alloc_rng(driver, type, mask);
1824 if (IS_ERR(rng)) { 1824 if (IS_ERR(rng)) {
1825 printk(KERN_ERR "alg: cprng: Failed to load transform for %s: " 1825 printk(KERN_ERR "alg: cprng: Failed to load transform for %s: "
1826 "%ld\n", driver, PTR_ERR(rng)); 1826 "%ld\n", driver, PTR_ERR(rng));
@@ -1847,7 +1847,7 @@ static int drbg_cavs_test(struct drbg_testvec *test, int pr,
1847 if (!buf) 1847 if (!buf)
1848 return -ENOMEM; 1848 return -ENOMEM;
1849 1849
1850 drng = crypto_alloc_rng(driver, type | CRYPTO_ALG_INTERNAL, mask); 1850 drng = crypto_alloc_rng(driver, type, mask);
1851 if (IS_ERR(drng)) { 1851 if (IS_ERR(drng)) {
1852 printk(KERN_ERR "alg: drbg: could not allocate DRNG handle for " 1852 printk(KERN_ERR "alg: drbg: could not allocate DRNG handle for "
1853 "%s\n", driver); 1853 "%s\n", driver);
@@ -2041,7 +2041,7 @@ static int alg_test_kpp(const struct alg_test_desc *desc, const char *driver,
2041 struct crypto_kpp *tfm; 2041 struct crypto_kpp *tfm;
2042 int err = 0; 2042 int err = 0;
2043 2043
2044 tfm = crypto_alloc_kpp(driver, type | CRYPTO_ALG_INTERNAL, mask); 2044 tfm = crypto_alloc_kpp(driver, type, mask);
2045 if (IS_ERR(tfm)) { 2045 if (IS_ERR(tfm)) {
2046 pr_err("alg: kpp: Failed to load tfm for %s: %ld\n", 2046 pr_err("alg: kpp: Failed to load tfm for %s: %ld\n",
2047 driver, PTR_ERR(tfm)); 2047 driver, PTR_ERR(tfm));
@@ -2200,7 +2200,7 @@ static int alg_test_akcipher(const struct alg_test_desc *desc,
2200 struct crypto_akcipher *tfm; 2200 struct crypto_akcipher *tfm;
2201 int err = 0; 2201 int err = 0;
2202 2202
2203 tfm = crypto_alloc_akcipher(driver, type | CRYPTO_ALG_INTERNAL, mask); 2203 tfm = crypto_alloc_akcipher(driver, type, mask);
2204 if (IS_ERR(tfm)) { 2204 if (IS_ERR(tfm)) {
2205 pr_err("alg: akcipher: Failed to load tfm for %s: %ld\n", 2205 pr_err("alg: akcipher: Failed to load tfm for %s: %ld\n",
2206 driver, PTR_ERR(tfm)); 2206 driver, PTR_ERR(tfm));
@@ -2223,88 +2223,6 @@ static int alg_test_null(const struct alg_test_desc *desc,
2223/* Please keep this list sorted by algorithm name. */ 2223/* Please keep this list sorted by algorithm name. */
2224static const struct alg_test_desc alg_test_descs[] = { 2224static const struct alg_test_desc alg_test_descs[] = {
2225 { 2225 {
2226 .alg = "__cbc-cast5-avx",
2227 .test = alg_test_null,
2228 }, {
2229 .alg = "__cbc-cast6-avx",
2230 .test = alg_test_null,
2231 }, {
2232 .alg = "__cbc-serpent-avx",
2233 .test = alg_test_null,
2234 }, {
2235 .alg = "__cbc-serpent-avx2",
2236 .test = alg_test_null,
2237 }, {
2238 .alg = "__cbc-serpent-sse2",
2239 .test = alg_test_null,
2240 }, {
2241 .alg = "__cbc-twofish-avx",
2242 .test = alg_test_null,
2243 }, {
2244 .alg = "__driver-cbc-aes-aesni",
2245 .test = alg_test_null,
2246 .fips_allowed = 1,
2247 }, {
2248 .alg = "__driver-cbc-camellia-aesni",
2249 .test = alg_test_null,
2250 }, {
2251 .alg = "__driver-cbc-camellia-aesni-avx2",
2252 .test = alg_test_null,
2253 }, {
2254 .alg = "__driver-cbc-cast5-avx",
2255 .test = alg_test_null,
2256 }, {
2257 .alg = "__driver-cbc-cast6-avx",
2258 .test = alg_test_null,
2259 }, {
2260 .alg = "__driver-cbc-serpent-avx",
2261 .test = alg_test_null,
2262 }, {
2263 .alg = "__driver-cbc-serpent-avx2",
2264 .test = alg_test_null,
2265 }, {
2266 .alg = "__driver-cbc-serpent-sse2",
2267 .test = alg_test_null,
2268 }, {
2269 .alg = "__driver-cbc-twofish-avx",
2270 .test = alg_test_null,
2271 }, {
2272 .alg = "__driver-ecb-aes-aesni",
2273 .test = alg_test_null,
2274 .fips_allowed = 1,
2275 }, {
2276 .alg = "__driver-ecb-camellia-aesni",
2277 .test = alg_test_null,
2278 }, {
2279 .alg = "__driver-ecb-camellia-aesni-avx2",
2280 .test = alg_test_null,
2281 }, {
2282 .alg = "__driver-ecb-cast5-avx",
2283 .test = alg_test_null,
2284 }, {
2285 .alg = "__driver-ecb-cast6-avx",
2286 .test = alg_test_null,
2287 }, {
2288 .alg = "__driver-ecb-serpent-avx",
2289 .test = alg_test_null,
2290 }, {
2291 .alg = "__driver-ecb-serpent-avx2",
2292 .test = alg_test_null,
2293 }, {
2294 .alg = "__driver-ecb-serpent-sse2",
2295 .test = alg_test_null,
2296 }, {
2297 .alg = "__driver-ecb-twofish-avx",
2298 .test = alg_test_null,
2299 }, {
2300 .alg = "__driver-gcm-aes-aesni",
2301 .test = alg_test_null,
2302 .fips_allowed = 1,
2303 }, {
2304 .alg = "__ghash-pclmulqdqni",
2305 .test = alg_test_null,
2306 .fips_allowed = 1,
2307 }, {
2308 .alg = "ansi_cprng", 2226 .alg = "ansi_cprng",
2309 .test = alg_test_cprng, 2227 .test = alg_test_cprng,
2310 .suite = { 2228 .suite = {
@@ -2791,55 +2709,6 @@ static const struct alg_test_desc alg_test_descs[] = {
2791 } 2709 }
2792 } 2710 }
2793 }, { 2711 }, {
2794 .alg = "cryptd(__driver-cbc-aes-aesni)",
2795 .test = alg_test_null,
2796 .fips_allowed = 1,
2797 }, {
2798 .alg = "cryptd(__driver-cbc-camellia-aesni)",
2799 .test = alg_test_null,
2800 }, {
2801 .alg = "cryptd(__driver-cbc-camellia-aesni-avx2)",
2802 .test = alg_test_null,
2803 }, {
2804 .alg = "cryptd(__driver-cbc-serpent-avx2)",
2805 .test = alg_test_null,
2806 }, {
2807 .alg = "cryptd(__driver-ecb-aes-aesni)",
2808 .test = alg_test_null,
2809 .fips_allowed = 1,
2810 }, {
2811 .alg = "cryptd(__driver-ecb-camellia-aesni)",
2812 .test = alg_test_null,
2813 }, {
2814 .alg = "cryptd(__driver-ecb-camellia-aesni-avx2)",
2815 .test = alg_test_null,
2816 }, {
2817 .alg = "cryptd(__driver-ecb-cast5-avx)",
2818 .test = alg_test_null,
2819 }, {
2820 .alg = "cryptd(__driver-ecb-cast6-avx)",
2821 .test = alg_test_null,
2822 }, {
2823 .alg = "cryptd(__driver-ecb-serpent-avx)",
2824 .test = alg_test_null,
2825 }, {
2826 .alg = "cryptd(__driver-ecb-serpent-avx2)",
2827 .test = alg_test_null,
2828 }, {
2829 .alg = "cryptd(__driver-ecb-serpent-sse2)",
2830 .test = alg_test_null,
2831 }, {
2832 .alg = "cryptd(__driver-ecb-twofish-avx)",
2833 .test = alg_test_null,
2834 }, {
2835 .alg = "cryptd(__driver-gcm-aes-aesni)",
2836 .test = alg_test_null,
2837 .fips_allowed = 1,
2838 }, {
2839 .alg = "cryptd(__ghash-pclmulqdqni)",
2840 .test = alg_test_null,
2841 .fips_allowed = 1,
2842 }, {
2843 .alg = "ctr(aes)", 2712 .alg = "ctr(aes)",
2844 .test = alg_test_skcipher, 2713 .test = alg_test_skcipher,
2845 .fips_allowed = 1, 2714 .fips_allowed = 1,
@@ -3166,10 +3035,6 @@ static const struct alg_test_desc alg_test_descs[] = {
3166 .fips_allowed = 1, 3035 .fips_allowed = 1,
3167 .test = alg_test_null, 3036 .test = alg_test_null,
3168 }, { 3037 }, {
3169 .alg = "ecb(__aes-aesni)",
3170 .test = alg_test_null,
3171 .fips_allowed = 1,
3172 }, {
3173 .alg = "ecb(aes)", 3038 .alg = "ecb(aes)",
3174 .test = alg_test_skcipher, 3039 .test = alg_test_skcipher,
3175 .fips_allowed = 1, 3040 .fips_allowed = 1,