Tobias Brunner
14bd0bc743
Fixed some typos, courtesy of codespell
2023-11-14 10:11:16 +01:00
Tobias Brunner
1e8a72e7a0
chunk: Add helper to hash chunks via pointer
2023-11-13 12:50:47 +01:00
Andreas Steffen
d72d0c0dfa
utils: Added chunk_to_dec() function
2023-11-13 12:39:10 +01:00
Tobias Brunner
19ef2aec15
Update copyright headers after acquisition by secunet
2022-06-28 10:22:56 +02:00
Tobias Brunner
e2e21f2486
chunk: Optionally clear mmap'd chunk before unmapping
...
This is mostly for the non-mmap case as with mmap available, access to the
unmapped memory isn't easily possible (e.g. opening the same area with
MAP_ANONYMOUS | MAP_UNINITIALIZED is usually prevented by the missing
CONFIG_MMAP_ALLOW_UNINITIALIZED option in most kernels).
2021-10-04 11:30:03 +02:00
Josh Soref
b3ab7a48cc
Spelling fixes
...
* accumulating
* acquire
* alignment
* appropriate
* argument
* assign
* attribute
* authenticate
* authentication
* authenticator
* authority
* auxiliary
* brackets
* callback
* camellia
* can't
* cancelability
* certificate
* choinyambuu
* chunk
* collector
* collision
* communicating
* compares
* compatibility
* compressed
* confidentiality
* configuration
* connection
* consistency
* constraint
* construction
* constructor
* database
* decapsulated
* declaration
* decrypt
* derivative
* destination
* destroyed
* details
* devised
* dynamic
* ecapsulation
* encoded
* encoding
* encrypted
* enforcing
* enumerator
* establishment
* excluded
* exclusively
* exited
* expecting
* expire
* extension
* filter
* firewall
* foundation
* fulfillment
* gateways
* hashing
* hashtable
* heartbeats
* identifier
* identifiers
* identities
* identity
* implementers
* indicating
* initialize
* initiate
* initiation
* initiator
* inner
* instantiate
* legitimate
* libraries
* libstrongswan
* logger
* malloc
* manager
* manually
* measurement
* mechanism
* message
* network
* nonexistent
* object
* occurrence
* optional
* outgoing
* packages
* packets
* padding
* particular
* passphrase
* payload
* periodically
* policies
* possible
* previously
* priority
* proposal
* protocol
* provide
* provider
* pseudo
* pseudonym
* public
* qualifier
* quantum
* quintuplets
* reached
* reading
* recommendation to
* recommendation
* recursive
* reestablish
* referencing
* registered
* rekeying
* reliable
* replacing
* representing
* represents
* request
* request
* resolver
* result
* resulting
* resynchronization
* retriable
* revocation
* right
* rollback
* rule
* rules
* runtime
* scenario
* scheduled
* security
* segment
* service
* setting
* signature
* specific
* specified
* speed
* started
* steffen
* strongswan
* subjectaltname
* supported
* threadsafe
* traffic
* tremendously
* treshold
* unique
* uniqueness
* unknown
* until
* upper
* using
* validator
* verification
* version
* version
* warrior
Closes strongswan/strongswan#164 .
2020-02-11 18:23:07 +01:00
Tobias Brunner
a5a8f2bce2
chunk: Add helper to copy a chunk left-padded to a certain length
2019-04-24 11:40:14 +02:00
Tobias Brunner
db82c0f594
Fixed some typos, courtesy of codespell
2018-12-18 11:14:19 +01:00
Tobias Brunner
1b67166921
Unify format of HSR copyright statements
2018-05-23 16:32:53 +02:00
Tobias Brunner
b82b5f6398
chunk: Skip all leading zero bytes in chunk_skip_zero() not just the first
2016-04-04 15:39:42 +02:00
Andreas Steffen
b12c53ce77
Use standard unsigned integer types
2016-03-24 18:52:48 +01:00
Martin Willi
9d6e952201
utils: Add a constant time chunk_equals() variant for cryptographic purposes
2015-04-14 12:02:48 +02:00
Tobias Brunner
c6e8b5dc2c
chunk: Fix Doxygen comments for chunk_internet_checksum[_inc]
2014-09-11 17:56:12 +02:00
Tobias Brunner
b557f4a7cd
chunk: Add function to calculate Internet Checksums according to RFC 1071
2014-07-22 11:10:35 +02:00
Martin Willi
460adb5d09
unit-tests: Seed chunk_hash() only once, but before creating any hashtables
...
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.
2014-06-04 15:53:11 +02:00
Martin Willi
c46cee6f6d
chunk: Don't depend on pthread directly
2014-06-04 15:53:00 +02:00
Martin Willi
922ee2c529
windows: Add a common Windows header for platform specific wrappers
...
Include some more basic system headers in utils.h, so we can use that common
header on the different platforms.
2014-06-03 12:24:34 +02:00
Martin Willi
b9ee059ca9
chunk: Externalize error reporting in chunk_write()
...
This avoids passing that arbitrary label just for error messages, and gives
greater flexibility in handling errors.
2014-01-23 15:55:32 +01:00
Martin Willi
1c4a3459f7
chunk: Use dynamically allocated buffer in chunk_from_fd()
...
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.
2014-01-23 15:55:32 +01:00
Martin Willi
595b6d9a82
chunk: Add functions to map file contents to a chunk
2014-01-23 15:55:32 +01:00
Tobias Brunner
20a48e4be3
chunk: Fix signedness warnings caused by chunk_from_* macros
...
There are countless other such warnings because e.g. chunk_create() is called
with char*, but at least we prevent users from causing such warnings
inadvertently when using these macros.
2013-11-27 18:28:44 +01:00
Tobias Brunner
46cded2627
chunk: Add helper function to create a chunk from data read from a file descriptor
2013-10-23 17:20:39 +02:00
Tobias Brunner
f0c54e8c15
chunk: Print chunks without separator if + modifier is used
2013-08-24 16:22:51 +02:00
Tobias Brunner
ed235dbbf2
chunk: Add predictable hash function
...
Since chunk_hash() is randomized its output is not predictable, that is,
it is only within the same process.
2013-06-28 17:00:29 +02:00
Tobias Brunner
c1be5d66cd
Use local variable in chunk_from_str()
...
This allows using strdup() or other string functions as argument
without calling them twice.
2013-06-11 11:03:12 +02:00
Tobias Brunner
d1953fe403
Replace chunk_hash() with output from chunk_mac()
...
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.
2013-06-11 11:03:11 +02:00
Tobias Brunner
1255de5a20
Adding chunk_mac() which calculates a 64-bit MAC using SipHash-2-4
2013-06-11 11:03:11 +02:00
Martin Willi
47af9848a2
Add a chunk_from_str() initializer that does not include 0-terminator
2013-01-15 17:43:05 +01:00
Tobias Brunner
bca34c3717
Moved utils.[ch] to utils folder
2012-10-24 16:07:53 +02:00
Tobias Brunner
125b37af6d
Moved chunk_t to utils folder
2012-10-24 16:00:50 +02:00