18444 Commits

Author SHA1 Message Date
Tobias Brunner
31f467d70b botan: Move shared secret calculation to get_shared_secret() 2022-06-29 10:28:50 +02:00
Tobias Brunner
0e82d5cc2c gmp: Move shared secret calculation to get_shared_secret()
This avoids doing costly operations when just setting the public key.
For the same reason the optional extended public key check is moved.
2022-06-29 10:28:50 +02:00
Tobias Brunner
0351b5af3b key-exchange: Warn about costly operations in set_public_key() 2022-06-29 10:28:50 +02:00
Tobias Brunner
e334bd46b1 ike-auth: Move packet collection to post_build() method
This way we avoid having to pre-generate the message when it could
theoretically still get modified by a task that follows or from a plugin
via message() hook.
2022-06-29 10:28:50 +02:00
Tobias Brunner
44629bbadb ikev2: Delay IKE key derivation until next message
In particular as responder, this delays costly cryptographic operations
until the IKE_AUTH request is received, which is preferable to reduce
the impact of DoS attacks.

Another advantage is that the key material is not changed until all tasks
built or processed a message.
2022-06-29 10:28:50 +02:00
Tobias Brunner
2a9323a18a ikev2: Use hashes to detect retransmits
This way we avoid parsing messages with unexpected message IDs, which
might not even be possible if we don't have the keys anymore.  However,
the next commit should avoid the latter and this way we avoid deriving
keys for retransmits or unexpected messages.

This also changes how retransmits for fragmented messages are triggered.
Previously, we waited for all fragments and reconstructed the message
before retransmitting the response.  Now we only track the first
fragment and if we receive a retransmit of it respond immediately
without waiting for other fragments (which are now ignored).  This is in
compliance with RFC 7383, section 2.6.1, and can avoid issues if there
are lots of fragments.
2022-06-29 10:28:50 +02:00
Tobias Brunner
639af09b2e child-sa: Cache and forward actual initiator flag for outbound SA
Kernel interfaces (e.g. TKM) might rely on this flag to be correct.
2022-06-29 10:28:50 +02:00
Tobias Brunner
8d6ed71a55 ikev2: Send deletes also for rekeyed SAs
This way we can use the IKE_REKEYED state for both redundant and old SAs
to suppress ike_updown().

