Commit Graph

57 Commits

Author SHA1 Message Date
Marcel Cornu
55fbfabfc6 igzip: reformat using new code style
Signed-off-by: Marcel Cornu <marcel.d.cornu@intel.com>
2024-04-22 11:35:03 +02:00
Colin Ian King
1500db751d Fix a handful of spelling mistakes and typos
There are quite a few spelling mistakes and typos in comments and
user facing message literal strings as found using codespell. Fix
these.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2024-02-06 15:03:14 +00:00
Pablo de Lara
29d99fce26 igzip: add zlib header init function
Add isal_zlib_hdr_init() function to initialize
the isal_zlib_header structure to all 0.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2023-12-20 14:05:52 +00:00
Pablo de Lara
4203d9628c igzip: fix null-terminated string setting
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2023-12-07 13:34:21 +00:00
Pablo de Lara
e2acfbfe78 igzip: fix build warning
Fix the following build issue by initializing look_back_dist to 0.

igzip/igzip_inflate.c: In function ‘decode_huffman_code_block_stateless_base’:
igzip/igzip_inflate.c:1727:36:
 warning: ‘look_back_dist’ may be used uninitialized  [-Wmaybe-uninitialized]

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2023-11-15 13:46:52 +00:00
Greg Tucker
9f75defd57 Remove all slver legacy segments
The relic slver is no longer used for individual versioning
on functions and is confusing tools looking for data in text
sections. This removes all instances instead of fixing since
its usefulness is waining. Fixes #221

Change-Id: Ife0b9f105950a90337c58e8a41ac2cffc0f67d99
Signed-off-by: Greg Tucker <greg.b.tucker@intel.com>
2022-07-14 19:23:52 -07:00
Ilya Leoshkevich
d3cfb2fb77 Fix s390 build
The goal of this patch is to make isa-l testsuite pass on s390 with
minimal changes to the library. The one and only reason isa-l does not
work on s390 at the moment is that s390 is big-endian, and isa-l
assumes little-endian at a lot of places.

There are two flavors of this: loading/storing integers from/to
memory, and overlapping structs. Loads/stores are already helpfully
wrapped by unaligned.h header, so replace the functions there with
endianness-aware variants. Solve struct member overlap by reversing
their order on big-endian.

Also, fix a couple of usages of uninitialized memory in the testsuite
(found with MemorySanitizer).

Fixes s390x part of #188.

Change-Id: Iaf14a113bd266900192cc8b44212f8a47a8c7753
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
2022-01-04 11:06:17 -07:00
Greg Tucker
dca9dd221e igzip: Use unaligned load on static header to fix usan
Clang with sanitizer on was catching on cast of static header.
Switching to uload64 macro for better general solution.

Change-Id: I495d440407bb1773841e2f7cdc48bd95fc1a2df4
Signed-off-by: Greg Tucker <greg.b.tucker@intel.com>
2020-11-04 12:40:08 -07:00
Greg Tucker
d7927673ba igzip: Inflate detect pre-gen header and use pre-expanded
Performance improvement for inflate to skip the time-consuming process of decode
table expansion when the header matches a known common dymanic one such as
produced by level 0 compression.

Change-Id: Ia2550b812a062b7cc2eb1b72bcb609f1a631e40b
Signed-off-by: Greg Tucker <greg.b.tucker@intel.com>
2020-10-21 18:09:49 -07:00
Greg Tucker
93049d0d1f igzip: Fix read header for correct null checking and init
Issue with reading header only appears when combined with new feature in cli of
multiple concatenated gzip files.

