Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: testmgr - add test for lz4 and lz4hc

This patch adds a simple test vector for the lz4 and lz4hc compression
algorithms.

Signed-off-by: KOVACS Krisztian <hidden@sch.bme.hu>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

KOVACS Krisztian and committed by
Herbert Xu
1443cc9b d801ab20

+98
+32
crypto/testmgr.c
··· 3177 3177 } 3178 3178 } 3179 3179 }, { 3180 + .alg = "lz4", 3181 + .test = alg_test_comp, 3182 + .fips_allowed = 1, 3183 + .suite = { 3184 + .comp = { 3185 + .comp = { 3186 + .vecs = lz4_comp_tv_template, 3187 + .count = LZ4_COMP_TEST_VECTORS 3188 + }, 3189 + .decomp = { 3190 + .vecs = lz4_decomp_tv_template, 3191 + .count = LZ4_DECOMP_TEST_VECTORS 3192 + } 3193 + } 3194 + } 3195 + }, { 3196 + .alg = "lz4hc", 3197 + .test = alg_test_comp, 3198 + .fips_allowed = 1, 3199 + .suite = { 3200 + .comp = { 3201 + .comp = { 3202 + .vecs = lz4hc_comp_tv_template, 3203 + .count = LZ4HC_COMP_TEST_VECTORS 3204 + }, 3205 + .decomp = { 3206 + .vecs = lz4hc_decomp_tv_template, 3207 + .count = LZ4HC_DECOMP_TEST_VECTORS 3208 + } 3209 + } 3210 + } 3211 + }, { 3180 3212 .alg = "lzo", 3181 3213 .test = alg_test_comp, 3182 3214 .fips_allowed = 1,
+66
crypto/testmgr.h
··· 29473 29473 29474 29474 }; 29475 29475 29476 + #define LZ4_COMP_TEST_VECTORS 1 29477 + #define LZ4_DECOMP_TEST_VECTORS 1 29478 + 29479 + static struct comp_testvec lz4_comp_tv_template[] = { 29480 + { 29481 + .inlen = 70, 29482 + .outlen = 45, 29483 + .input = "Join us now and share the software " 29484 + "Join us now and share the software ", 29485 + .output = "\xf0\x10\x4a\x6f\x69\x6e\x20\x75" 29486 + "\x73\x20\x6e\x6f\x77\x20\x61\x6e" 29487 + "\x64\x20\x73\x68\x61\x72\x65\x20" 29488 + "\x74\x68\x65\x20\x73\x6f\x66\x74" 29489 + "\x77\x0d\x00\x0f\x23\x00\x0b\x50" 29490 + "\x77\x61\x72\x65\x20", 29491 + }, 29492 + }; 29493 + 29494 + static struct comp_testvec lz4_decomp_tv_template[] = { 29495 + { 29496 + .inlen = 45, 29497 + .outlen = 70, 29498 + .input = "\xf0\x10\x4a\x6f\x69\x6e\x20\x75" 29499 + "\x73\x20\x6e\x6f\x77\x20\x61\x6e" 29500 + "\x64\x20\x73\x68\x61\x72\x65\x20" 29501 + "\x74\x68\x65\x20\x73\x6f\x66\x74" 29502 + "\x77\x0d\x00\x0f\x23\x00\x0b\x50" 29503 + "\x77\x61\x72\x65\x20", 29504 + .output = "Join us now and share the software " 29505 + "Join us now and share the software ", 29506 + }, 29507 + }; 29508 + 29509 + #define LZ4HC_COMP_TEST_VECTORS 1 29510 + #define LZ4HC_DECOMP_TEST_VECTORS 1 29511 + 29512 + static struct comp_testvec lz4hc_comp_tv_template[] = { 29513 + { 29514 + .inlen = 70, 29515 + .outlen = 45, 29516 + .input = "Join us now and share the software " 29517 + "Join us now and share the software ", 29518 + .output = "\xf0\x10\x4a\x6f\x69\x6e\x20\x75" 29519 + "\x73\x20\x6e\x6f\x77\x20\x61\x6e" 29520 + "\x64\x20\x73\x68\x61\x72\x65\x20" 29521 + "\x74\x68\x65\x20\x73\x6f\x66\x74" 29522 + "\x77\x0d\x00\x0f\x23\x00\x0b\x50" 29523 + "\x77\x61\x72\x65\x20", 29524 + }, 29525 + }; 29526 + 29527 + static struct comp_testvec lz4hc_decomp_tv_template[] = { 29528 + { 29529 + .inlen = 45, 29530 + .outlen = 70, 29531 + .input = "\xf0\x10\x4a\x6f\x69\x6e\x20\x75" 29532 + "\x73\x20\x6e\x6f\x77\x20\x61\x6e" 29533 + "\x64\x20\x73\x68\x61\x72\x65\x20" 29534 + "\x74\x68\x65\x20\x73\x6f\x66\x74" 29535 + "\x77\x0d\x00\x0f\x23\x00\x0b\x50" 29536 + "\x77\x61\x72\x65\x20", 29537 + .output = "Join us now and share the software " 29538 + "Join us now and share the software ", 29539 + }, 29540 + }; 29541 + 29476 29542 #endif /* _CRYPTO_TESTMGR_H */