Commit Graph
2406 Commits
Author SHA1 Message Date
Martin Willi c1fd8c22ce stream: support async operation using watcher 2013-07-18 16:00:28 +02:00
Martin Willi 7a23588195 stream: add printf()-style covenience functions 2013-07-18 16:00:28 +02:00
Martin Willi 2ba276017d stream: create library instance of stream-manager 2013-07-18 16:00:28 +02:00
Martin Willi d6ff53940f stream: add a manager to dynamically register streams and services 2013-07-18 16:00:28 +02:00
Martin Willi daf1880b39 stream: add a stream service class abstracting services using BSD sockets 2013-07-18 16:00:27 +02:00
Martin Willi b6b940001a stream: add a stream class abstracting BSD sockets
Currently only synchronous operation is supported, but this will be extended
with asynchronous methods using the new watcher.
2013-07-18 16:00:27 +02:00
Martin Willi 32b2a5e04b watcher: add a centralized an generic facility to monitor file descriptors 2013-07-18 16:00:27 +02:00
Tobias Brunner 027676f750 capabilities: Add function to check if a capability is held, without keeping it
This can be useful if capabilities are not required anymore after
dropping privileges.
2013-07-18 15:25:35 +02:00
Martin Willi 19cb07b890 automake: replace INCLUDES by AM_CPPFLAGS
INCLUDES are now deprecated and throw warnings when using automake 1.13.
We now also differentiate AM_CPPFLAGS and AM_CFLAGS, where includes and
defines are passed to AM_CPPFLAGS only.
2013-07-18 14:59:19 +02:00
Martin Willi 2d5a20061a soup: omit deprecated g_type_init() when using >= GLIB 2.36 2013-07-18 14:20:57 +02:00
Martin Willi 55dacbfac2 keychain: flush certificate cache after reloading System keychain 2013-07-18 12:17:54 +02:00
Martin Willi 57dce77ba6 keychain: monitor changes in the system keychain, reload when necessary 2013-07-18 12:17:54 +02:00
Martin Willi dcd8bdde4f keychain: use SearchCopyNext keychain enumeration for System certs as well
SecItemCopyMatching seems to be problematic regarding memory management. And
as there does not seem to be a good alternative to enumerate the System Roots
keychain using the SecItemCopyMatching API, we stick to the deprecated
enumeration functions for now.
2013-07-18 12:17:54 +02:00
Martin Willi 0bdd453392 keychain: load certificates from System Roots Keychain 2013-07-18 12:17:54 +02:00
Martin Willi bc6c7bf39e keychain: load certificates only once during startup, improving performance 2013-07-18 12:17:54 +02:00
Martin Willi 6f00ddb90c keychain: support on-the-fly enumeration of trusted/untrusted certificates 2013-07-18 12:17:54 +02:00
Martin Willi 7b8edabd8a keychain: add a stub for a credential plugin using OS X Keychain Services 2013-07-18 12:17:54 +02:00
Martin Willi 5d36f04ee2 credmgr: stop querying for secrets once we get a perfect match 2013-07-18 12:17:54 +02:00
Martin Willi 69039e83f8 credmgr: don't use pointers for id_match_t enum values 2013-07-18 12:17:54 +02:00
Martin Willi c3e7b3de0b openssl: parse X.509 extended key usage from extension parsing loop
Otherwise parsing gets aborted if unknown critical extensions are handled as
error.
2013-07-18 12:17:53 +02:00
Martin Willi 3f55f203ee openssl: show which critical X.509 extension is not supported 2013-07-18 12:17:53 +02:00
Martin Willi 437a6feb07 hashtable: add common hashtable hash/equals functions for pointer/string keys 2013-07-18 12:17:53 +02:00
Martin Willi 01c0267778 thread: implicitly create thread_t if an external thread calls thread_current() 2013-07-18 12:17:53 +02:00
Tobias Brunner 84693a3d79 linked-list: Remove barely used has_more() method
This required some refactoring when handling encrypted payloads.

Also changed log messages so that "encrypted payload" is logged instead
of "encryption payload" (even if we internally still call it that) as
that's the name used in RFC 5996.
2013-07-17 17:42:53 +02:00
Tobias Brunner 1a9528f916 linked-list: Don't require an argument for the item when enumerating 2013-07-17 17:42:53 +02:00
Tobias Brunner cf4172637a linked-list: Remove unused clone_function() method 2013-07-17 17:42:53 +02:00
Tobias Brunner 0f3ddbd189 linked-list: Remove barely used find_last() method 2013-07-17 17:42:53 +02:00
Tobias Brunner be3c09d020 linked-list: Remove unused replace() method
Its functionality can be replicated by calling insert_before() followed
by remove_at().  Not the other way around, though, because remove_at()
changes the enumerator position.
2013-07-17 17:42:53 +02:00
Martin Willi 926776ec80 auth-cfg: use array instead of linked list
Saves another 4 linked lists (1KB) per IKE_SA
2013-07-17 17:20:18 +02:00
Martin Willi 4730c4b32b unit-tests: implement tests for array collection 2013-07-17 17:20:17 +02:00
Martin Willi 2621ff4d40 array: introduce an array collection storing elements very efficiently
Currently we use the very versatile linked-list collection to store elements
with variable count. This is fine, but very inefficient: Due to the many
methods in the linked list, on 64-bit platforms an empty list alone is more
than 200 bytes. As we currently have about 50 lists per IKE_SA/CHILD_SA pair,
this takes up to 10KB just for managing the empty lists. This is about the
half of memory used by an IKE_SA/CHILD_SA pair, and obviously way too much.