Change-Id: Id8df9150c6f27d8b22e810b511291f3fcf136723
Signed-off-by: Greg Tucker <greg.b.tucker@intel.com>
2020-08-13 15:21:10 -07:00
Roy Oursler
aae6e29d28 igzip: Remove unaligned stores
Change-Id: I8d351c8b7153178d26d6fc702ee3036b71165b93
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
2019-03-07 09:27:50 -07:00
Roy Oursler
5be1ba2215 igzip: Remove undefined unaligned loads
Change-Id: I02591d958f8691d07b261218cf5ab361e8ad36c9
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
2019-03-07 09:27:50 -07:00
Roy Oursler
9689ba7e13 igzip: Remove igzip copy of crc32_gzip
Change-Id: I859ed904effa0a8bd7462b77b13e359014912639
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
2018-09-20 11:12:02 -07:00
Roy Oursler
c19657241a igzip: Setup optimized static header table to be default
Change-Id: Ia54682f7e1e321a26f941da8f884f385cfd42ad9
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
2018-09-20 11:12:02 -07:00
Roy Oursler
52d974762b igzip: Create precomputed static inflate_huff_code
Change-Id: I94a2de2b5e5bebc37e30f5d597a95c493da504c0
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
2018-09-20 11:12:02 -07:00
Roy Oursler
ff1928e8ec igzip: Create functions to write gzip/zlib headers
Change-Id: If5aaa277a01214bd36406ee11680df0904ad12f7
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
2018-09-20 11:12:02 -07:00
Roy Oursler
43374f6776 igzip: Implement gzip/zlib header/trailer parsing
Change-Id: I3fe8653f2286212a9d6c6ecfa3b78752b2cac8ef
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
2018-09-20 11:12:02 -07:00
Roy Oursler
11542000f0 igzip: Implement limited window size for inflate
Change-Id: Ib7fce6a51db99fc7e11f06f5916c2b755bfc5c67
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
2018-09-20 11:12:02 -07:00
Roy Oursler
995d420c6b igzip: Fix inflate for large output files
Change-Id: I3d3532100f8d60e0b446f5c90fc820cbfd2df1ec
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
2018-08-03 12:54:05 -07:00
Greg Tucker
d30b45ffbe igzip: Remove unused initialization in inflate expand huffcode
Change-Id: Ia9732fc4a2acc9990e3b2b77bc604f740ce6be30
Signed-off-by: Greg Tucker <greg.b.tucker@intel.com>
2018-06-21 14:39:08 -07:00
Roy Oursler
14ba3747b5 igzip: Optimize multibyte for small files
Change-Id: I8400e0be07da75fd549724147ab06aa71f7cc9df
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
2018-06-14 15:30:14 -07:00
Roy Oursler
5d6d9a21eb igzip: Optimize bit reverse
Change-Id: I45244b8c2f07fab0f237b11b92fa5f557aff878b
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
2018-06-14 15:30:14 -07:00
Roy Oursler
3732485914 igzip: Accept multiple inflate codes for matches of 258
Allow inflate to accept code 284 with extra bits 0x1f to be accepted
as a match of length 258. This matches zlib's behaviour.

