aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/compression
Commit message (Collapse)AuthorAgeFilesLines
* Remove Transform base classJack Lloyd2016-04-2112-151/+138
| | | | | | | | | | | | | | | | | | | | | | With sufficient squinting, Transform provided an abstract base interface that covered both cipher modes and compression algorithms. However it mapped on neither of them particularly well. In addition this API had the same problem that has made me dislike the Pipe/Filter API: given a Transform&, what does it do when you put bits in? Maybe it encrypts. Maybe it compresses. It's a floor wax and a dessert topping! Currently the Cipher_Mode interface is left mostly unchanged, with the APIs previously on Transform just moved down the type hierarchy. I think there are some definite improvements possible here, wrt handling of in-place encryption, but left for a later commit. The compression API is split into two types, Compression_Algorithm and Decompression_Algorithm. Compression_Algorithm's start() call takes the compression level, allowing varying compressions with a single object. And flushing the compression state is moved to a bool param on `Compression_Algorithm::update`. All the nonsense WRT compression algorithms having zero length nonces, input granularity rules, etc as a result of using the Transform interface goes away.
* Remaining cppcheck fixes that are not covered by GH #444Daniel Neus2016-03-051-1/+1
|
* cppcheck fixes: Class 'X' has a constructor with 1 argument that is not ↵Daniel Neus2016-03-053-4/+4
| | | | explicit.
* In compression wrappers add an overflow check before calling mallocJack Lloyd2016-02-131-3/+21
| | | | | | | | | | If malloc fails, don't save the size that was attempted. Otherwise a failing malloc followed by a free(nullptr) would zero a block of memory equal to the failed allocation starting from the null address. It's not clear if zlib,bzip2,lzma expect the return of the malloc function to be zero but LZMA at least seems to read from it before writing. Zero it.
* Add final attribute to many classesJack Lloyd2016-01-104-19/+19
| | | | | | | In some cases this can offer better optimization, via devirtualization. And it lets the user know the class is not intended for derivation. Some discussion in GH #402
* Remove all remaining uses of throwing a std:: exception directlyJack Lloyd2015-12-193-12/+12
| | | | See GH #340 and 6b9a3a5 for background
* Reroot the exception hierarchy into a toplevel Exception classJack Lloyd2015-12-115-16/+16
| | | | | | | | As the alternatives are unfortunate for applications trying to catch all library errors, and it seems deriving from std::runtime_error causes problems with MSVC DLLs (GH #340) Effectively reverts 2837e915d82e43
* Add missing overridesJack Lloyd2015-11-112-2/+2
|
* Add missing compression overridesSimon Warta2015-09-013-2/+3
|
* Add override specifiers to zlib.hJack Lloyd2015-08-281-6/+6
|
* Gzip_Decompression should be a subclass of Stream_DecompressionJack Lloyd2015-08-281-1/+1
| | | | GH #264
* Compression: Fix zlib failure on compression of empty inputDaniel Seither2015-08-281-0/+8
| | | | | zlib treats a nullptr output buffer as an error. This commit fixes the failing compression tests.
* Compression: Prevent undefined behavior when feeding empty inputDaniel Seither2015-08-281-7/+7
| | | | | | &emptyVector[n] triggers undefined behavior because it is an out-of- bounds access, even if n == 0. emptyVector.data() does not (but may return nullptr).
* Add missing semicolonsDaniel Seither2015-07-151-1/+1
|
* lib/compression: Convert &vec[0] to vec.data()Simon Warta2015-06-271-2/+2
|
* Return null instead of throwing if compressor obj not availablelloyd2015-05-131-1/+3
|
* Add tests for compression and SRP.lloyd2015-05-132-4/+7
| | | | | | | | Fix zlib decompression which was not ignoring Z_BUF_ERROR which is harmless in this context as process is already checking avail_in and avail_out after run returns. Bump version to 1.11.17
* Change `make_compressor` and `make_decompressor` to return alloyd2015-05-102-39/+49
| | | | | compression type instead of the base transform class. Add some final annotations.
* Change zlib to use Z_SYNC_FLUSH instead of Z_FULL_FLUSH for flushing.lloyd2015-05-101-1/+1
| | | | | This lets flush work for decompression also, and more generally provides what an application wants from a mid-stream compression flush.
* Mark modules pulling in external deps (zlib, boost, etc) as such, andlloyd2015-02-063-3/+3
| | | | | | notify the user when they are enabled. Drop botan-config, replaced by `botan config` command added in 1.11.8
* Fix build problem with recent LZMA library.lloyd2015-02-052-6/+7
| | | | | | Fix retreival of LZMA and bzip2 compressors from make_compressor. Allow setting compression level from command line.
* Remove algo factory, engines, global RNG, global state, etc.lloyd2015-02-047-45/+33
| | | | | | | | | | | | | | | Convert all uses of Algorithm_Factory and the engines to using Algo_Registry The shared pool of entropy sources remains but is moved to EntropySource. With that and few remaining initializations (default OIDs and aliases) moved elsewhere, the global state is empty and init and shutdown are no-ops. Remove almost all of the headers and code for handling the global state, except LibraryInitializer which remains as a compatability stub. Update seeding for blinding so only one hacky almost-global RNG instance needs to be setup instead of across all pubkey uses (it uses either the system RNG or an AutoSeeded_RNG if the system RNG is not available).
* Add a runtime map of string->func() which when called returnlloyd2015-01-286-47/+35
| | | | | | | | | | | | | | | | | Transforms and BlockCiphers. Registration for all types is done at startup but is very cheap as just a std::function and a std::map entry are created, no actual objects are created until needed. This is a huge improvement over Algorithm_Factory which used T::clone() as the function and thus kept a prototype object of each type in memory. Replace existing lookup mechanisms for ciphers, AEADs, and compression to use the transform lookup. The existing Engine framework remains in place for BlockCipher, but the engines now just call to the registry instead of having hardcoded lookups. s/Transformation/Transform/ with typedefs for compatability. Remove lib/selftest code (for runtime selftesting): not the right approach.
* Centralize where string.h/cstring is included to mem_ops.hlloyd2015-01-233-6/+5
| | | | See github 42 for background
* Ensure all files have copyright and license info.lloyd2015-01-1010-10/+10
| | | | | Update license header line to specify the terms and refer to the file, neither of which it included before.
* Figure out which decompressor to use based on the input file extension.lloyd2014-12-097-67/+98
| | | | | | | | Rename Bzip to Bzip2, and split Zlib and Deflate compressors into two completely distinct types rather than using a bool flag to the Zlib constructor. Ignore null pointers to our free implementation (LZMA does this).
* Nullptr cleanuplloyd2014-12-061-1/+1
|
* Add gzip compression transform and compress command line prog.lloyd2014-11-195-12/+171
|
* Convert compression filters to in-place transforms and refactorlloyd2014-11-1814-0/+879
to minimize the amount of logic needed in the files specific to each library.