Commit Graph

15842 Commits

Author SHA1 Message Date
Tobias Brunner 8622a74292 NEWS: Add info about CVE-2017-9022/23 2017-05-29 11:05:04 +02:00
Andreas Steffen 38a8ecadb7 x509: nameConstraints sequence does not require a loop
Fixes: CVE-2017-9023
2017-05-29 11:05:04 +02:00
Andreas Steffen f2f9edbbc0 unit-tests: Updated asn1-parser tests 2017-05-29 11:05:04 +02:00
Andreas Steffen 407fcca200 asn1-parser: Fix CHOICE parsing
Fixes: CVE-2017-9023
2017-05-29 11:05:04 +02:00
Tobias Brunner 6681d98d18 gmp: Make sure the modulus is odd and the exponent not zero
Unlike mpz_powm() its secure replacement mpz_powm_sec() has the additional
requirement that the exponent must be > 0 and the modulus has to be odd.
Otherwise, it will crash with a floating-point exception.

Fixes: CVE-2017-9022
Fixes: 3e35a6e7a1 ("Use side-channel secured mpz_powm_sec of libgmp 5, if available")
2017-05-29 11:05:04 +02:00
Andreas Steffen 89f05ed5a9 imv-swid: Fixed memory leak in http REST interface 2017-05-29 10:59:22 +02:00
Andreas Steffen 29e1c58643 leak-detective: Whitelisted memory leaks in FHH IMCs and IMVs 2017-05-29 10:59:04 +02:00
Andreas Steffen c82be739bc imv-test: Fixed memory leak in server retry use case 2017-05-29 10:58:33 +02:00
Andreas Steffen fca4e70bd3 libtnccs: Fixed memory leak of global variables in libxml2 2017-05-29 10:57:34 +02:00
Tobias Brunner a09e79ed5d ike-cfg: Fix memory leak when matching against ranges
traffic_selector_t::to_subnet() always sets the net/host (unless the
address family was invalid).

Fixes: 3070697f9f ("ike: support multiple addresses, ranges and subnets in IKE address config")
2017-05-29 10:50:58 +02:00
Tobias Brunner 85ee4107c5 NEWS: Added some news 2017-05-26 18:33:12 +02:00
Tobias Brunner 00d547119e ike: Apply retransmission_limit before applying the jitter 2017-05-26 18:16:40 +02:00
Tobias Brunner 8ed3168406 eap-sim-file: Remove redundant enumerator allocation 2017-05-26 16:42:59 +02:00
Tobias Brunner bb494cde03 sql: Remove redundant enumerator allocation
Interestingly, this doesn't show up in the regression tests because the
compiler removes the first assignment (and thus the allocation) due to
-O2 that's included in our default CFLAGS.
2017-05-26 16:39:33 +02:00
Tobias Brunner 71d59af58a testing: Add wrapper around service command
When charon is started via service command LEAK_DETECTIVE_LOG is not set
because the command strips the environment.  Since we only want the
variable to be set during the automated test runs we can't just set it
in /etc/default/charon.  Instead, we do so in this wrapper when charon is
started and remove the variable again when it is stopped.
2017-05-26 16:28:16 +02:00
Tobias Brunner b2473e94a2 Fixed some typos, courtesy of codespell 2017-05-26 14:44:06 +02:00
Tobias Brunner cd0bba90a9 apidoc: Add legacy README so links get properly resolved
Also reorders the input files so the READMEs are listed first in the
navigation menu on the left.
2017-05-26 14:36:25 +02:00
Andreas Steffen 2d5a79bf59 testing: Added swanctl/rw-eap-md5-id-rsa scenario 2017-05-26 14:36:25 +02:00
Andreas Steffen 7272fa0c8d README: Converted to swanctl configuration scheme 2017-05-26 14:36:25 +02:00
Tobias Brunner b668bf3f9e Merge branch 'variadic-enumerators'
This adds several changes to enumerator_t and linked_list_t to improve
portability.  In particular to Apple's ARM64 iOS platform, whose calling
convention for variadic and regular functions are different.  This means
that assigning a non-variadic function to a variadic function pointer,
as we did with our enumerator_t::enumerate() implementations and several
callbacks, will result in crashes as the called function will access the
arguments differently than the caller provided them.

