Commit Graph

10871 Commits

Author SHA1 Message Date
Martin Willi 6d4649573e traffic-selector: Add a hash() method 2015-02-20 13:34:48 +01:00
Martin Willi 5499473c33 child-sa: Sort traffic selectors after adding CHILD_SA policies
Having traffic selectors sorted properly makes comparing them much simpler.
2015-02-20 13:34:48 +01:00
Martin Willi fc978f192f unit-tests: Add an initial set of traffic selector unit tests 2015-02-20 13:34:48 +01:00
Martin Willi 373a147fed traffic-selector: Add a compare function to sort traffic selectors 2015-02-20 13:34:48 +01:00
Martin Willi 698ed656f7 child-sa: Remove the obsolete update logic
The kernel backend uses an inbound parameter these days, where it makes
no sense to pass the update flag. The kernel backend decides itself how
it handles SA installation based on the inbound flag.
2015-02-20 13:34:48 +01:00
Martin Willi d05d85fe65 kernel-interface: Pass full list of traffic selectors to add_sa()
While we can handle the first selector only in BEET mode in kernel-netlink,
passing the full list gives the backend more flexibility how to handle this
information.
2015-02-20 13:34:47 +01:00
Martin Willi fd9417607c libipsec: Remove unused src/dst_ts parameters from ipsec_sa_mgr_t.add_sa() 2015-02-20 13:34:47 +01:00
Martin Willi 6ad787ca54 kernel-pfkey: Don't update during add_sa(), but delete SPI allocation state 2015-02-20 13:34:47 +01:00
Martin Willi 2a1c9e20bd kernel-interface: Remove reqid parameter from get_spi/get_cpi() methods
The reqid is not strictly required, as we set the reqid with the update
call when installing the negotiated SA.

If we don't need a reqid at this stage, we can later allocate the reqid in
the kernel backend once the SA parameters have been fully negotaited. This
allows us to assign the same reqid for the same selectors to avoid conflicts
on backends this is necessary.
2015-02-20 13:34:32 +01:00
Martin Willi 3e779ff555 libipsec: Remove unused reqid parameter from ipsec_sa_mgr_t.get_spi() 2015-02-19 15:42:22 +01:00
Martin Willi 970378c557 libtls: Don't send TLS close notifies in EAP after application succeeds
With the introduction of PT-TLS, we started sending TLS close notifies after
the application layer completes (7bbf7aa9). While this makes sense for TCP based
transports, it is not required in EAP methods. In EAP, handshake completion
can be directly signaled using the outer EAP-SUCCESS message. This also saves
one round-trip in the EAP exchange.

Windows 7/8 does not seem to like TLS close notifies at all in EAP, and either
stalls (EAP-TTLS) or disconnects (PEAP).

Fixes #556.
2015-02-19 11:29:07 +01:00
Thomas Egerer 875f7be5fc ha: Perform child rekeying outside of CHILD_SA enumerator
When rekey_child_sa is called while enumerating the children of an IKE_SA, and
the child to be rekeyed is redundant a QUICK_DELETE task is queued instead of a
QUICK_MODE task. This alters the IKE_SA's list of children (ike_sa_t::child_sas)
invalidating the current element of the child_sa_enumerator. The enumerate
function of linked_list_t will then advance to an element with unpredictable
contents most likely resulting in an segmentation violation. A similar behavior
should be observed when delete_child_sa is called.

This patch creates a list of protocol/spi values while holding the
child_sa_enumerator and performs the rekeying (deletion of redundant) chlidren
after releasing the enumerator.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2015-02-19 10:58:40 +01:00
Martin Willi c6bc167c0b stroke: Double the stroke message string buffer size 2015-02-06 16:44:39 +01:00
Martin Willi eaa964b34e starter: Fail sending stroke message if a string exceeds the buffer size
Instead of silently setting the string value to NULL, we fail completely in
sending the message to notify the user.

Fixes #844.
2015-02-06 16:44:27 +01:00
Martin Willi b851f0a105 x509: Fix public key reference leak if authority key identifier does not match 2015-02-06 13:58:58 +01:00
Martin Willi c8992ea6d2 vici: Fix ruby gem author email 2015-01-22 15:00:45 +01:00
Andreas Steffen ecf605c6e1 trusted_enumerate requires an additional argument 2015-01-21 23:54:53 +01:00
Martin Willi 96df0a0ebd vici: Fix README example encoding element type values, off by one
While we fixed the wrong values in the description with d39e04b5, the example
values are still off by one.

