summaryrefslogtreecommitdiff
path: root/src/common/compress.c
AgeCommit message (Collapse)Author
2017-09-28Better error handling when trying to compress/decompress into empty buffer.Alexander Færøy
This patch ensures that we return TOR_COMPRESS_BUFFER_FULL in case we have a input bytes left to process, but are out of output buffer or in case we need to finish where the compression implementation might need to write an epilogue. See: https://bugs.torproject.org/23551
2017-06-20Merge branch 'bug22502_redux_031' into maint-0.3.1Nick Mathewson
2017-06-20Enforce the rule that COMPRESS_OK means progress was made.Nick Mathewson
If COMPRESS_OK occurs but data is neither consumed nor generated, treat it as a BUG and a COMPRESS_ERROR. This change is meant to prevent infinite loops in the case where we've made a mistake in one of our compression backends. Closes ticket 22672.
2017-06-20mingw/windows printf lacks %zd ; use %lu and casts insteadNick Mathewson
(This approach can lose accuracy, but it's only in debug-level messages.) Fixes windows compilation. Bugfix on recent compress.c changes; bug not in any released Tor.
2017-06-20Correct the fix to bug 22629 to permit trailing non-garbageNick Mathewson
This change makes it so that we can decompress concatenated zstd outputs.
2017-06-16Add extra logging during compression and decompressionteor
This helps diagnose failures. Part of #22502.
2017-06-16Check for trailing input garbage in tor_compress_impl() when decompressingteor
Fixes #22629.
2017-06-16Check if tor_compress_new() returns NULL in tor_compress_impl()teor
Partial fix to 22626.
2017-05-12Add API for getting human readable descriptions of a compress_method_tAlexander Færøy
See: https://bugs.torproject.org/21667
2017-05-02Merge branch 'compress_none_v2_squashed'Nick Mathewson
2017-05-02Treat the identity transformation as another kind of compression.Nick Mathewson
This will allow us to treat NO_METHOD as a real compression method, and to simplify code that currently does if (compressing) { compress } else { copy }
2017-05-01Rename x-lzma to x-tor-lzmaNick Mathewson
We shouldn't call it lzma, because we are imposing a limit on the memory needed for decoding.
2017-04-27Only compare the first 3 bytes when trying to detect LZMA compression.Alexander Færøy
This patch changes the logic in `detect_compression_method()` to only use the 3 first bytes when checking if a given input is LZMA encoded.
2017-04-27Merge branch 'parse_accept_encoding'Nick Mathewson
2017-04-27Move the "supported compression bitmask" into compress.[ch]Nick Mathewson
2017-04-27Document and test nul-terminating behavior of tor_uncompress()Nick Mathewson
We added this as a safety feature, but there are a few places in the code that actually depend on it.
2017-04-26Merge remote-tracking branch 'ahf/bugs/22066'Nick Mathewson
2017-04-26Better documentation for `tor_uncompress()`.Alexander Færøy
This patch fixes the documentation string for `tor_uncompress()` to ensure that it does not explicitly mention zlib or gzip since we now support multiple compression backends.
2017-04-26Store compression overhead from `tor_compress_state_t`.Alexander Færøy
The `tor_compress_state_t` data-type is used as a wrapper around the more specialized state-types used by the various compression backends. This patch ensures that the overhead of this "thin" wrapper type is included in the value returned by `tor_compress_get_total_allocation()`. See: https://bugs.torproject.org/22066
2017-04-25Use x-lzma, not x-lzma2, as the identifierNick Mathewson
2017-04-25Function to convert compression methods to/from strings.Nick Mathewson
2017-04-25Whitespace fixes.Nick Mathewson
2017-04-25Merge branch 'unified_compress_squashed'Nick Mathewson
2017-04-25Add a "best compression" flag.Nick Mathewson
2017-04-25Combine all *compress/*uncompress backend function into oneNick Mathewson
Since we have a streaming API for each compression backend, we don't need a non-streaming API for each: we can build a common non-streaming API at the front-end.
2017-04-25Use atomic counters for compressor allocation.Nick Mathewson
2017-04-25Remove `tor_compress_memory_level()`.Alexander Færøy
This patch splits up `tor_compress_memory_level()` into static functions in the individual compression backends, which allows us to tune the values per compression backend rather than globally. See: https://bugs.torproject.org/21662
2017-04-25Use switch-statement in tor_{compress,uncompress}.Alexander Færøy
Use a switch-statement in `tor_compress()` and `tor_uncompress()` for the given `compress_method_t` parameter. This allows us to have the compiler detect if we forgot add a handler in these functions for a newly added enumeration value. See: https://bugs.torproject.org/21662
2017-04-25Add API entry-point for getting compression method version numbers.Alexander Færøy
This patch adds `tor_compress_version_str()` and `tor_compress_header_version_str()` to get the version strings of the different compression schema providers. Both functions returns `NULL` in case a given `compress_method_t` is unknown or unsupported. See: https://bugs.torproject.org/21662
2017-04-25Add function to check if a given compression method is supported.Alexander Færøy
This patch adds support for checking if a given `compress_method_t` is supported by the currently running Tor instance using `tor_compress_supports_method()`. See: https://bugs.torproject.org/21662
2017-04-25Add `tor_compress_get_total_allocation()` function.Alexander Færøy
This patch adds the `tor_compress_get_total_allocation()` which returns an approximate number of bytes currently in use by all the different compression backends. See: https://bugs.torproject.org/21662
2017-04-25Add Zstandard support.Alexander Færøy
See: https://bugs.torproject.org/21662
2017-04-25Add LZMA support.Alexander Færøy
See: https://bugs.torproject.org/21662
2017-04-25Use a switch-statement when checking for compression method.Alexander Færøy
This patch changes the way `tor_compress_new()`, `tor_compress_process()`, and `tor_compress_free()` handles different compression methods. This should give us compiler warnings in case an additional compression method is added, but the developer forgets to add handlers in the three aforementioned functions. See https://bugs.torproject.org/21663
2017-04-25Rename the `torgzip` module to `compress`.Alexander Færøy
See https://bugs.torproject.org/21663