aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/testmgr.h
diff options
context:
space:
mode:
authorGeert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>2009-03-04 02:42:15 -0500
committerHerbert Xu <herbert@gondor.apana.org.au>2009-03-04 02:42:15 -0500
commit0c01aed50d4844f54f59e875e05d211e80874464 (patch)
treeaa80b318c637bce768ff0f659c2affacd410e3ae /crypto/testmgr.h
parentbf68e65ec9ea61e32ab71bef59aa5d24d255241f (diff)
crypto: testmgr - add zlib test
Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/testmgr.h')
-rw-r--r--crypto/testmgr.h137
1 files changed, 137 insertions, 0 deletions
diff --git a/crypto/testmgr.h b/crypto/testmgr.h
index c517e43cfc88..526f00a9c72f 100644
--- a/crypto/testmgr.h
+++ b/crypto/testmgr.h
@@ -15,6 +15,9 @@
15#ifndef _CRYPTO_TESTMGR_H 15#ifndef _CRYPTO_TESTMGR_H
16#define _CRYPTO_TESTMGR_H 16#define _CRYPTO_TESTMGR_H
17 17
18#include <linux/netlink.h>
19#include <linux/zlib.h>
20
18#include <crypto/compress.h> 21#include <crypto/compress.h>
19 22
20#define MAX_DIGEST_SIZE 64 23#define MAX_DIGEST_SIZE 64
@@ -8361,6 +8364,7 @@ struct pcomp_testvec {
8361 * Deflate test vectors (null-terminated strings). 8364 * Deflate test vectors (null-terminated strings).
8362 * Params: winbits=-11, Z_DEFAULT_COMPRESSION, MAX_MEM_LEVEL. 8365 * Params: winbits=-11, Z_DEFAULT_COMPRESSION, MAX_MEM_LEVEL.
8363 */ 8366 */
8367
8364#define DEFLATE_COMP_TEST_VECTORS 2 8368#define DEFLATE_COMP_TEST_VECTORS 2
8365#define DEFLATE_DECOMP_TEST_VECTORS 2 8369#define DEFLATE_DECOMP_TEST_VECTORS 2
8366 8370
@@ -8436,6 +8440,139 @@ static struct comp_testvec deflate_decomp_tv_template[] = {
8436 }, 8440 },
8437}; 8441};
8438 8442
8443#define ZLIB_COMP_TEST_VECTORS 2
8444#define ZLIB_DECOMP_TEST_VECTORS 2
8445
8446static const struct {
8447 struct nlattr nla;
8448 int val;
8449} deflate_comp_params[] = {
8450 {
8451 .nla = {
8452 .nla_len = NLA_HDRLEN + sizeof(int),
8453 .nla_type = ZLIB_COMP_LEVEL,
8454 },
8455 .val = Z_DEFAULT_COMPRESSION,
8456 }, {
8457 .nla = {
8458 .nla_len = NLA_HDRLEN + sizeof(int),
8459 .nla_type = ZLIB_COMP_METHOD,
8460 },
8461 .val = Z_DEFLATED,
8462 }, {
8463 .nla = {
8464 .nla_len = NLA_HDRLEN + sizeof(int),
8465 .nla_type = ZLIB_COMP_WINDOWBITS,
8466 },
8467 .val = -11,
8468 }, {
8469 .nla = {
8470 .nla_len = NLA_HDRLEN + sizeof(int),
8471 .nla_type = ZLIB_COMP_MEMLEVEL,
8472 },
8473 .val = MAX_MEM_LEVEL,
8474 }, {
8475 .nla = {
8476 .nla_len = NLA_HDRLEN + sizeof(int),
8477 .nla_type = ZLIB_COMP_STRATEGY,
8478 },
8479 .val = Z_DEFAULT_STRATEGY,
8480 }
8481};
8482
8483static const struct {
8484 struct nlattr nla;
8485 int val;
8486} deflate_decomp_params[] = {
8487 {
8488 .nla = {
8489 .nla_len = NLA_HDRLEN + sizeof(int),
8490 .nla_type = ZLIB_DECOMP_WINDOWBITS,
8491 },
8492 .val = -11,
8493 }
8494};
8495
8496static struct pcomp_testvec zlib_comp_tv_template[] = {
8497 {
8498 .params = &deflate_comp_params,
8499 .paramsize = sizeof(deflate_comp_params),
8500 .inlen = 70,
8501 .outlen = 38,
8502 .input = "Join us now and share the software "
8503 "Join us now and share the software ",
8504 .output = "\xf3\xca\xcf\xcc\x53\x28\x2d\x56"
8505 "\xc8\xcb\x2f\x57\x48\xcc\x4b\x51"
8506 "\x28\xce\x48\x2c\x4a\x55\x28\xc9"
8507 "\x48\x55\x28\xce\x4f\x2b\x29\x07"
8508 "\x71\xbc\x08\x2b\x01\x00",
8509 }, {
8510 .params = &deflate_comp_params,
8511 .paramsize = sizeof(deflate_comp_params),
8512 .inlen = 191,
8513 .outlen = 122,
8514 .input = "This document describes a compression method based on the DEFLATE"
8515 "compression algorithm. This document defines the application of "
8516 "the DEFLATE algorithm to the IP Payload Compression Protocol.",
8517 .output = "\x5d\x8d\x31\x0e\xc2\x30\x10\x04"
8518 "\xbf\xb2\x2f\xc8\x1f\x10\x04\x09"
8519 "\x89\xc2\x85\x3f\x70\xb1\x2f\xf8"
8520 "\x24\xdb\x67\xd9\x47\xc1\xef\x49"
8521 "\x68\x12\x51\xae\x76\x67\xd6\x27"
8522 "\x19\x88\x1a\xde\x85\xab\x21\xf2"
8523 "\x08\x5d\x16\x1e\x20\x04\x2d\xad"
8524 "\xf3\x18\xa2\x15\x85\x2d\x69\xc4"
8525 "\x42\x83\x23\xb6\x6c\x89\x71\x9b"
8526 "\xef\xcf\x8b\x9f\xcf\x33\xca\x2f"
8527 "\xed\x62\xa9\x4c\x80\xff\x13\xaf"
8528 "\x52\x37\xed\x0e\x52\x6b\x59\x02"
8529 "\xd9\x4e\xe8\x7a\x76\x1d\x02\x98"
8530 "\xfe\x8a\x87\x83\xa3\x4f\x56\x8a"
8531 "\xb8\x9e\x8e\x5c\x57\xd3\xa0\x79"
8532 "\xfa\x02",
8533 },
8534};
8535
8536static struct pcomp_testvec zlib_decomp_tv_template[] = {
8537 {
8538 .params = &deflate_decomp_params,
8539 .paramsize = sizeof(deflate_decomp_params),
8540 .inlen = 122,
8541 .outlen = 191,
8542 .input = "\x5d\x8d\x31\x0e\xc2\x30\x10\x04"
8543 "\xbf\xb2\x2f\xc8\x1f\x10\x04\x09"
8544 "\x89\xc2\x85\x3f\x70\xb1\x2f\xf8"
8545 "\x24\xdb\x67\xd9\x47\xc1\xef\x49"
8546 "\x68\x12\x51\xae\x76\x67\xd6\x27"
8547 "\x19\x88\x1a\xde\x85\xab\x21\xf2"
8548 "\x08\x5d\x16\x1e\x20\x04\x2d\xad"
8549 "\xf3\x18\xa2\x15\x85\x2d\x69\xc4"
8550 "\x42\x83\x23\xb6\x6c\x89\x71\x9b"
8551 "\xef\xcf\x8b\x9f\xcf\x33\xca\x2f"
8552 "\xed\x62\xa9\x4c\x80\xff\x13\xaf"
8553 "\x52\x37\xed\x0e\x52\x6b\x59\x02"
8554 "\xd9\x4e\xe8\x7a\x76\x1d\x02\x98"
8555 "\xfe\x8a\x87\x83\xa3\x4f\x56\x8a"
8556 "\xb8\x9e\x8e\x5c\x57\xd3\xa0\x79"
8557 "\xfa\x02",
8558 .output = "This document describes a compression method based on the DEFLATE"
8559 "compression algorithm. This document defines the application of "
8560 "the DEFLATE algorithm to the IP Payload Compression Protocol.",
8561 }, {
8562 .params = &deflate_decomp_params,
8563 .paramsize = sizeof(deflate_decomp_params),
8564 .inlen = 38,
8565 .outlen = 70,
8566 .input = "\xf3\xca\xcf\xcc\x53\x28\x2d\x56"
8567 "\xc8\xcb\x2f\x57\x48\xcc\x4b\x51"
8568 "\x28\xce\x48\x2c\x4a\x55\x28\xc9"
8569 "\x48\x55\x28\xce\x4f\x2b\x29\x07"
8570 "\x71\xbc\x08\x2b\x01\x00",
8571 .output = "Join us now and share the software "
8572 "Join us now and share the software ",
8573 },
8574};
8575
8439/* 8576/*
8440 * LZO test vectors (null-terminated strings). 8577 * LZO test vectors (null-terminated strings).
8441 */ 8578 */