aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/utils/chunk.c
Commit message (Collapse)AuthorAgeFilesLines
* chunk: Correctly parse Base64 text where four = follow in a rowTobias Brunner2017-05-231-1/+1
| | | | | | | That's not correct Base64 but invalid data could trigger this. Since outlen would get reduced four times, but is only ever increased three times per iteration, this could result in an integer underflow and then a potential buffer overflow.
* utils: chunk_from_hex() skips optional 0x prefixAndreas Steffen2017-03-061-1/+7
|
* Use standard unsigned integer typesAndreas Steffen2016-03-241-31/+31
|
* chunk: Fix internet checksum calculation on big-endian systemsTobias Brunner2014-10-231-1/+1
| | | | | | | ntohs() might be defined as noop (#define ntohs(x) (x)) so we have to manually shorten the negated value (gets promoted to an int). Fixes #747.
* chunk: Add function to calculate Internet Checksums according to RFC 1071Tobias Brunner2014-07-221-0/+31
|
* unit-tests: Seed chunk_hash() only once, but before creating any hashtablesMartin Willi2014-06-041-0/+8
| | | | | | | Due to the removal of pthread_once, we manually create the seed for chunk_hash(). With the new testable functions interface, this won't work for the hashtable initiated using __attribute__((constructor)). Enforce seeding before creating that hashtable.
* chunk: On Windows, use binary mode in chunk_write()Martin Willi2014-06-041-1/+8
|
* chunk: On Windows, chunk_map() opens files in binary modeMartin Willi2014-06-041-2/+7
|
* chunk: Fallback to recv() on Windows chunk_from_fd() when operating on socketMartin Willi2014-06-041-0/+6
|
* chunk: Don't depend on pthread directlyMartin Willi2014-06-041-13/+5
|
* chunk: Externalize error reporting in chunk_write()Martin Willi2014-01-231-9/+6
| | | | | This avoids passing that arbitrary label just for error messages, and gives greater flexibility in handling errors.
* chunk: Provide a fallback chunk_map() if mmap is not availableMartin Willi2014-01-231-1/+46
|
* chunk: Use dynamically allocated buffer in chunk_from_fd()Martin Willi2014-01-231-12/+41
| | | | | | | | When acting on files, we can use fstat() to estimate the buffer size. On non-file FDs, we dynamically increase an allocated buffer. Additionally we slightly change the function signature to properly handle zero-length files and add appropriate unit tests.
* chunk: Add functions to map file contents to a chunkMartin Willi2014-01-231-0/+80
|
* chunk: Add helper function to create a chunk from data read from a file ↵Tobias Brunner2013-10-231-0/+32
| | | | descriptor
* chunk: Print chunks without separator if + modifier is usedTobias Brunner2013-08-241-2/+2
|
* chunk: Add predictable hash functionTobias Brunner2013-06-281-0/+22
| | | | | Since chunk_hash() is randomized its output is not predictable, that is, it is only within the same process.
* Randomly allocate chunk_hash() key during first useTobias Brunner2013-06-111-1/+46
| | | | This avoids hash flooding attacks.
* Replace chunk_hash() with output from chunk_mac()Tobias Brunner2013-06-111-75/+23
| | | | | | | The quality is way better, the calculation is a bit slower though. The key is statically initialized to zero, which will be changed later to prevent hash flooding.
* Adding chunk_mac() which calculates a 64-bit MAC using SipHash-2-4Tobias Brunner2013-06-111-1/+117
|
* Moved chunk_t to utils folderTobias Brunner2012-10-241-0/+690