Change-Id: Id85052ceea2b23d3db9c147672dd7996a4c66786
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
2018-06-14 15:30:14 -07:00
Roy Oursler
a61e035445 igzip: Improve inflate invalid block identification
Change-Id: I31ab9fa641e448c643ff4c6e606837c07ec2b14f
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
2018-06-14 15:30:14 -07:00
Roy Oursler
b3ddaff6c5 igzip: Create flag to determine maximum symbols decoded
Change-Id: I94c185bf10662931248ccae07aa5659626f1deb2
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
2018-06-14 15:30:14 -07:00
Roy Oursler
2de5a0fd88 igzip: Swap length code lookup with length lookup
Change-Id: I9f1c3ea5353f2c2fa98bab1d0cb1eb3c7b7397f6
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
2018-06-14 15:30:14 -07:00
Roy Oursler
ec6169ac3b igzip: Combine distance code and extra bit count lookup
Change-Id: I12dca7126313406afd6ccbbaa91e7a1cc4a91bc0
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
2018-06-14 15:30:14 -07:00
Roy Oursler
abd1963a22 igzip: Allow decoding symbol triples
Change-Id: I82e088b65a37adb1853ce2525dafafec06586a0f
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
2018-06-14 15:30:14 -07:00
Roy Oursler
bf4c2dab27 igzip: Allow decoding symbol pairs
Change-Id: I306404d7821cf4e43c28ae6477038b17a29b0c47
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
2018-06-14 15:30:14 -07:00
Roy Oursler
3d1b5b40d3 igzip: Rearrangement of make_inflate_huff_code
Change-Id: Ieff4a7c03827ff6a41b2e8e7316b239b94343c1a
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
2018-06-14 15:30:14 -07:00
Roy Oursler
222a68f760 igzip: Implement multibyte decode
Change-Id: I923a57a01f696f2082945fafcc2773655b9a5beb
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
2018-06-14 15:30:14 -07:00
Roy Oursler
7a1dc55c27 igzip: Increase size of large short code lookup
Change-Id: I05a564d1759ae417a966f3a12621799db0edf80a
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
2018-06-14 15:30:14 -07:00
Greg Tucker
a7fad4b9d2 igzip: Change a few conflicting functions to static
Signed-off-by: Greg Tucker <greg.b.tucker@intel.com>
2017-08-18 14:34:14 -07:00
Roy Oursler
48d7def5d9 igzip: Fix inflate total_out behavior to align with expected behavior
Modify total_out to be total data decompressed into user supplied buffers,
rather than to user supplied and internal buffers.

Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
2017-08-18 14:28:10 -07:00
Roy Oursler
34c341db35 igzip: Add reset functions for both deflate and inflate.
Change-Id: I8677a4365ac5c2343751660176f3b2eb4746ddfe
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
2017-06-26 04:14:44 -04:00
Roy Oursler
ed15402f5b igzip: Add stateful dictionary support
Change-Id: I75dbac947787bc0041674468c88d0aa41b8b082f
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
2017-06-26 04:11:48 -04:00
Greg Tucker
3025e83b91 igzip: Add avx2 optimized adler32 checksum
Change-Id: I019a38cf98836e3e6c7215a6914b85abb9399e33
Signed-off-by: Greg Tucker <greg.b.tucker@intel.com>
2017-06-26 03:56:49 -04:00
Roy Oursler
87652b4489 igzip: Modify inflate to optionally calculate adler32 hash
Change-Id: I314617b89b59d53608e464c7d2cf299faa3528b5
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
2017-06-21 05:42:12 -04:00
Greg Tucker
9d0fda20fd igzip: Add copyright notice
Signed-off-by: Greg Tucker <greg.b.tucker@intel.com>
2016-12-06 21:06:10 -07:00
Roy Oursler
dfa4fd0940 igzip: Fix inflate bug with long when invalid huffman codes.
Change-Id: I52bfed0afa208462ed4a8614dd46cda5a5dc968d
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
2016-12-06 16:18:32 -07:00
Roy Oursler
89fedafcc9 igzip: Fix make_huff_code_lookup_table initialization bug.
Change-Id: I192ce6c907271d52bfda5bf4be6d5b2a35a9d459
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
2016-12-06 16:17:17 -07:00
Roy Oursler
f0a39fea2a igzip: Fix make_inflate_huff_code bug causing out of bounds writes
Change-Id: I7dcdb22031cb7b506f76578ee6d080924d917476
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
2016-12-06 16:16:55 -07:00
Roy Oursler
600d887143 igzip: Fix bug in inflate when exactly one distance is coded
Initialize the lookup table so invalid lookups do not cause segfaults.

Change-Id: Ibb88c4c473fa233f8821c35b3e32ff62814c2b15
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
2016-12-06 13:59:04 -07:00
Roy Oursler
e569ff70e7 igzip: Create flag for inflate to return crc of the decompressed data
Change-Id: I2d966f2d4ca135e3c938a9501bf5d2e11d8e92fe
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
2016-12-06 11:16:34 -07:00
Roy Oursler
c17f2959d4 igzip: Fix bug read_header causing false error return values
Change-Id: I7b2fc0d7fa1ea78fab6c8788618d3e48ece56cfd
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
2016-12-06 09:12:11 -07:00
Roy Oursler
b95c60cd1b igzip: Add check for non-valid decoded symbols
Change-Id: Ie95c28ca87b76ba8751fa5b07be345d3b00d5134
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
2016-12-06 09:11:12 -07:00
Roy Oursler
fb62881057 igzip: Fix bugs in setup dynamic header when invalid input is supplied
Change-Id: I8df868e259397b289387ae7eb25d0805a22e33ea
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
2016-12-06 09:10:34 -07:00
Roy Oursler
8c5fa7010a igzip: Fix incorrect block_state for inflate_stateless
Change-Id: Id26b528dca540ac8e177af59f9ace797fbb0a752
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
2016-12-06 09:08:40 -07:00
Roy Oursler
e2b0640fd9 igzip: Make inline functions in igzip_inflate.c static
Make inline functions in igzip_inflate.c static to fix compiling issue on Mac.

Change-Id: Id4fdc0b8fe9ea9655bc3368bade579aebc8c2a72
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
2016-12-05 16:44:31 -07:00
Roy Oursler
88f95d8594 igzip: Merge inflate.h and igzip_lib.h and fix external naming
Merge inflate.h and igzip_lib.h and rename many defines to avoid conflicts,
along with general cleanup of the new header.

Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
Reviewed-by: Greg Tucker <greg.b.tucker@intel.com>
2016-12-05 16:40:43 -07:00