To avoid this issue the enumerator_t interface is now fully variadic.
A new mandatory method is added, venumerate(), that takes a va_list with
the arguments provided while enumerating.  enumerate() is replaced with
a generic implementation that prepares a va_list and calls the
enumerator's venumerate() implementation.  As this allows passing the
arguments of one enumerator to another it avoids the five pointer hack
used by enumerator_create_nested() and enumerator_create_cleaner().
To simplify the implementation of venumerate() a helper macro is provided
that assigns values from a given va_list to local variables.

The signature of the callback passed to enumerator_create_filter() has
also changed significantly.  It's now required to enumerate over the
original enumerator in the callback as this avoids the previous in/out
pointer hack. The arguments to the outer enumerator are provided in a
va_list.

Similar changes to avoid such five pointer hacks affect the signatures
of the callbacks for linked_list_t's invoke_function() and find_first()
methods.  For the latter the return type also changed from status_t to
bool, which is important as SUCCESS is defined as 0, so checks for ==
SUCCESS will now fail.
2017-05-26 14:24:13 +02:00
Tobias Brunner 2e4d110d1e linked-list: Change return value of find_first() and signature of its callback
This avoids the unportable five pointer hack.
2017-05-26 13:56:44 +02:00
Tobias Brunner 8a2e4d4a8b linked-list: Change interface of callback for invoke_function()
This avoids the unportable five pointer hack.
2017-05-26 13:56:44 +02:00
Tobias Brunner 5cafea6edd linked-list: invoke_offset() doesn't take any additional arguments anymore 2017-05-26 13:56:44 +02:00
Tobias Brunner 525cc46cab Change interface for enumerator_create_filter() callback
This avoids the unportable 5 pointer hack, but requires enumerating in
the callback.
2017-05-26 13:56:44 +02:00
Tobias Brunner 95a63bf281 Migrate all enumerators to venumerate() interface change 2017-05-26 13:56:44 +02:00
Tobias Brunner 16bffa8b55 enumerator: Add venumerate() method to enumerator_t that takes a va_list
This will allow us to implement e.g. enumerator_cleaner without having to
use that unportable 5 pointer forwarding or having to define a callback for
each instance.

A generic implementation for enumerate() is provided so only venumerate()
has to be implemented, which may be simplified by using the VA_ARGS_VGET()
macro.
2017-05-26 13:56:44 +02:00
Tobias Brunner 5297c65398 utils: Add helper macros to read variadic arguments into local variables 2017-05-26 13:56:44 +02:00
Tobias Brunner 0da10b73ad testing: Fix ikev2/two-certs scenario
Since 6a8a44be88 the certificate received by the client is verified
first, before checking the cached certificates for any with matching
identities.  So we usually don't have to attempt to verify the signature
with wrong certificates first and can avoid this message.
2017-05-26 13:55:32 +02:00
Tobias Brunner 4366494d72 Merge branch 'sha-256-96'
Adds an option to locally configure 96-bit truncation for HMAC-SHA256
when negotiated using the official algorithm identifier.  This is for
compatibility with peers that incorrectly use this shorter truncation
(like Linux does by default).