In the ike-delete task we don't suppress events in state IKE_REKEYING as
that's the case when we delete an SA the peer is currently rekeying with
multiple key exchanges.
2022-06-29 10:28:50 +02:00
Tobias Brunner
b6652ababe ikev2: Let ike/child-rekey tasks indicate if the passive task was adopted
This gives us more flexibility with tasks that return NEED_MORE (currently
none of the colliding tasks do, but that will change with multi-KE
rekeyings).  The active task has to check itself if the passive task is
done and should be removed from the task manager.
2022-06-29 10:28:50 +02:00
Tobias Brunner
7ffeed01c0 ike-rekey: Remove collision task type checks
Since f67199378df9 ("ike-rekey: Handle undetected collisions also if
delete is delayed") we only ever track tasks of type TASK_IKE_REKEY, so
there is no need to check the type or use the generic task_t interface.

Also changed some of the comments to clarify collision handling.
2022-06-29 10:28:50 +02:00
Tobias Brunner
87a86e9c98 ike-rekey: Don't actively rekey already rekeyed SAs
If the peer successfully rekeyed the SA it gets marked as IKE_REKEYED
and it remains until the peer deletes it (or a timeout).  There is no
point in rekeying such SAs again.

IKE_REKEYING will be relevant if we have multi-KE rekeyings and are
waiting for followup key exchanges for a passive rekeying.
2022-06-29 10:28:50 +02:00
Tobias Brunner
39c66693a0 ike-init: Ignore COOKIE payloads during rekeying
This ensures that process_i() only returns NEED_MORE due to multiple
key exchanges or an INVALID_KE_PAYLOAD notify.
2022-06-29 10:28:50 +02:00
Tobias Brunner
e5bf9b23b2 ike-sa-manager: Log SPIs when checking in an IKE_SA 2022-06-29 10:28:50 +02:00
Tobias Brunner
c1987aefbe message: Fix payload type in last unprotected payload of a fragmented message 2022-06-29 10:28:50 +02:00
Tobias Brunner
ba348b4799 ike-rekey: Reset IKE_SA after processing CREATE_CHILD_SA request
This probably didn't cause any problems, as there wasn't really anything
happening between the calls, but reset it anyway, just to be safe.
2022-06-29 10:28:50 +02:00
Tobias Brunner
36312808d1 ikev2: Allow tasks to do work after processing requests/responses 2022-06-29 10:28:50 +02:00
Tobias Brunner
210e2177aa task: Add optional post_process() method
This will allows tasks to do some work after a message has been
processed.
2022-06-29 10:28:50 +02:00
Tobias Brunner
1719e0f0aa ikev2: Allow tasks to do work after generating requests/responses 2022-06-29 10:28:50 +02:00
Tobias Brunner
87caf36bb9 task: Add optional post_build() method
This will allow tasks to do some work after the message has been
generated.
2022-06-29 10:28:50 +02:00
Tobias Brunner
28b33d7cac ike-auth: Support exchange between IKE_SA_INIT and IKE_AUTH 2022-06-29 10:28:50 +02:00
Tobias Brunner
09a4aed3a2 child-create: Support exchange between IKE_SA_INIT and IKE_AUTH 2022-06-29 10:28:50 +02:00
Tobias Brunner
3a8ea08686 ike-mobike: Support exchange between IKE_SA_INIT and IKE_AUTH
This changes the MID of the first IKE_AUTH message.
2022-06-29 10:28:50 +02:00
Tobias Brunner
366fce8f03 ike-config: Support exchange between IKE_SA_INIT and IKE_AUTH
This changes the MID of the first IKE_AUTH message.
2022-06-29 10:28:50 +02:00
Tobias Brunner
09d4497536 ike-cert-post: Make absolutely sure certificates are only added to IKE_AUTH
The AUTH payload check in build_certs() should be fine, but add some
extra checks just to make really sure and also for clarification.
2022-06-29 10:28:50 +02:00
Tobias Brunner
f2e79bf334 ike-cert-pre: Support exchange between IKE_SA_INIT and IKE_AUTH
The first IKE_AUTH does not have MID 1 if that's the case.
2022-06-29 10:28:50 +02:00
Tobias Brunner
f00e80d759 status: Add return_need_more() utility function 2022-06-29 10:28:50 +02:00
Tobias Brunner
ec350ebb78 child-cfg: Generalize get_ke_method() method 2022-06-29 10:28:50 +02:00
Tobias Brunner
093fc1ac63 ike-cfg: Generalize get_ke_method() method 2022-06-29 10:28:50 +02:00
Tobias Brunner
3bebf5bf8d proposal: Generalize KE methods 2022-06-29 10:28:50 +02:00
Andreas Steffen
b7c167f972 Rename MODP_NONE to KE_NONE 2022-06-29 10:28:50 +02:00
Tobias Brunner
3af7c6db87 Rename diffie_hellman_t to key_exchange_t and change the interface etc.
This makes it more generic so we can use it for QSKE methods.
2022-06-29 10:28:50 +02:00
Tobias Brunner
ec95fd9b93 bliss: Remove stray URLs from headers 2022-06-29 10:28:17 +02:00
Tobias Brunner
df18934d20 Replace or remove wiki.strongswan.org URLs 2022-06-28 13:33:51 +02:00
Tobias Brunner
19ef2aec15 Update copyright headers after acquisition by secunet 2022-06-28 10:22:56 +02:00
Tobias Brunner
c05fdf387b Remove obsolete _copyright utility 2022-06-28 10:22:55 +02:00
Tobias Brunner
8dbcff1e8b openssl: Use dynamically allocated array to determine EC curves
This avoids the use of a variable length array, which should probably
be avoided in general due to potential performance, portability and
security issues (not in this particular case, though).

Closes strongswan/strongswan#1095
2022-06-27 15:54:23 +02:00
Tobias Brunner
4a19a5e056 ita-comp-ima: Change validation URI parsing to avoid GCC 12 compiler warning
The compiler warned that a dangling pointer might be used because `name`,
which is returned from the function via `ima_name`, might point into the
locally determined `uri`.  Determining the URI outside and passing it to
the function fixes this.
2022-06-27 14:09:11 +02:00
Tobias Brunner
1c198bf22b fips-prf: Add explicit bound check to avoid GCC 12 compile warning
GCC assumes this->b is zero (or may be zero) and spits out the following
warning (or error with -Werror):

src/libstrongswan/plugins/fips_prf/fips_prf.c:124:12: error: array subscript 18446744073709551615 is above array bounds of ‘uint8_t[<U8090>]’ {aka ‘unsigned char[<U8090>]’} [-Werror=array-bounds]
  124 |         one[this->b - 1] = 0x01;
      |         ~~~^~~~~~~~~~~~~
2022-06-27 14:09:11 +02:00
Tobias Brunner
585666aa97 hashtable: Avoid compiler warning with GCC 12
Even though the assignment of `removed` to `out_row` is tied to the
`found_removed` flag, which is only set if `removed` is set, the
compiler complains that it may be used uninitialized.
2022-06-27 14:09:11 +02:00
Tobias Brunner
993ea32825 object: Fix CALLBACK macros with GCC 12
GCC 12 produces weird code when a callback is called directly (e.g.
parse_bool() via parse_option() in vici_config.c).  Instead of the actual
pointer, it explicitly passes 0 as first argument, which likely causes
a segmentation fault.  It doesn't happen when called indirectly via
function pointer that has void* as first argument, which this patch
kinda replicates for direct calls to avoid the issue.

Closes strongswan/strongswan#1053
2022-06-27 14:03:32 +02:00
Tobias Brunner
cc1d78b0a8 conf: Fix documentation for leak detective's usage thresholds
These only apply to the usage reports that are available via
`stroke memusage`, not to leak reports when executables are terminated,
which always include all non-whitelisted leaks.
2022-06-21 15:44:59 +02:00
Tobias Brunner
735515b3a7 credential-manager: Log subject of trusted cert before building trust chain
This should make it clearer to what the log messages generated by
verify_trust_chain() are related (in particular if building the chain
fails or the cert has expired).
2022-06-02 11:25:19 +02:00
Andreas Steffen
432111720d Version bump to 5.9.7dr1 5.9.7dr1 2022-05-26 17:41:14 +02:00
Andreas Steffen
3f19a951cf TCG TNC attribute name changes
The TCG TNC IF-M Segmentation standard was implemented based on a
draft version. The attribute names are updated to comply with the
final TCG IF-M Segmentation Specification Version 1.0 Rev. 5
dated 4 April 2016
2022-05-26 17:37:43 +02:00
Tobias Brunner
63f35993d9 testing: Use sans-serif font for test results
We could later extend the stylesheet more or even add something similar
to actual templates (e.g. a shared header/footer).
2022-05-24 08:11:56 +02:00
Tobias Brunner
846201a686 Merge branch 'nm-gtk4'
Adds support for GTK 4.  Two versions of the UI are built as shared
objects, the plugin dynamically loads and instantiates the appropriate one
based on the determined GTK version.

Closes strongswan/strongswan#961
2022-05-16 14:41:33 +02:00
Tobias Brunner
14f082177e nm: Version bump to 1.6.0 2022-05-16 14:18:48 +02:00
Tobias Brunner
790e0b1cd4 nm: Add support for GTK4 2022-05-16 14:18:48 +02:00
Tobias Brunner
49e30dbed4 nm: Change layout of file chooser dialog
GTK4 does not support buttons at the bottom, so we put them in a header
bar, which is the preferred layout by current desktop environments. And
while it doesn't look ideal on older desktops, it also works with GTK3
and changing it avoids having to maintain multiple UI files.

Note that this layout is not supported by glade, so we generally can't
use it to edit the GUI anymore (it also doesn't support GTK4 in general).
2022-05-16 14:18:48 +02:00
Tobias Brunner
b404440192 nm: Split NM plugin and editor widget into separate libs
This will allow the plugin to load the editor widget matching the current
GTK version dynamically.
2022-05-16 14:18:48 +02:00