diff options
Diffstat (limited to 'crypto/testmgr.h')
-rw-r--r-- | crypto/testmgr.h | 147 |
1 files changed, 147 insertions, 0 deletions
diff --git a/crypto/testmgr.h b/crypto/testmgr.h index 132953e144d3..526f00a9c72f 100644 --- a/crypto/testmgr.h +++ b/crypto/testmgr.h | |||
@@ -15,6 +15,11 @@ | |||
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 | |||
21 | #include <crypto/compress.h> | ||
22 | |||
18 | #define MAX_DIGEST_SIZE 64 | 23 | #define MAX_DIGEST_SIZE 64 |
19 | #define MAX_TAP 8 | 24 | #define MAX_TAP 8 |
20 | 25 | ||
@@ -8347,10 +8352,19 @@ struct comp_testvec { | |||
8347 | char output[COMP_BUF_SIZE]; | 8352 | char output[COMP_BUF_SIZE]; |
8348 | }; | 8353 | }; |
8349 | 8354 | ||
8355 | struct pcomp_testvec { | ||
8356 | void *params; | ||
8357 | unsigned int paramsize; | ||
8358 | int inlen, outlen; | ||
8359 | char input[COMP_BUF_SIZE]; | ||
8360 | char output[COMP_BUF_SIZE]; | ||
8361 | }; | ||
8362 | |||
8350 | /* | 8363 | /* |
8351 | * Deflate test vectors (null-terminated strings). | 8364 | * Deflate test vectors (null-terminated strings). |
8352 | * Params: winbits=-11, Z_DEFAULT_COMPRESSION, MAX_MEM_LEVEL. | 8365 | * Params: winbits=-11, Z_DEFAULT_COMPRESSION, MAX_MEM_LEVEL. |
8353 | */ | 8366 | */ |
8367 | |||
8354 | #define DEFLATE_COMP_TEST_VECTORS 2 | 8368 | #define DEFLATE_COMP_TEST_VECTORS 2 |
8355 | #define DEFLATE_DECOMP_TEST_VECTORS 2 | 8369 | #define DEFLATE_DECOMP_TEST_VECTORS 2 |
8356 | 8370 | ||
@@ -8426,6 +8440,139 @@ static struct comp_testvec deflate_decomp_tv_template[] = { | |||
8426 | }, | 8440 | }, |
8427 | }; | 8441 | }; |
8428 | 8442 | ||
8443 | #define ZLIB_COMP_TEST_VECTORS 2 | ||
8444 | #define ZLIB_DECOMP_TEST_VECTORS 2 | ||
8445 | |||
8446 | static 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 | |||
8483 | static 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 | |||
8496 | static 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 | |||
8536 | static 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 | |||
8429 | /* | 8576 | /* |
8430 | * LZO test vectors (null-terminated strings). | 8577 | * LZO test vectors (null-terminated strings). |
8431 | */ | 8578 | */ |