mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
crypto: change LZ4 modules to work with new LZ4 module version
Update the crypto modules using LZ4 compression as well as the test cases in testmgr.h to work with the new LZ4 module version. Link: http://lkml.kernel.org/r/1486321748-19085-4-git-send-email-4sschmid@informatik.uni-hamburg.de Signed-off-by: Sven Schmidt <[email protected]> Cc: Bongkyu Kim <[email protected]> Cc: Rui Salvaterra <[email protected]> Cc: Sergey Senozhatsky <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Herbert Xu <[email protected]> Cc: David S. Miller <[email protected]> Cc: Anton Vorontsov <[email protected]> Cc: Colin Cross <[email protected]> Cc: Kees Cook <[email protected]> Cc: Tony Luck <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
e23d54e483
commit
73a15ac6d5
3 changed files with 120 additions and 68 deletions
23
crypto/lz4.c
23
crypto/lz4.c
|
|
@ -66,15 +66,13 @@ static void lz4_exit(struct crypto_tfm *tfm)
|
|||
static int __lz4_compress_crypto(const u8 *src, unsigned int slen,
|
||||
u8 *dst, unsigned int *dlen, void *ctx)
|
||||
{
|
||||
size_t tmp_len = *dlen;
|
||||
int err;
|
||||
int out_len = LZ4_compress_default(src, dst,
|
||||
slen, *dlen, ctx);
|
||||
|
||||
err = lz4_compress(src, slen, dst, &tmp_len, ctx);
|
||||
|
||||
if (err < 0)
|
||||
if (!out_len)
|
||||
return -EINVAL;
|
||||
|
||||
*dlen = tmp_len;
|
||||
*dlen = out_len;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -96,16 +94,13 @@ static int lz4_compress_crypto(struct crypto_tfm *tfm, const u8 *src,
|
|||
static int __lz4_decompress_crypto(const u8 *src, unsigned int slen,
|
||||
u8 *dst, unsigned int *dlen, void *ctx)
|
||||
{
|
||||
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)
|
||||
return -EINVAL;
|
||||
if (out_len < 0)
|
||||
return out_len;
|
||||
|
||||
*dlen = tmp_len;
|
||||
return err;
|
||||
*dlen = out_len;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lz4_sdecompress(struct crypto_scomp *tfm, const u8 *src,
|
||||
|
|
|
|||
Loading…
Reference in a new issue