Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1443cc9b authored by KOVACS Krisztian's avatar KOVACS Krisztian Committed by Herbert Xu
Browse files

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: default avatarKOVACS Krisztian <hidden@sch.bme.hu>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent d801ab20
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
@@ -3176,6 +3176,38 @@ static const struct alg_test_desc alg_test_descs[] = {
				}
			}
		}
	}, {
		.alg = "lz4",
		.test = alg_test_comp,
		.fips_allowed = 1,
		.suite = {
			.comp = {
				.comp = {
					.vecs = lz4_comp_tv_template,
					.count = LZ4_COMP_TEST_VECTORS
				},
				.decomp = {
					.vecs = lz4_decomp_tv_template,
					.count = LZ4_DECOMP_TEST_VECTORS
				}
			}
		}
	}, {
		.alg = "lz4hc",
		.test = alg_test_comp,
		.fips_allowed = 1,
		.suite = {
			.comp = {
				.comp = {
					.vecs = lz4hc_comp_tv_template,
					.count = LZ4HC_COMP_TEST_VECTORS
				},
				.decomp = {
					.vecs = lz4hc_decomp_tv_template,
					.count = LZ4HC_DECOMP_TEST_VECTORS
				}
			}
		}
	}, {
		.alg = "lzo",
		.test = alg_test_comp,
+66 −0
Original line number Diff line number Diff line
@@ -29473,4 +29473,70 @@ static struct hash_testvec bfin_crc_tv_template[] = {
};
#define LZ4_COMP_TEST_VECTORS 1
#define LZ4_DECOMP_TEST_VECTORS 1
static struct comp_testvec lz4_comp_tv_template[] = {
	{
		.inlen	= 70,
		.outlen	= 45,
		.input	= "Join us now and share the software "
			  "Join us now and share the software ",
		.output = "\xf0\x10\x4a\x6f\x69\x6e\x20\x75"
			  "\x73\x20\x6e\x6f\x77\x20\x61\x6e"
			  "\x64\x20\x73\x68\x61\x72\x65\x20"
			  "\x74\x68\x65\x20\x73\x6f\x66\x74"
			  "\x77\x0d\x00\x0f\x23\x00\x0b\x50"
			  "\x77\x61\x72\x65\x20",
	},
};
static struct comp_testvec lz4_decomp_tv_template[] = {
	{
		.inlen	= 45,
		.outlen	= 70,
		.input  = "\xf0\x10\x4a\x6f\x69\x6e\x20\x75"
			  "\x73\x20\x6e\x6f\x77\x20\x61\x6e"
			  "\x64\x20\x73\x68\x61\x72\x65\x20"
			  "\x74\x68\x65\x20\x73\x6f\x66\x74"
			  "\x77\x0d\x00\x0f\x23\x00\x0b\x50"
			  "\x77\x61\x72\x65\x20",
		.output	= "Join us now and share the software "
			  "Join us now and share the software ",
	},
};
#define LZ4HC_COMP_TEST_VECTORS 1
#define LZ4HC_DECOMP_TEST_VECTORS 1
static struct comp_testvec lz4hc_comp_tv_template[] = {
	{
		.inlen	= 70,
		.outlen	= 45,
		.input	= "Join us now and share the software "
			  "Join us now and share the software ",
		.output = "\xf0\x10\x4a\x6f\x69\x6e\x20\x75"
			  "\x73\x20\x6e\x6f\x77\x20\x61\x6e"
			  "\x64\x20\x73\x68\x61\x72\x65\x20"
			  "\x74\x68\x65\x20\x73\x6f\x66\x74"
			  "\x77\x0d\x00\x0f\x23\x00\x0b\x50"
			  "\x77\x61\x72\x65\x20",
	},
};
static struct comp_testvec lz4hc_decomp_tv_template[] = {
	{
		.inlen	= 45,
		.outlen	= 70,
		.input  = "\xf0\x10\x4a\x6f\x69\x6e\x20\x75"
			  "\x73\x20\x6e\x6f\x77\x20\x61\x6e"
			  "\x64\x20\x73\x68\x61\x72\x65\x20"
			  "\x74\x68\x65\x20\x73\x6f\x66\x74"
			  "\x77\x0d\x00\x0f\x23\x00\x0b\x50"
			  "\x77\x61\x72\x65\x20",
		.output	= "Join us now and share the software "
			  "Join us now and share the software ",
	},
};
#endif	/* _CRYPTO_TESTMGR_H */