Skip to content

Commit

Permalink
Revert Test "STASH: Modify to use default standard lz4 moduleset"
Browse files Browse the repository at this point in the history
This reverts commit ca71b8b.
  • Loading branch information
naups committed Dec 16, 2023
1 parent ca71b8b commit 9a8a18a
Show file tree
Hide file tree
Showing 10 changed files with 1,830 additions and 1,183 deletions.
21 changes: 8 additions & 13 deletions crypto/lz4.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,31 +49,26 @@ static int lz4_compress_crypto(struct crypto_tfm *tfm, const u8 *src,
unsigned int slen, u8 *dst, unsigned int *dlen)
{
struct lz4_ctx *ctx = crypto_tfm_ctx(tfm);
size_t tmp_len = *dlen;
int err;
int out_len = LZ4_compress_default(src, dst,
slen, *dlen, ctx->lz4_comp_mem);

err = lz4_compress(src, slen, dst, &tmp_len, ctx->lz4_comp_mem);

if (err < 0)
if (!out_len)
return -EINVAL;

*dlen = tmp_len;
*dlen = out_len;
return 0;
}

static int lz4_decompress_crypto(struct crypto_tfm *tfm, const u8 *src,
unsigned int slen, u8 *dst, unsigned int *dlen)
{
int err;
size_t tmp_len = *dlen;
size_t __slen = slen;
int out_len = LZ4_decompress_safe(src, dst, slen, *dlen);

err = lz4_decompress_unknownoutputsize(src, __slen, dst, &tmp_len);
if (err < 0)
if (out_len < 0)
return -EINVAL;

*dlen = tmp_len;
return err;
*dlen = out_len;
return 0;
}