Fixes #1353.
2017-05-26 11:23:12 +02:00
Tobias Brunner 0afe0eca67 vici: Make 96-bit truncation for SHA-256 configurable 2017-05-26 11:22:28 +02:00
Tobias Brunner 4270c8fcb0 stroke: Make 96-bit truncation for SHA-256 configurable 2017-05-26 11:22:28 +02:00
Tobias Brunner 7637633bb9 child-cfg: Optionally use 96-bit truncation for HMAC-SHA-256
The correct truncation is 128-bit but some implementations insist on
using 96-bit truncation.  With strongSwan this can be negotiated using
an algorithm identifier from a private range.  But this doesn't work
with third-party implementations.  This adds an option to use 96-bit
truncation even if the official identifier is used.
2017-05-26 11:22:27 +02:00
Tobias Brunner 7b476029e6 android-log: Link against liblog 2017-05-26 09:40:14 +02:00
Tobias Brunner 2cbb2271aa unit-tests: Fix test_chunk_eq() if arguments have side-effects 2017-05-24 09:34:17 +02:00
Tobias Brunner f8eb636e70 Merge branch 'avoid-rekey-loss'
This changes the behavior during IKEv2 CHILD_SA rekeyings to avoid
traffic loss.  When responding to a CREATE_CHILD_SA request to rekey a
CHILD_SA the responder already has everything available to install and
use the new CHILD_SA.  However, this could lead to lost traffic as the
initiator won't be able to process inbound packets until it processed the
CREATE_CHILD_SA response and updated the inbound SA.  To avoid this the
responder now only installs the new inbound SA and delays installing the
outbound SA until it receives the DELETE for the replaced CHILD_SA.  The
messages transporting these DELETEs could reach the peer before packets
sent with the deleted outbound SAs reach the respective peer.  To reduce
the chance of traffic loss due to this the inbound SA of the replaced
CHILD_SA is not removed for a configurable amount of seconds after
the DELETE has been processed.

Fixes #1291.
2017-05-23 18:49:13 +02:00
Tobias Brunner 10c7a66806 unit-tests: Check installed IPsec SAs in child-rekey tests 2017-05-23 18:46:50 +02:00
Tobias Brunner 72655fe411 unit-tests: Add assert to check for installed IPsec SAs 2017-05-23 18:46:50 +02:00
Tobias Brunner 2b581b59f0 unit-tests: Migrate cached IPsec SAs to new IKE_SAs during rekeying 2017-05-23 18:46:49 +02:00
Tobias Brunner d80055baae unit-tests: Keep track of installed IPsec SAs in mock kernel_ipsec_t implementation 2017-05-23 18:46:49 +02:00
Tobias Brunner 44107cb7b7 child-delete: Delay the removal of the inbound SA of rekeyed CHILD_SAs
After deleting a rekeyed CHILD_SA we uninstall the outbound SA but don't
destroy the CHILD_SA (and the inbound SA) immediately.  We delay it
a few seconds or until the SA expires to allow delayed packets to get
processed. The CHILD_SA remains in state CHILD_DELETING until it finally
gets destroyed.
2017-05-23 18:46:49 +02:00
Tobias Brunner ba0796fe75 delete-child-sa-job: Add new constructor that takes the unique ID of a CHILD_SA
This makes sure we delete the right SA in case the addresses got updated
in the mean time.
2017-05-23 18:46:49 +02:00
Tobias Brunner 0cbf75eb94 child-sa: Remove state to track installation of half the SA again 2017-05-23 18:46:49 +02:00
Tobias Brunner d94c122439 unit-tests: Overload helper macro to check for outbound SA state 2017-05-23 18:46:49 +02:00
Tobias Brunner afbea8ce3c child-sa: Expose state of the outbound SA 2017-05-23 18:46:48 +02:00
Tobias Brunner c5fed4cdee child-sa: Add method to remove the outbound SA and policies 2017-05-23 18:46:46 +02:00
Tobias Brunner 4ba07a8652 child-sa: Keep track whether the outbound SA has been installed or not 2017-05-23 18:46:06 +02:00
Tobias Brunner 9a5f7a30f8 child-delete: Track flags per individual CHILD_SA 2017-05-23 18:46:06 +02:00
Tobias Brunner dc3710e987 ikev2: Delay installation of outbound SAs during rekeying on the responder
The responder has all the information needed to install both SAs before
the initiator does.  So if the responder immediately installs the outbound
SA it might send packets using the new SA which the initiator is not yet
able to process.  This can be avoided by delaying the installation of the
outbound SA until the replaced SA is deleted.
2017-05-23 18:46:06 +02:00
Tobias Brunner f84757f2e6 child-sa: Add log message for CHILD_SA state changes 2017-05-23 18:46:06 +02:00
Tobias Brunner cad13450be child-sa: Add method to associate rekeyed CHILD_SAs with their replacement 2017-05-23 18:46:06 +02:00