aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/compression
Commit message (Collapse)AuthorAgeFilesLines
* Fix Windows linking to consistently use .lib suffix as requiredJack Lloyd2019-12-061-1/+2
| | | | | | Also fix the zlib basename for Windows. Resolves #2210
* Fix Sphinx errorsJack Lloyd2018-12-031-0/+1
|
* Make exceptions easier to translate to error codesJack Lloyd2018-11-235-45/+55
| | | | | | | | | | | Avoid throwing base Botan::Exception type, as it is difficult to determine what the error is in that case. Add Exception::error_code and Exception::error_type which allows (for error code) more information about the error and (for error type) allows knowing the error type without requiring a sequence of catches. See GH #1742
* Default to not setting a timestamp in the gzip headerJack Lloyd2017-12-142-5/+6
| | | | But allow it to be set via a constructor arg.
* Merge #1312 Fix documentation of compression/decompression update function.Jack Lloyd2017-11-251-2/+2
|\
| * Fix documentation of compression/decompression update function.Marcus Brinkmann2017-11-261-2/+2
| |
* | Merge #1311 Add create and create_or_throw factories for ↵Jack Lloyd2017-11-252-0/+69
|\ \ | | | | | | | | | Compression_Algorithm and Decompression_Algorithm.
| * | Documentation fix in compression create/create_or_throw functions.Marcus Brinkmann2017-11-261-6/+4
| | |
| * | Add create and create_or_throw factories for Compression_Algorithm and ↵Marcus Brinkmann2017-11-252-0/+71
| |/ | | | | | | Decompression_Algorithm.
* / Fix bzip2 compression issue.Jack Lloyd2017-11-251-2/+8
|/ | | | | | When finishing, bzip2 returns BZ_STREAM_END when it has produced all output. If we end up calling the compression routine again (even with avail_in == 0), bzip2 returns an error.
* Avoid empty methods, use =default or add a commentJack Lloyd2017-10-031-3/+3
| | | | Sonar
* Use explicit on more single-argument constructorsJack Lloyd2017-09-301-1/+1
|
* It's easier to use calloc hereJack Lloyd2017-09-221-8/+2
| | | | | Assumption is calloc checks for overflow (!) so if it returns a pointer that means no overflow occurred.
* LZMA - there is no reason for new or delete hereJack Lloyd2017-09-221-6/+6
|
* Improve compression tests slightlyJack Lloyd2017-09-221-0/+6
| | | | | | Fix a bug that affected bzip2 - the bzip2 library does not like being called with avail_in == 0 and BZ_RUN, it returns PARAM_ERROR. Just return in that case and ignore the call.
* Apply final annotations to the library alsoJack Lloyd2017-09-224-9/+9
| | | | | Done by a perl script which converted all classes to final, followed by selective reversion where it caused compilation failures.
* Another missing headerJack Lloyd2017-09-211-0/+1
|
* Change header guard format to BOTAN_FOO_H_Jack Lloyd2017-09-205-10/+10
| | | | | | ISO C++ reserves names with double underscores in them Closes #512
* Add API stability annotations.Jack Lloyd2017-09-194-14/+14
| | | | | Defined in build.h, all equal to BOTAN_DLL so ties into existing system for exporting symbols.
* Remove "Dirty hack" for multiple defines in lex_me_harder()Simon Warta2017-04-024-4/+12
|
* Convert to using standard uintN_t integer typesJack Lloyd2016-12-187-46/+46
| | | | | | Renames a couple of functions for somewhat better name consistency, eg make_u32bit becomes make_uint32. The old typedefs remain for now since probably lots of application code uses them.
* Rename zero_mem to secure_scrub_memoryJack Lloyd2016-11-031-1/+1
|
* Avoid unused warning when no compression libs availableJack Lloyd2016-10-251-0/+2
| | | | [ci skip]
* Missing include, noticed by Clang on OS XJack Lloyd2016-10-211-0/+1
|
* Remove Algo_RegistryJack Lloyd2016-10-217-232/+248
| | | | | | | I repent my use of global constructors. I repent my use of global locks. Hopefully I will never touch this code again. :)
* Fix doxygen warnings [ci skip]René Korthaus2016-10-191-2/+2
|
* Improve compression doc [ci skip]René Korthaus2016-10-111-1/+38
|
* 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.