static struct crypto_alg alg_lz4 = {
Expand Down
21 changes: 8 additions & 13 deletions crypto/lz4hc.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,31 +49,26 @@ static int lz4hc_compress_crypto(struct crypto_tfm *tfm, const u8 *src,
unsigned int slen, u8 *dst, unsigned int *dlen)
{
struct lz4hc_ctx *ctx = crypto_tfm_ctx(tfm);
size_t tmp_len = *dlen;
int err;
int out_len = LZ4_compress_HC(src, dst, slen,
*dlen, LZ4HC_DEFAULT_CLEVEL, ctx->lz4hc_comp_mem);

err = lz4hc_compress(src, slen, dst, &tmp_len, ctx->lz4hc_comp_mem);

if (err < 0)
if (!out_len)
return -EINVAL;

*dlen = tmp_len;
*dlen = out_len;
return 0;
}

static int lz4hc_decompress_crypto(struct crypto_tfm *tfm, const u8 *src,
unsigned int slen, u8 *dst, unsigned int *dlen)
{
int err;
size_t tmp_len = *dlen;
size_t __slen = slen;
int out_len = LZ4_decompress_safe(src, dst, slen, *dlen);

err = lz4_decompress_unknownoutputsize(src, __slen, dst, &tmp_len);
if (err < 0)
if (out_len < 0)
return -EINVAL;

*dlen = tmp_len;
return err;
*dlen = out_len;
return 0;
}

static struct crypto_alg alg_lz4hc = {
Expand Down
142 changes: 102 additions & 40 deletions crypto/testmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -37859,31 +37859,62 @@ static struct hash_testvec bfin_crc_tv_template[] = {

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",
.inlen = 255,
.outlen = 218,
.input = "LZ4 is lossless compression algorithm, providing"
" compression speed at 400 MB/s per core, scalable "
"with multi-cores CPU. It features an extremely fast "
"decoder, with speed in multiple GB/s per core, "
"typically reaching RAM speed limits on multi-core "
"systems.",
.output = "\xf9\x21\x4c\x5a\x34\x20\x69\x73\x20\x6c\x6f\x73\x73"
"\x6c\x65\x73\x73\x20\x63\x6f\x6d\x70\x72\x65\x73\x73"
"\x69\x6f\x6e\x20\x61\x6c\x67\x6f\x72\x69\x74\x68\x6d"
"\x2c\x20\x70\x72\x6f\x76\x69\x64\x69\x6e\x67\x21\x00"
"\xf0\x21\x73\x70\x65\x65\x64\x20\x61\x74\x20\x34\x30"
"\x30\x20\x4d\x42\x2f\x73\x20\x70\x65\x72\x20\x63\x6f"
"\x72\x65\x2c\x20\x73\x63\x61\x6c\x61\x62\x6c\x65\x20"
"\x77\x69\x74\x68\x20\x6d\x75\x6c\x74\x69\x2d\x1a\x00"
"\xf0\x00\x73\x20\x43\x50\x55\x2e\x20\x49\x74\x20\x66"
"\x65\x61\x74\x75\x11\x00\xf2\x0b\x61\x6e\x20\x65\x78"
"\x74\x72\x65\x6d\x65\x6c\x79\x20\x66\x61\x73\x74\x20"
"\x64\x65\x63\x6f\x64\x65\x72\x2c\x3d\x00\x02\x67\x00"
"\x22\x69\x6e\x46\x00\x5a\x70\x6c\x65\x20\x47\x6c\x00"
"\xf0\x00\x74\x79\x70\x69\x63\x61\x6c\x6c\x79\x20\x72"
"\x65\x61\x63\x68\xa7\x00\x33\x52\x41\x4d\x38\x00\x83"
"\x6c\x69\x6d\x69\x74\x73\x20\x6f\x3f\x00\x01\x85\x00"
"\x90\x20\x73\x79\x73\x74\x65\x6d\x73\x2e",

},
};

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 ",
.inlen = 218,
.outlen = 255,
.input = "\xf9\x21\x4c\x5a\x34\x20\x69\x73\x20\x6c\x6f\x73\x73"
"\x6c\x65\x73\x73\x20\x63\x6f\x6d\x70\x72\x65\x73\x73"
"\x69\x6f\x6e\x20\x61\x6c\x67\x6f\x72\x69\x74\x68\x6d"
"\x2c\x20\x70\x72\x6f\x76\x69\x64\x69\x6e\x67\x21\x00"
"\xf0\x21\x73\x70\x65\x65\x64\x20\x61\x74\x20\x34\x30"
"\x30\x20\x4d\x42\x2f\x73\x20\x70\x65\x72\x20\x63\x6f"
"\x72\x65\x2c\x20\x73\x63\x61\x6c\x61\x62\x6c\x65\x20"
"\x77\x69\x74\x68\x20\x6d\x75\x6c\x74\x69\x2d\x1a\x00"
"\xf0\x00\x73\x20\x43\x50\x55\x2e\x20\x49\x74\x20\x66"
"\x65\x61\x74\x75\x11\x00\xf2\x0b\x61\x6e\x20\x65\x78"
"\x74\x72\x65\x6d\x65\x6c\x79\x20\x66\x61\x73\x74\x20"
"\x64\x65\x63\x6f\x64\x65\x72\x2c\x3d\x00\x02\x67\x00"
"\x22\x69\x6e\x46\x00\x5a\x70\x6c\x65\x20\x47\x6c\x00"
"\xf0\x00\x74\x79\x70\x69\x63\x61\x6c\x6c\x79\x20\x72"
"\x65\x61\x63\x68\xa7\x00\x33\x52\x41\x4d\x38\x00\x83"
"\x6c\x69\x6d\x69\x74\x73\x20\x6f\x3f\x00\x01\x85\x00"
"\x90\x20\x73\x79\x73\x74\x65\x6d\x73\x2e",
.output = "LZ4 is lossless compression algorithm, providing"
" compression speed at 400 MB/s per core, scalable "
"with multi-cores CPU. It features an extremely fast "
"decoder, with speed in multiple GB/s per core, "
"typically reaching RAM speed limits on multi-core "
"systems.",
},
};

