Commit Graph

11481 Commits

Author SHA1 Message Date
Andreas Steffen a488584b5f Implemented SHA-3 hash algorithm including test vectors 2015-11-03 21:35:09 +01:00
Andreas Steffen de61e2cef4 Defined SHA-3 hashers 2015-11-03 19:07:15 +01:00
Tobias Brunner 1f3a9fdde5 libipsec: Properly support CAMELLIA in CTR mode 2015-10-30 11:04:42 +01:00
Tobias Brunner 0af13d2849 ikev2: Fix size of key material for CAMELLIA-CTR
Like AES in CTR mode it includes a 4 byte nonce.
2015-10-30 11:04:42 +01:00
Tobias Brunner 0e80127691 libipsec: Fix crypter lookup for AES-CTR
Due to the nonce, the ESP key material is four bytes longer than needed for
the actual AES key.  The crypto plugins, however, register their AES-CTR
implementations with the AES key length, so the lookup here failed.

For IKEv2 the key material is allocated after creating a crypter instance
with the negotiated AES key size.  The length of the actual key material is
retrieved via get_key_size(), which adds the four bytes to the AES key length.

Fixes #1124.
2015-10-30 10:54:45 +01:00
Tobias Brunner 72cc029e24 ike-mobike: Send retransmits to the current local and remote addresses
These might have changed by a peer-initiated MOBIKE address update.

Fixes #1125.
2015-10-30 10:51:07 +01:00
Tobias Brunner 25863fe1c7 ikev1: Handle queued INFORMATIONAL message after receiving the last AM request 2015-10-30 10:30:30 +01:00
Tobias Brunner 1c8dfa30d0 ikev1: Queue INFORMATIONAL request if AM is not complete yet 2015-10-30 10:30:30 +01:00
Tobias Brunner 3805880c8a ikev1: Handle queued TRANSACTION messages only after processing replies 2015-10-30 10:30:07 +01:00
Tobias Brunner 3f56f73159 ikev1: Extract queueing of TRANSACTIONAL requests when MM is not complete yet 2015-10-30 10:27:09 +01:00
Tobias Brunner b0b0c9137d ikev1: Drop TRANSACTION/QUICK_MODE requests until we received the last AM message 2015-10-30 10:27:09 +01:00
Tobias Brunner 0cb8752b85 ikev1: Make maximum number of IKEv1 phase 2 exchanges we keep state about configurable
Fixes #1128.
2015-10-30 10:16:35 +01:00
Tobias Brunner 3195650180 Fix typo in error handling for sigwaitinfo() in charon-systemd and charon-tkm
Fixes 858148092d ("Replace usages of sigwait(3) with sigwaitinfo(2)")
2015-10-29 17:40:31 +01:00
Tobias Brunner 35dbf8af7a random: Properly handle errors when reading from /dev/[u]random
If -1 was returned on the first call to read() `done` got SIZE_MAX
and the function returned TRUE even though no actual random data had
been allocated.

Fixes #1156.
2015-10-29 16:17:17 +01:00
Tobias Brunner 37a22a166b ikev1: Avoid fourth QM message if third QM messages of multiple exchanges are handled delayed
If we haven't received the third QM message for multiple exchanges the
return value of NEED_MORE for passive tasks that are not responsible for
a specific exchange would trigger a fourth empty QM message.

Fixes: 4de361d92c ("ikev1: Fix handling of overlapping Quick Mode exchanges")

References #1076.
2015-10-29 16:03:15 +01:00
Tobias Brunner 758b1caa0e ikev1: Prevent deadlock when checking for duplicate IKEv1 SAs
Previously, the current segment was held while checking for duplicate
SAs, which requires acquiring all segments.  If multiple threads did this
concurrently this resulted in a deadlock as they couldn't acquire the
segments held by the other threads attempting to do the same.  With the
default configuration only one segment is used, which prevents the problem
as only one thread can check in an IKE SA concurrently.

Fixes: a064eaa8a6 ("Handling of initial contact")
2015-10-29 15:59:41 +01:00
Tobias Brunner 858148092d Replace usages of sigwait(3) with sigwaitinfo(2)
This is basically the same call, but it has the advantage of being
supported by FreeBSD's valgrind, which sigwait() is not.

References #1106.
2015-10-29 15:38:37 +01:00
Tobias Brunner 382f8a334a updown: Add rules to allow IP6IP6 traffic used for uncompressed small packets 2015-09-21 10:12:17 +02:00
Tobias Brunner 08afc33e52 shunt-manager: Resolve %dynamic to %any4/6 before installing policies
left|rightsubnet default to %dynamic, which is basically 0.0.0.0/0 until an
address is assigned to it.  So if only one side was undefined and the other
traffic selector was IPv6 an address family mismatch would occur.

References #595.
2015-09-16 15:01:05 +02:00
Tobias Brunner 65978f08f4 shunt-manager: Don't install policies in case of an address family or IP protocol mismatch
References #595.
2015-09-16 15:00:46 +02:00
Tobias Brunner 5f18e2c371 openssl: Explicitly include openssl/bn.h
If OpenSSL is compiled with OPENSSL_NO_DEPRECATED some of the headers
we include don't include openssl/bn.h anymore.  Therefore, we have to
explicitly include it ourselves where we use BN_* functions.

Fixes #1113.
2015-09-16 11:57:52 +02:00
Tobias Brunner dc486823aa unit-tests: Add a test to verify that there is no partial matching of RDNs 2015-09-09 14:39:26 +02:00
Tobias Brunner 221b0e93ee scepclient: Remove copyright and license from man page 2015-09-09 11:45:17 +02:00
Tobias Brunner e7143fe998 include: Add linux/socket.h
__kernel_sa_family_t is defined and used since Linux 3.1, so on systems
with older kernels (like CentOS 6.7, which still ships a 2.6.32 kernel) the
build with the current UAPI headers fails.  And using the native headers on
such system does not really work either because we use structs, defines, and
enum values from the newer headers in the kernel-netlink plugin.

