diff options
author | Joonsoo Kim <js1304@gmail.com> | 2016-01-26 03:15:03 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2016-01-27 07:36:24 -0500 |
commit | 110492183c4b8f572b16fce096b9d78e2da30baf (patch) | |
tree | 89502e3140cba8a074a2996e53172db637c31d1e /crypto/testmgr.c | |
parent | 10cff58c6772587f9df422dc1dfaca936c66be1f (diff) |
crypto: compress - remove unused pcomp interface
It is unused now, so remove it.
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/testmgr.c')
-rw-r--r-- | crypto/testmgr.c | 223 |
1 files changed, 0 insertions, 223 deletions
diff --git a/crypto/testmgr.c b/crypto/testmgr.c index 5c0963d17de7..cbd78c954844 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c | |||
@@ -96,13 +96,6 @@ struct comp_test_suite { | |||
96 | } comp, decomp; | 96 | } comp, decomp; |
97 | }; | 97 | }; |
98 | 98 | ||
99 | struct pcomp_test_suite { | ||
100 | struct { | ||
101 | struct pcomp_testvec *vecs; | ||
102 | unsigned int count; | ||
103 | } comp, decomp; | ||
104 | }; | ||
105 | |||
106 | struct hash_test_suite { | 99 | struct hash_test_suite { |
107 | struct hash_testvec *vecs; | 100 | struct hash_testvec *vecs; |
108 | unsigned int count; | 101 | unsigned int count; |
@@ -133,7 +126,6 @@ struct alg_test_desc { | |||
133 | struct aead_test_suite aead; | 126 | struct aead_test_suite aead; |
134 | struct cipher_test_suite cipher; | 127 | struct cipher_test_suite cipher; |
135 | struct comp_test_suite comp; | 128 | struct comp_test_suite comp; |
136 | struct pcomp_test_suite pcomp; | ||
137 | struct hash_test_suite hash; | 129 | struct hash_test_suite hash; |
138 | struct cprng_test_suite cprng; | 130 | struct cprng_test_suite cprng; |
139 | struct drbg_test_suite drbg; | 131 | struct drbg_test_suite drbg; |
@@ -1293,183 +1285,6 @@ out: | |||
1293 | return ret; | 1285 | return ret; |
1294 | } | 1286 | } |
1295 | 1287 | ||
1296 | static int test_pcomp(struct crypto_pcomp *tfm, | ||
1297 | struct pcomp_testvec *ctemplate, | ||
1298 | struct pcomp_testvec *dtemplate, int ctcount, | ||
1299 | int dtcount) | ||
1300 | { | ||
1301 | const char *algo = crypto_tfm_alg_driver_name(crypto_pcomp_tfm(tfm)); | ||
1302 | unsigned int i; | ||
1303 | char result[COMP_BUF_SIZE]; | ||
1304 | int res; | ||
1305 | |||
1306 | for (i = 0; i < ctcount; i++) { | ||
1307 | struct comp_request req; | ||
1308 | unsigned int produced = 0; | ||
1309 | |||
1310 | res = crypto_compress_setup(tfm, ctemplate[i].params, | ||
1311 | ctemplate[i].paramsize); | ||
1312 | if (res) { | ||
1313 | pr_err("alg: pcomp: compression setup failed on test " | ||
1314 | "%d for %s: error=%d\n", i + 1, algo, res); | ||
1315 | return res; | ||
1316 | } | ||
1317 | |||
1318 | res = crypto_compress_init(tfm); | ||
1319 | if (res) { | ||
1320 | pr_err("alg: pcomp: compression init failed on test " | ||
1321 | "%d for %s: error=%d\n", i + 1, algo, res); | ||
1322 | return res; | ||
1323 | } | ||
1324 | |||
1325 | memset(result, 0, sizeof(result)); | ||
1326 | |||
1327 | req.next_in = ctemplate[i].input; | ||
1328 | req.avail_in = ctemplate[i].inlen / 2; | ||
1329 | req.next_out = result; | ||
1330 | req.avail_out = ctemplate[i].outlen / 2; | ||
1331 | |||
1332 | res = crypto_compress_update(tfm, &req); | ||
1333 | if (res < 0 && (res != -EAGAIN || req.avail_in)) { | ||
1334 | pr_err("alg: pcomp: compression update failed on test " | ||
1335 | "%d for %s: error=%d\n", i + 1, algo, res); | ||
1336 | return res; | ||
1337 | } | ||
1338 | if (res > 0) | ||
1339 | produced += res; | ||
1340 | |||
1341 | /* Add remaining input data */ | ||
1342 | req.avail_in += (ctemplate[i].inlen + 1) / 2; | ||
1343 | |||
1344 | res = crypto_compress_update(tfm, &req); | ||
1345 | if (res < 0 && (res != -EAGAIN || req.avail_in)) { | ||
1346 | pr_err("alg: pcomp: compression update failed on test " | ||
1347 | "%d for %s: error=%d\n", i + 1, algo, res); | ||
1348 | return res; | ||
1349 | } | ||
1350 | if (res > 0) | ||
1351 | produced += res; | ||
1352 | |||
1353 | /* Provide remaining output space */ | ||
1354 | req.avail_out += COMP_BUF_SIZE - ctemplate[i].outlen / 2; | ||
1355 | |||
1356 | res = crypto_compress_final(tfm, &req); | ||
1357 | if (res < 0) { | ||
1358 | pr_err("alg: pcomp: compression final failed on test " | ||
1359 | "%d for %s: error=%d\n", i + 1, algo, res); | ||
1360 | return res; | ||
1361 | } | ||
1362 | produced += res; | ||
1363 | |||
1364 | if (COMP_BUF_SIZE - req.avail_out != ctemplate[i].outlen) { | ||
1365 | pr_err("alg: comp: Compression test %d failed for %s: " | ||
1366 | "output len = %d (expected %d)\n", i + 1, algo, | ||
1367 | COMP_BUF_SIZE - req.avail_out, | ||
1368 | ctemplate[i].outlen); | ||
1369 | return -EINVAL; | ||
1370 | } | ||
1371 | |||
1372 | if (produced != ctemplate[i].outlen) { | ||
1373 | pr_err("alg: comp: Compression test %d failed for %s: " | ||
1374 | "returned len = %u (expected %d)\n", i + 1, | ||
1375 | algo, produced, ctemplate[i].outlen); | ||
1376 | return -EINVAL; | ||
1377 | } | ||
1378 | |||
1379 | if (memcmp(result, ctemplate[i].output, ctemplate[i].outlen)) { | ||
1380 | pr_err("alg: pcomp: Compression test %d failed for " | ||
1381 | "%s\n", i + 1, algo); | ||
1382 | hexdump(result, ctemplate[i].outlen); | ||
1383 | return -EINVAL; | ||
1384 | } | ||
1385 | } | ||
1386 | |||
1387 | for (i = 0; i < dtcount; i++) { | ||
1388 | struct comp_request req; | ||
1389 | unsigned int produced = 0; | ||
1390 | |||
1391 | res = crypto_decompress_setup(tfm, dtemplate[i].params, | ||
1392 | dtemplate[i].paramsize); | ||
1393 | if (res) { | ||
1394 | pr_err("alg: pcomp: decompression setup failed on " | ||
1395 | "test %d for %s: error=%d\n", i + 1, algo, res); | ||
1396 | return res; | ||
1397 | } | ||
1398 | |||
1399 | res = crypto_decompress_init(tfm); | ||
1400 | if (res) { | ||
1401 | pr_err("alg: pcomp: decompression init failed on test " | ||
1402 | "%d for %s: error=%d\n", i + 1, algo, res); | ||
1403 | return res; | ||
1404 | } | ||
1405 | |||
1406 | memset(result, 0, sizeof(result)); | ||
1407 | |||
1408 | req.next_in = dtemplate[i].input; | ||
1409 | req.avail_in = dtemplate[i].inlen / 2; | ||
1410 | req.next_out = result; | ||
1411 | req.avail_out = dtemplate[i].outlen / 2; | ||
1412 | |||
1413 | res = crypto_decompress_update(tfm, &req); | ||
1414 | if (res < 0 && (res != -EAGAIN || req.avail_in)) { | ||
1415 | pr_err("alg: pcomp: decompression update failed on " | ||
1416 | "test %d for %s: error=%d\n", i + 1, algo, res); | ||
1417 | return res; | ||
1418 | } | ||
1419 | if (res > 0) | ||
1420 | produced += res; | ||
1421 | |||
1422 | /* Add remaining input data */ | ||
1423 | req.avail_in += (dtemplate[i].inlen + 1) / 2; | ||
1424 | |||
1425 | res = crypto_decompress_update(tfm, &req); | ||
1426 | if (res < 0 && (res != -EAGAIN || req.avail_in)) { | ||
1427 | pr_err("alg: pcomp: decompression update failed on " | ||
1428 | "test %d for %s: error=%d\n", i + 1, algo, res); | ||
1429 | return res; | ||
1430 | } | ||
1431 | if (res > 0) | ||
1432 | produced += res; | ||
1433 | |||
1434 | /* Provide remaining output space */ | ||
1435 | req.avail_out += COMP_BUF_SIZE - dtemplate[i].outlen / 2; | ||
1436 | |||
1437 | res = crypto_decompress_final(tfm, &req); | ||
1438 | if (res < 0 && (res != -EAGAIN || req.avail_in)) { | ||
1439 | pr_err("alg: pcomp: decompression final failed on " | ||
1440 | "test %d for %s: error=%d\n", i + 1, algo, res); | ||
1441 | return res; | ||
1442 | } | ||
1443 | if (res > 0) | ||
1444 | produced += res; | ||
1445 | |||
1446 | if (COMP_BUF_SIZE - req.avail_out != dtemplate[i].outlen) { | ||
1447 | pr_err("alg: comp: Decompression test %d failed for " | ||
1448 | "%s: output len = %d (expected %d)\n", i + 1, | ||
1449 | algo, COMP_BUF_SIZE - req.avail_out, | ||
1450 | dtemplate[i].outlen); | ||
1451 | return -EINVAL; | ||
1452 | } | ||
1453 | |||
1454 | if (produced != dtemplate[i].outlen) { | ||
1455 | pr_err("alg: comp: Decompression test %d failed for " | ||
1456 | "%s: returned len = %u (expected %d)\n", i + 1, | ||
1457 | algo, produced, dtemplate[i].outlen); | ||
1458 | return -EINVAL; | ||
1459 | } | ||
1460 | |||
1461 | if (memcmp(result, dtemplate[i].output, dtemplate[i].outlen)) { | ||
1462 | pr_err("alg: pcomp: Decompression test %d failed for " | ||
1463 | "%s\n", i + 1, algo); | ||
1464 | hexdump(result, dtemplate[i].outlen); | ||
1465 | return -EINVAL; | ||
1466 | } | ||
1467 | } | ||
1468 | |||
1469 | return 0; | ||
1470 | } | ||
1471 | |||
1472 | |||
1473 | static int test_cprng(struct crypto_rng *tfm, struct cprng_testvec *template, | 1288 | static int test_cprng(struct crypto_rng *tfm, struct cprng_testvec *template, |
1474 | unsigned int tcount) | 1289 | unsigned int tcount) |
1475 | { | 1290 | { |
@@ -1640,28 +1455,6 @@ static int alg_test_comp(const struct alg_test_desc *desc, const char *driver, | |||
1640 | return err; | 1455 | return err; |
1641 | } | 1456 | } |
1642 | 1457 | ||
1643 | static int alg_test_pcomp(const struct alg_test_desc *desc, const char *driver, | ||
1644 | u32 type, u32 mask) | ||
1645 | { | ||
1646 | struct crypto_pcomp *tfm; | ||
1647 | int err; | ||
1648 | |||
1649 | tfm = crypto_alloc_pcomp(driver, type, mask); | ||
1650 | if (IS_ERR(tfm)) { | ||
1651 | pr_err("alg: pcomp: Failed to load transform for %s: %ld\n", | ||
1652 | driver, PTR_ERR(tfm)); | ||
1653 | return PTR_ERR(tfm); | ||
1654 | } | ||
1655 | |||
1656 | err = test_pcomp(tfm, desc->suite.pcomp.comp.vecs, | ||
1657 | desc->suite.pcomp.decomp.vecs, | ||
1658 | desc->suite.pcomp.comp.count, | ||
1659 | desc->suite.pcomp.decomp.count); | ||
1660 | |||
1661 | crypto_free_pcomp(tfm); | ||
1662 | return err; | ||
1663 | } | ||
1664 | |||
1665 | static int alg_test_hash(const struct alg_test_desc *desc, const char *driver, | 1458 | static int alg_test_hash(const struct alg_test_desc *desc, const char *driver, |
1666 | u32 type, u32 mask) | 1459 | u32 type, u32 mask) |
1667 | { | 1460 | { |
@@ -3839,22 +3632,6 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
3839 | } | 3632 | } |
3840 | } | 3633 | } |
3841 | } | 3634 | } |
3842 | }, { | ||
3843 | .alg = "zlib", | ||
3844 | .test = alg_test_pcomp, | ||
3845 | .fips_allowed = 1, | ||
3846 | .suite = { | ||
3847 | .pcomp = { | ||
3848 | .comp = { | ||
3849 | .vecs = zlib_comp_tv_template, | ||
3850 | .count = ZLIB_COMP_TEST_VECTORS | ||
3851 | }, | ||
3852 | .decomp = { | ||
3853 | .vecs = zlib_decomp_tv_template, | ||
3854 | .count = ZLIB_DECOMP_TEST_VECTORS | ||
3855 | } | ||
3856 | } | ||
3857 | } | ||
3858 | } | 3635 | } |
3859 | }; | 3636 | }; |
3860 | 3637 | ||