Expand All @@ -37892,31 +37923,62 @@ static struct comp_testvec lz4_decomp_tv_template[] = {

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",
.inlen = 255,
.outlen = 216,
.input = "LZ4 is lossless compression algorithm, providing"
" compression speed at 400 MB/s per core, scalable "
"with multi-cores CPU. It features an extremely fast "
"decoder, with speed in multiple GB/s per core, "
"typically reaching RAM speed limits on multi-core "
"systems.",
.output = "\xf9\x21\x4c\x5a\x34\x20\x69\x73\x20\x6c\x6f\x73\x73"
"\x6c\x65\x73\x73\x20\x63\x6f\x6d\x70\x72\x65\x73\x73"
"\x69\x6f\x6e\x20\x61\x6c\x67\x6f\x72\x69\x74\x68\x6d"
"\x2c\x20\x70\x72\x6f\x76\x69\x64\x69\x6e\x67\x21\x00"
"\xf0\x21\x73\x70\x65\x65\x64\x20\x61\x74\x20\x34\x30"
"\x30\x20\x4d\x42\x2f\x73\x20\x70\x65\x72\x20\x63\x6f"
"\x72\x65\x2c\x20\x73\x63\x61\x6c\x61\x62\x6c\x65\x20"
"\x77\x69\x74\x68\x20\x6d\x75\x6c\x74\x69\x2d\x1a\x00"
"\xf0\x00\x73\x20\x43\x50\x55\x2e\x20\x49\x74\x20\x66"
"\x65\x61\x74\x75\x11\x00\xf2\x0b\x61\x6e\x20\x65\x78"
"\x74\x72\x65\x6d\x65\x6c\x79\x20\x66\x61\x73\x74\x20"
"\x64\x65\x63\x6f\x64\x65\x72\x2c\x3d\x00\x02\x67\x00"
"\x22\x69\x6e\x46\x00\x5a\x70\x6c\x65\x20\x47\x6c\x00"
"\xf0\x00\x74\x79\x70\x69\x63\x61\x6c\x6c\x79\x20\x72"
"\x65\x61\x63\x68\xa7\x00\x33\x52\x41\x4d\x38\x00\x97"
"\x6c\x69\x6d\x69\x74\x73\x20\x6f\x6e\x85\x00\x90\x20"
"\x73\x79\x73\x74\x65\x6d\x73\x2e",

},
};

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 ",
.inlen = 216,
.outlen = 255,
.input = "\xf9\x21\x4c\x5a\x34\x20\x69\x73\x20\x6c\x6f\x73\x73"
"\x6c\x65\x73\x73\x20\x63\x6f\x6d\x70\x72\x65\x73\x73"
"\x69\x6f\x6e\x20\x61\x6c\x67\x6f\x72\x69\x74\x68\x6d"
"\x2c\x20\x70\x72\x6f\x76\x69\x64\x69\x6e\x67\x21\x00"
"\xf0\x21\x73\x70\x65\x65\x64\x20\x61\x74\x20\x34\x30"
"\x30\x20\x4d\x42\x2f\x73\x20\x70\x65\x72\x20\x63\x6f"
"\x72\x65\x2c\x20\x73\x63\x61\x6c\x61\x62\x6c\x65\x20"
"\x77\x69\x74\x68\x20\x6d\x75\x6c\x74\x69\x2d\x1a\x00"
"\xf0\x00\x73\x20\x43\x50\x55\x2e\x20\x49\x74\x20\x66"
"\x65\x61\x74\x75\x11\x00\xf2\x0b\x61\x6e\x20\x65\x78"
"\x74\x72\x65\x6d\x65\x6c\x79\x20\x66\x61\x73\x74\x20"
"\x64\x65\x63\x6f\x64\x65\x72\x2c\x3d\x00\x02\x67\x00"
"\x22\x69\x6e\x46\x00\x5a\x70\x6c\x65\x20\x47\x6c\x00"
"\xf0\x00\x74\x79\x70\x69\x63\x61\x6c\x6c\x79\x20\x72"
"\x65\x61\x63\x68\xa7\x00\x33\x52\x41\x4d\x38\x00\x97"
"\x6c\x69\x6d\x69\x74\x73\x20\x6f\x6e\x85\x00\x90\x20"
"\x73\x79\x73\x74\x65\x6d\x73\x2e",
.output = "LZ4 is lossless compression algorithm, providing"
" compression speed at 400 MB/s per core, scalable "
"with multi-cores CPU. It features an extremely fast "
"decoder, with speed in multiple GB/s per core, "
"typically reaching RAM speed limits on multi-core "
"systems.",
},
};

Expand Down
Loading

0 comments on commit 9a8a18a

Please sign in to comment.