The new array type is not an object, but a collection of functions on an
abstract type.

The following lists are per IKE_SA and should be considered for a replacement
with more efficient arrays (this uses load-testers on-demand created dynamic
configurations, other scenarios have different lists):

14 -> ike_sa_create() @ src/libcharon/sa/ike_sa.c:2198
10 -> auth_cfg_create() @ src/libstrongswan/credentials/auth_cfg.c:1088
 6 -> task_manager_v2_create() @ src/libcharon/sa/ikev2/task_manager_v2.c:1505
 6 -> proposal_create() @ src/libcharon/config/proposal.c:592
 5 -> peer_cfg_create() @ src/libcharon/config/peer_cfg.c:657
 4 -> child_sa_create() @ src/libcharon/sa/child_sa.c:1090
 2 -> child_cfg_create() @ src/libcharon/config/child_cfg.c:536
 1 -> ike_cfg_create() @ src/libcharon/config/ike_cfg.c:330
 1 -> put_connected_peers() @ src/libcharon/sa/ike_sa_manager.c:854
2013-07-17 17:20:17 +02:00
Tobias Brunner e0b868f79e pkcs12: Add plugin dependencies with soft dependencies on the most common algorithms 2013-07-15 10:48:19 +02:00
Martin Willi 1e54e40f5d leak-detective: remove hdr entry when reallocating zero bytes 2013-07-12 20:00:16 +02:00
Martin Willi c93cf85356 leak-detective: print total of allocated/leaked bytes in usage/report 2013-07-12 20:00:14 +02:00
Andreas Steffen 126778679f Recognize critical IssuingDistributionPoint CRL extension 2013-07-12 09:00:47 +02:00
Martin Willi 81959e6406 leak-detective: add a usage threshold option based on the number of allocations 2013-07-10 17:28:45 +02:00
Martin Willi 82d0317be6 leak-detective: set_state() only affects the calling thread
The only user (bfd backtraces) is fine with that, and we really should not
mess the enable flag while doing allocations with other threads.
2013-07-10 17:28:32 +02:00
Martin Willi f960b39061 leak-detective: take a copy of backtrace while printing traces
As we don't want to hold the lock, we must make sure backtraces keep valid
while printing them.
2013-07-10 17:28:24 +02:00
Martin Willi d9c459e855 backtrace: add a clone() method 2013-07-10 17:28:18 +02:00
Martin Willi 3b26f04cf4 leak-detective: remove hdr from the allocation list during realloc()
If realloc moves an allocation, the original allocation gets freed. We
therefore must remove the hdr from the list, as it is invalid. We can add it
afterwards once it has been updated, allowing us to unlock the list during
reallocation.
2013-07-10 16:37:08 +02:00
Tobias Brunner d27f225d9a Use strpfx() helper where appropriate 2013-07-08 18:49:30 +02:00
Tobias Brunner f460facdca utils: Add helper function to check a string for a given prefix 2013-07-08 18:49:30 +02:00
Tobias Brunner 985dcab1c2 utils: Convert string helper macros to static inline functions 2013-07-08 18:49:29 +02:00
Martin Willi 324b90cc46 openssl: RAND_pseudo_bytes() returns 0 if bytes are not cryptographically strong
For our purposes with RNG_WEAK this is fine, so accept a zero return value.
2013-07-04 11:09:54 +02:00
Tobias Brunner b1b0cce396 processor: Simplified the main loop 2013-06-28 17:02:06 +02:00
Tobias Brunner 6ca25ccc04 processor: Don't hold the lock while destroying jobs
If a lock is held when queue_job() is called and the same lock is
required during the destruction of a job, holding the internal lock
in the processor while calling destroy() could result in a deadlock.
2013-06-28 17:02:05 +02:00
Tobias Brunner f95205f580 integrity-checker: Use chunk_hash_static() to calculate checksums 2013-06-28 17:00:29 +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 b18a531715 plugin-loader: Removed unused path argument of load() method
Multiple additional search paths can be added with the add_path()
method.
2013-06-28 10:44:15 +02:00
Tobias Brunner 75ff252324 integrity-checker: Fix checksum calculation after randomizing chunk_hash() 2013-06-27 15:34:08 +02:00