Fixes #828.
2015-01-21 09:31:24 +01:00
Martin Willi 780bf2b8e9 libtls: Check for CHANGE_CIPHER_SPEC type only if upper layer returns NEED_MORE
A type is returned only if upper layers successfully created a record, that is
returns NEED_MORE. If we do not check for the return value, we might check a
previous record or the uninitialized type variable and falsely reset the
sequence number.
2015-01-12 14:18:24 +01:00
Maks Naumov aa71c19e5c starter: Fix mark_out.mask in starter_cmp_conn() 2015-01-12 11:17:12 +01:00
Tobias Brunner 8284e56d5b _updown: Remove obsolete man pages 2015-01-05 13:44:16 +01:00
Andreas Steffen ee3b135687 unit-tests: Adapted to coverity fixes 2014-12-23 15:40:01 +01:00
Andreas Steffen 6139c8e524 Fixed bad bit shift and sign extension errors 2014-12-23 15:40:01 +01:00
Tobias Brunner fd19feefa4 bliss: Remove unnecessary cast to double
Coverity is still not happy when the result of an integer division is
assigned to a double (without e.g. casting the result to an int first to
indicate the intent).  The shift should avoid this issue.
2014-12-23 15:40:01 +01:00
Tobias Brunner 078fe7aae6 bliss: Log type if unsupported 2014-12-23 15:40:01 +01:00
Tobias Brunner a8e82ace8a bliss: Make sure sampler exists after checking for it earlier 2014-12-23 15:40:01 +01:00
Tobias Brunner 027c19b097 pts: Do not override status with SUCCESS if length is invalid 2014-12-23 15:40:01 +01:00
Tobias Brunner 691d00f166 ikev2: Only touch the DH object if we have a matching proposal 2014-12-23 15:40:01 +01:00
Tobias Brunner e13ef5c434 crypto: Define MODP_CUSTOM outside of IKE DH range
Before this fix it was possible to crash charon with an IKE_SA_INIT
message containing a KE payload with DH group MODP_CUSTOM(1025).
Defining MODP_CUSTOM outside of the two byte IKE DH identifier range
prevents it from getting negotiated.

Fixes CVE-2014-9221.
2014-12-23 15:40:01 +01:00
Tobias Brunner 6683cf6a5a pki: Document correct output formats for --pkcs12 --export 2014-12-19 16:31:36 +01:00
Tobias Brunner a6c0dec0e5 pki: Properly clean up if output format for --pkcs12 is wrong 2014-12-19 16:30:10 +01:00
Martin Willi 7f82a8f34b osx: Update the README with App related bits 2014-12-17 16:54:28 +01:00
Martin Willi dacd667c84 osx: Initial import of the Objective-C App graphical user interface 2014-12-17 16:53:45 +01:00
Martin Willi 04337fed02 apple: Redefine some additional clashing Mach types
While they usually are not included in a normal strongSwan build, the XPC
header indirectly defines these Mach types. To build charon-xpc, which uses
both XPC and strongSwan includes, we have to redefine these types.
2014-12-16 17:22:28 +01:00
Martin Willi 6fa203b8d4 kernel-pfroute: If a new interface appears, slightly delay address enumeration
On OS X 10.10, when installing a virtual IP on a tun device, there is a chance
that a RTM_IFANNOUNCE is sent before the IP is ready on that link when calling
getifaddrs(). As we don't get an RTM_NEWADDR event either, that race lets us
miss the virtual IP install event, failing the add_ip() call.
2014-12-16 17:22:28 +01:00
Martin Willi 1c6188a0c2 charon-xpc: Add a work-around to trigger IP address add events after boot 2014-12-16 17:22:27 +01:00
Tobias Brunner f9da7ef868 mgf1: Use correct Doxygen groups 2014-12-15 17:22:11 +01:00
Tobias Brunner a876018e3e bliss: Fix Doxygen comments 2014-12-15 17:19:57 +01:00
Tobias Brunner 3000f6aada Fixed some typos, courtesy of codespell 2014-12-15 17:11:14 +01:00
Tobias Brunner d21b01462e kernel-pfkey: Fix replay window size on FreeBSD and Mac OS X
The FreeBSD and Mac OS X kernels interpret sadb_sa_replay as the size of the
replay window in bytes.  Linux on the other hand does the same for PF_KEY it
does for XFRM so sadb_sa_replay denotes the number of packets/bits in the
window.  Similarly, the window size on Linux is limited to 32 by the four
byte default bitmap used for IPsec SAs (may only be changed with
XFRMA_REPLAY_ESN_VAL), which is not the case on the other platforms.
2014-12-15 16:09:15 +01:00
Andreas Steffen 9b4e411c50 Also initialize s_sign 2014-12-12 13:24:11 +01:00
Martin Willi 58cacf0a74 pem: Handle BER indefinite length encoding as binary ASN.1
While our ASN.1 parser can't handle BER indefinite length encoding, the OpenSSL
backend can. Some PKCS#12 containers get encoded this way, so we should
support loading such files in the pem plugin.
2014-12-12 13:11:29 +01:00
Tobias Brunner 3a26566fa9 pki: Add command to export certificates and keys from PKCS#12 containers 2014-12-12 13:11:29 +01:00
Tobias Brunner c20f962732 pki: Reformat PKCS#12 output and add an index for each certificate/key 2014-12-12 13:11:29 +01:00
Tobias Brunner 374b569ed0 pki: Add simple PKCS#12 display command 2014-12-12 13:11:29 +01:00
Tobias Brunner ec846f9e52 pki: Cache entered secrets in case they are needed more than once 2014-12-12 13:11:29 +01:00
Tobias Brunner 75dd984e9e ike: Allow creation of internally used payloads
Since 42e0a317c6 ("ike: Only parse payloads valid for the current IKE
version") payload types are checked before creating objects.  This check
failed for internally used payload types (e.g. proposal substructures),
which have a type >= 256, i.e. outside the IKE payload type range.
2014-12-12 13:10:26 +01:00
Andreas Steffen 3e654a13ee Cache only support fingerprint types 2014-12-12 13:08:40 +01:00
Andreas Steffen 8aaf36c6e3 Fix ambiguities and gcc compiler warning 2014-12-12 12:48:31 +01:00
Martin Willi 6e4620adfb apple: Use precancelable poll() to wrap accept/recvmsg calls
To make accept/recvmsg cancelable, we wrap them with poll. As poll itself
does not honor pending cancellations when entering the function, we use our
variant that checks for pending cancellation requests before entering poll().
2014-12-12 12:08:34 +01:00