__kernel_sa_family_t is defined in linux/socket.h so we ship that too (in
particular the simplified UAPI version from Linux 3.7+).

Fixes #1099.
2015-09-07 14:07:46 +02:00
Tobias Brunner adb4db475e imv-os: Add some useful usage output to the pacman utility
Fixes #487.
2015-08-31 16:02:11 +02:00
Tobias Brunner 7b20ab0a94 kernel-netlink: Properly set port mask for ICMP type/code if only set on one side
If only one traffic selector had a port (type/code) the other side had
the port mask set to 0, which canceled out the applied type/code.

It also fixes the installation of ICMP type/code on big-endian hosts.

Fixes #1091.
References #595.
2015-08-31 15:30:57 +02:00
Tobias Brunner d34a82dd57 kernel-pfkey: Properly encode ICMP type/code if only set on one side
References #595.
2015-08-31 15:30:51 +02:00
Tobias Brunner 64ee81cecf libimcv: Updated Android.mk file 2015-08-31 10:53:44 +02:00
Tobias Brunner 00c2c87b06 eap-radius: Fix creation of host_t objects based on Framed-IPv6-Address attributes
Fixes ec490e68ae ("eap-radius: Add support for some basic IPv6-specific RADIUS attributes").
References #1001.
2015-08-28 16:52:57 +02:00
Tobias Brunner 592f31f5af pki: Add new type options to --issue command usage output 2015-08-27 17:55:15 +02:00
Tobias Brunner fbb593092e eap-ttls: Limit maximum length of tunneled EAP packet to EAP-TTLS packet 2015-08-27 15:29:16 +02:00
Tobias Brunner 03024f4ca8 trap-manager: Cleanup local address in error cases 2015-08-27 14:45:11 +02:00
Tobias Brunner 30ac5c331a imv-os: Properly free strings for invalid input in pacman 2015-08-27 14:42:05 +02:00
Tobias Brunner e3e208fb9f ha: Close control FIFO if it is not valid 2015-08-27 14:31:42 +02:00
Tobias Brunner 0709280175 swanctl: Correctly build man page in out-of-tree builds from the repository 2015-08-27 12:46:53 +02:00
Tobias Brunner 7a1fed284c Fixed some typos, courtesy of codespell 2015-08-27 12:06:31 +02:00
Tobias Brunner c605a96d7f Fix some Doxygen issues 2015-08-27 12:03:11 +02:00
Tobias Brunner 0737e936e0 unit-tests: Additional test cases to increase coverage 2015-08-27 11:47:36 +02:00
Tobias Brunner fe2443b01c traffic-selector: Use calc_netbits() in RFC 3779 constructor
This properly detects prefixes encoded as ranges.
2015-08-27 11:47:36 +02:00
Tobias Brunner df62141362 ike: Fix half-open count for initiating SAs when initially checked in 2015-08-27 11:21:01 +02:00
Tobias Brunner 735f929ca7 ike: Only consider number of half-open SAs as responder when deciding whether COOKIEs are sent 2015-08-27 11:18:51 +02:00
Evan Broder 78ed330099 vici: Handle closed sockets in the Ruby gem
From recvfrom(2) (which UDPSocket#recv backs into):

  The return value will be 0 when the peer has performed an orderly
  shutdown.

(i.e. it will return an empty string)

Previously in this scenario, Vici::Transport#recv_all would spin
forever trying to pull more data off the socket. I'm not entirely
clear what happened that caused strongSwan to shutdown the socket, but
it probably should not cause vici Ruby apps to spin.

Closes strongswan/strongswan#13.
2015-08-24 11:24:05 +02:00
Tobias Brunner d8fdd1018e starter: Don't flush SAs in the kernel
If starter is not used we don't do that either. And this allows us to
move the stuff in libhydra back to libcharon.
2015-08-21 18:27:06 +02:00
Tobias Brunner bd24f87d35 starter: Don't flush policies in the kernel
We can't control which policies we flush, so if policies are installed
and used outside of strongSwan for other protocols we'd flush them too.
And if installpolicies=no is used we probably shouldn't flush policies
either.  Luckily already existing policies are not treated as fatal
errors anymore, so not flushing policies should not be that much of an
issue (in case of a crash in dynamic setups, e.g. with virtual IPs,
policies could be left behind even after restarting the connections and
properly terminating the daemon).
2015-08-21 18:27:05 +02:00
Tobias Brunner 603e3b489b kernel-pfkey: Only flush SAs of types we actually manage 2015-08-21 18:27:05 +02:00
Tobias Brunner 82b5d1c018 kernel-netlink: Only flush SAs of types we actually manage 2015-08-21 18:27:05 +02:00
Tobias Brunner 256e666d22 vici: Optionally check limits when initiating connections
If the init-limits parameter is set (disabled by default) init limits
will be checked and might prevent new SAs from getting initiated.
2015-08-21 18:21:13 +02:00
Tobias Brunner b9d7319fb3 vici: Add get_bool() convenience getter for VICI messages 2015-08-21 18:21:13 +02:00
Tobias Brunner ff0abde9ed controller: Optionally adhere to init limits also when initiating IKE_SAs 2015-08-21 18:21:13 +02:00
Tobias Brunner 471a996a3e ike: Also track initiating IKE_SAs as half-open 2015-08-21 18:21:13 +02:00