X-Git-Url: https://git.kernelconcepts.de/?a=blobdiff_plain;f=lib%2F842%2F842_compress.c;h=4051339bdfbda6e6869d7f7c669672ba65f3d3f1;hb=ea0b3984c1cc8b28de27a3bec285102b4e366a4c;hp=7ce68948e68c84d41c796c70a726895e65c68d78;hpb=8688d9540cc6e17df4cba71615e27f04e0378fe6;p=karo-tx-linux.git diff --git a/lib/842/842_compress.c b/lib/842/842_compress.c index 7ce68948e68c..4051339bdfbd 100644 --- a/lib/842/842_compress.c +++ b/lib/842/842_compress.c @@ -490,6 +490,7 @@ int sw842_compress(const u8 *in, unsigned int ilen, int ret; u64 last, next, pad, total; u8 repeat_count = 0; + u32 crc; BUILD_BUG_ON(sizeof(*p) > SW842_MEM_COMPRESS); @@ -580,6 +581,18 @@ skip_comp: if (ret) return ret; + /* + * crc(0:31) is appended to target data starting with the next + * bit after End of stream template. + * nx842 calculates CRC for data in big-endian format. So doing + * same here so that sw842 decompression can be used for both + * compressed data. + */ + crc = crc32_be(0, in, ilen); + ret = add_bits(p, crc, CRC_BITS); + if (ret) + return ret; + if (p->bit) { p->out++; p->olen--;