Commit Graph

12079 Commits

Author SHA1 Message Date
Andreas Steffen 68075fb7a7 Implemented FFT with n = 1024 and q = 11289 using Montgomery arithmetic 2016-07-29 12:36:14 +02:00
Andreas Steffen a7d626118f bliss: Implemented FFT with fast Montgomery arithmetic 2016-07-29 12:36:14 +02:00
Andreas Steffen 5ff88c9622 xof: Implemented SHAKE128 and SHAKE256 Extended Output Functions 2016-07-29 12:36:14 +02:00
Andreas Steffen 04208ac5d4 xof: Defined Extended Output Functions 2016-07-29 12:36:14 +02:00
Andreas Steffen 7f65a8c271 vici: Increased various string buffers to BUF_LEN (512 bytes) 2016-07-29 12:34:40 +02:00
Andreas Steffen fa1865094d integrity-test: Added charon-systemd 2016-07-29 12:33:32 +02:00
Andreas Steffen eda8907b90 Added SHA-3 signature OIDs 2016-07-26 13:34:45 +02:00
Tobias Brunner a6d7aed78a libcharon: Add exchange_tests to .gitignore 2016-07-25 14:01:26 +02:00
Andreas Steffen 5ce749bcfc unit-tests: Decreased loop count of FFT speed test to 10'000 2016-07-22 21:27:42 +02:00
Andreas Steffen 10ebb3c914 unit-tests: Added bliss_fft_speed test 2016-07-22 11:58:10 +02:00
Andreas Steffen 0274163674 libtpmtss: Use pkconfig to configure TSS 2.0 includes and libraries 2016-07-20 11:26:07 +02:00
Tobias Brunner 60d0f52fd6 ike1: Flush active queue when queueing a delete of the IKE_SA
By aborting the active task we don't have to wait for potential
retransmits if the other peer does not respond to the current task.
Since IKEv1 has no sequential message IDs and INFORMATIONALs are no real
exchanges this should not be a problem.

Fixes #1537
References #429, #1410
Closes strongswan/strongswan#48
2016-07-19 11:48:17 +02:00
Tobias Brunner 1fafc56b95 Fixed some typos, courtesy of codespell 2016-07-04 12:18:51 +02:00
Andreas Steffen 37ffa99cf2 imcv: Added EFI HCRTM event 2016-06-30 16:20:10 +02:00
Tobias Brunner a8d6501036 aikgen: Fix computation of key ID of the AIK public key
We don't have direct access to the modulus and exponent of the key anymore.
2016-06-30 12:56:41 +02:00
Tobias Brunner c05d49632f libtpmtss: Define missing Doxygen group and fix some comments 2016-06-30 12:12:31 +02:00
Tobias Brunner a23bde26bd libimcv: Fix Doxygen comment 2016-06-30 12:12:26 +02:00
Thomas Egerer 40bb4677f7 ikev1: Add support for extended sequence numbers
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2016-06-29 11:16:48 +02:00
Tobias Brunner 7c81219bb8 plugin-loader: Allow selective modification of the default plugin list
This change allows selectively modifying the default plugin list by setting
the `load` setting of individual plugins (e.g. to disable them or to change
their priority) without enabling charon.load_modular and having to configure
a section and a load statement for every plugin.
2016-06-29 11:16:48 +02:00
Tobias Brunner 505c318701 leak-detective: Try to properly free allocations after deinitialization
If a function we whitelist allocates memory while leak detective is enabled
but only frees it after LD has already been disabled, free() will get called
with invalid pointers (not pointing to the actually allocated memory by LD),
which will cause checks in the C library to fail and the program to crash.
This tries to detect such cases and calling free with the correct pointer.
2016-06-29 11:09:38 +02:00
Tobias Brunner c1410cb045 openssl: Whitelist OPENSSL_init_crypto() and others in leak detective
Lots of static data is allocated in this function, which isn't freed until
the library is unloaded (we can't call OPENSSL_cleanup() as initialization
would fail when calling it again later).  When enabling the leak
detective the test runner eventually crashes as all the data allocated during
initialization has an invalid size when freed after leak detective has been
unloaded.
2016-06-29 11:09:38 +02:00
Tobias Brunner fedec33f5a openssl: Update GCM/crypter API to OpenSSL 1.1.0 2016-06-29 11:09:38 +02:00
Tobias Brunner 97b1a27f43 openssl: Update HMAC API to OpenSSL 1.1.0 2016-06-29 11:09:38 +02:00
Tobias Brunner cd08eb84cb openssl: Don't use deprecated RAND_pseudo_bytes() 2016-06-29 11:09:38 +02:00
Tobias Brunner 985d7b1c67 openssl: Update PKCS#12 API to OpenSSL 1.1.0 2016-06-29 11:09:37 +02:00
Tobias Brunner a9f388e368 openssl: Update PKCS#7 API to OpenSSL 1.1.0 2016-06-29 11:09:37 +02:00
Tobias Brunner 989ba4b6cd openssl: Update CRL API to OpenSSL 1.1.0
There is currently no way to compare the outer and inner algorithms
encoded in a parsed CRL.  X509_CRL_verify() does not seem to check that
either, though (unlike X509_verify()).
2016-06-29 11:09:37 +02:00
Tobias Brunner 08d7e1f190 openssl: Update x509 API to OpenSSL 1.1.0 2016-06-29 11:09:37 +02:00
Tobias Brunner 6688f7986e openssl: Update ECDSA API to OpenSSL 1.1.0 2016-06-29 11:09:37 +02:00
Tobias Brunner 3fb2c8edb7 openssl: Update RSA API to OpenSSL 1.1.0 2016-06-29 11:09:37 +02:00
Tobias Brunner 375a5ed240 openssl: Make some utilities take const BIGNUM pointers 2016-06-29 11:09:37 +02:00
Tobias Brunner 6d5df086f7 openssl: Add macro to define fallback functions for non-opaque OpenSSL versions 2016-06-29 11:09:37 +02:00
Tobias Brunner 54d629b7ad openssl: Update DH API to OpenSSL 1.1.0 2016-06-29 11:09:37 +02:00
Tobias Brunner 1b36fbedf5 openssl: Update crypter API to OpenSSL 1.1.0
EVP_CIPHER and EVP_CIPHER_CTX are now opaque types, the getters already
existed before.
2016-06-29 11:09:37 +02:00
Tobias Brunner faa904fb0b openssl: Fix mapping from ASN1 to chunk_t with OpenSSL 1.1.0
ASN1_OBJECT is now opaque.
2016-06-29 11:09:37 +02:00
Tobias Brunner e2abe7ae97 openssl: Update initialization and cleanup for OpenSSL 1.1.0
We can't call OPENSSL_cleanup() as that would prevent us from
re-initializing the library again (which we use in the Android app, that
loads/unloads plugins).
2016-06-29 11:09:36 +02:00
Tobias Brunner a6c43a8d8a openssl: OpenSSL 1.1.0 is thread-safe so we don't have to setup callbacks 2016-06-29 11:09:36 +02:00
Tobias Brunner 08fe609ce2 android: Actually add Android.mk for libtpmtss 2016-06-28 14:34:13 +02:00
Tobias Brunner 6b726b6fb2 android: Fix build after adding libtpmtss 2016-06-28 11:28:15 +02:00
Andreas Steffen b031593641 libtpmtss: Added to integrity checks 2016-06-26 18:19:05 +02:00
Andreas Steffen 2343c48341 aikpub2: Output AIK signature algorithm 2016-06-26 18:19:05 +02:00
Andreas Steffen 721ed31b39 Refactoring to tpm_tss_quote_info object 2016-06-26 18:19:05 +02:00
Andreas Steffen 12e1a06987 libimcv: Changed debug level for functional components from 2 to 3 2016-06-26 18:19:05 +02:00
Andreas Steffen 57e80492eb libtpmtss: Implemented TSS2 quote() method 2016-06-26 18:19:05 +02:00
Andreas Steffen bc67802ac8 libtpmtss: Implemented TSS2 read_pcr() method 2016-06-22 15:33:44 +02:00
Andreas Steffen 30d4989aec libimcv: migrate pts to tpm_tss 2016-06-22 15:33:44 +02:00
Andreas Steffen 8301dc859c libtpmtss: Get TPM 2.0 capabilities 2016-06-22 15:33:44 +02:00
Andreas Steffen fedc6769dc libtpmtss: Retrieve TPM 1.2 version info 2016-06-22 15:33:43 +02:00
Andreas Steffen c08753bdf4 Created libtpmtss library handling access to v1.2 and v2.0 TPMs 2016-06-22 15:33:43 +02:00
Andreas Steffen 6337770845 aikpub2: --handle option retrieves public key from TPM 2.0 NVRAM 2016-06-22 15:33:43 +02:00
Andreas Steffen 87d356dc47 aikpub2: Convert TSS 2.0 AIK public key blob into PKCS#1 format 2016-06-22 15:33:43 +02:00
Tobias Brunner 5435a9a062 unit-tests: Add tests for expires after CHILD_SA rekeying 2016-06-17 18:48:08 +02:00
Tobias Brunner 15cea08adc child-rekey: Only rekey installed CHILD_SAs
Depending on the lifetimes a CHILD_SA we rekeyed as responder might
expire shortly afterwards.  We don't want to rekey it again.

When retrying due to an INVALID_KE_PAYLOAD notify the expected state
is CHILD_REKEYING if it is anything else (e.g. due to a collision) we
ignore it.

We also abort the exchange properly if we don't find the CHILD_SA, no
need for an empty INFORMATIONAL exchange anymore.
2016-06-17 18:48:08 +02:00
Tobias Brunner de4e4687ff Report test coverage of libcharon and starter 2016-06-17 18:48:08 +02:00
Tobias Brunner d707a19733 unit-tests: Add test for CHILD_SA rekey if a retry due to an INVALID_KE_PAYLOAD is delayed 2016-06-17 18:48:08 +02:00
Tobias Brunner 6d8041d46b child-rekey: Ignore failed colliding CHILD_SA rekeyings
If a passive rekeying fails due to an INVALID_KE_PAYLOAD we don't want
to consider this task later when resolving collisions.  This previously
might have caused the wrong SA to get deleted/installed based on the nonces
in the unsuccessful exchange.
2016-06-17 18:48:08 +02:00
Tobias Brunner b4f24ac0f6 unit-tests: Add test for collision between IKE_SA rekey and CHILD_SA creation 2016-06-17 18:48:08 +02:00
Tobias Brunner b92f11c3bd child-create: Retry creating the CHILD_SA if TEMPORARY_FAILURE is received
We queue a delayed task that is initiated after a while.
2016-06-17 18:48:07 +02:00
Tobias Brunner 208678e6e1 ikev2: Add possibility to delay initiation of a queued task
Such a task is not initiated unless a certain time has passed.  This
allows delaying certain tasks but avoids problems if we'd do this
via a scheduled job (e.g. if the IKE_SA is rekeyed in the meantime).

If the IKE_SA is rekeyed the delay of such tasks is reset when the
tasks are adopted i.e. they get executed immediately on the new IKE_SA.

This hasn't been implemented for IKEv1 yet.
2016-06-17 18:48:07 +02:00
Tobias Brunner 4e2e7d4fec ike: Reduce RETRY_INTERVAL a bit
Retry exchanges between 5 and 15 seconds after a temporary failure.
2016-06-17 18:48:07 +02:00
Tobias Brunner 2045cadc1c ike-rekey: Return TEMPORARY_FAILURE when concurrently creating a CHILD_SA 2016-06-17 18:48:07 +02:00
Tobias Brunner 46cbdcace9 unit-tests: Add tests for IKE rekeying if INVALID_KE_PAYLOAD notifies are received 2016-06-17 18:48:07 +02:00
Tobias Brunner 0a954d6789 ike: Add configuration option to switch to preferring supplied proposals over local ones 2016-06-17 18:48:07 +02:00
Tobias Brunner f2ea230b91 child-cfg: Add option to prefer supplied proposals over locally configured ones 2016-06-17 18:48:07 +02:00
Tobias Brunner 3a40d572c6 ike-cfg: Add option to prefer supplied proposals over locally configured ones 2016-06-17 18:48:07 +02:00
Tobias Brunner f5e8bc18fd proposal: Remove MODP_NONE from IKE proposals parsed from strings 2016-06-17 18:48:07 +02:00
Tobias Brunner aae9510148 proposal: Handle MODP_NONE in both directions when selecting proposals 2016-06-17 18:48:07 +02:00
Tobias Brunner 2f211ced9c proposal: Parse modpnone as MODP_NONE(0) 2016-06-17 18:48:07 +02:00
Tobias Brunner 09711198a7 ike-rekey: Make sure to ignore task when detecting collisions if ike-init subtask failed
For instance, if INVALID_KE_PAYLOAD is returned we don't want this task
to affect any active rekeying (no new SA has been established so far).
2016-06-17 18:48:06 +02:00
Tobias Brunner 2e33d1f9ae unit-tests: Add test for rekey collision if one CREATE_CHILD_SA response is delayed 2016-06-17 18:48:06 +02:00
Tobias Brunner 566134b25a unit-tests: Add tests for IKE_SA rekeying if collision is not detected by one peer 2016-06-17 18:48:06 +02:00
Tobias Brunner f67199378d ike-rekey: Handle undetected collisions also if delete is delayed
If the peer does not detect the rekey collision and deletes the old
IKE_SA and then receives the colliding rekey request it will respond with
TEMPORARY_FAILURE.  That notify may arrive before the DELETE does, in
which case we may just conclude the rekeying initiated by the peer.

Also, since the IKE_SA is destroyed in any case when we receive a delete
there is no point in storing the delete task in collide() as process_i()
in the ike-rekey task will never be called.
2016-06-17 18:48:06 +02:00
Tobias Brunner 7426576184 ike-rekey: There is no passive reauth task, so it will never collide with one 2016-06-17 18:48:06 +02:00
Tobias Brunner 724d65900c ike-rekey: Ignore colliding rekey tasks that did not create an IKE_SA
This simplifies collision handling and we don't need to know about these
tasks when concluding the rekeying we initiated.
2016-06-17 18:48:06 +02:00
Tobias Brunner 1b989dd4c5 ike-rekey: Properly handle situation if the peer did not notice the rekey collision
We conclude the rekeying before deleting the IKE_SA.  Waiting for the
potential TEMPORARY_FAILURE notify is no good because if that response
does not reach us the peer will not retransmit it upon our retransmits
of the rekey request if it already deleted the IKE_SA after receiving
our response to the delete.
2016-06-17 18:48:06 +02:00
Tobias Brunner 6270bbde6a ike-delete: Handle deletes while rekeying differently if there was a collision
We treat these as if we concluded the rekeying, the active ike-rekey task
will handle the collision afterwards.
2016-06-17 18:48:06 +02:00
Tobias Brunner 13da616118 ike-rekey: Add method to check if there was a rekey collision 2016-06-17 18:48:06 +02:00
Tobias Brunner 1cca20705a ikev2: Check for collisions after handling IKE deletion 2016-06-17 18:48:06 +02:00
Tobias Brunner 0a2cad40a6 unit-tests: Add tests for IKE/CHILD delete collisions 2016-06-17 18:48:06 +02:00
Tobias Brunner 144bebe4b2 child-delete: Reply as usual when concurrently rekeying the IKE_SA
As per RFC 7296, 2.25.2 (what we did before was the behavior described
in RFC 4718).
2016-06-17 18:48:06 +02:00
Tobias Brunner 7b3eccfff4 unit-tests: Add tests for IKE/CHILD rekey collisions 2016-06-17 18:48:05 +02:00
Tobias Brunner 869b7075fc child-create: Respond with TEMPORARY_FAILURE while rekeying/deleting IKE_SA 2016-06-17 18:48:05 +02:00
Tobias Brunner 83191e56b2 ike-rekey: Respond with TEMPORARY_FAILURE if CHILD_SAs are currently rekeyed/deleted/established 2016-06-17 18:48:05 +02:00
Tobias Brunner 7015994a94 unit-tests: Add tests for collisions between IKE_SA rekeying and deletion 2016-06-17 18:48:05 +02:00
Tobias Brunner 8a78e41f29 ike-rekey: Handle TEMPORARY_FAILURE notify 2016-06-17 18:48:05 +02:00
Tobias Brunner c0976a5e01 ike-rekey: Respond with TEMPORARY_FAILURE if we are deleting the SA 2016-06-17 18:48:05 +02:00
Tobias Brunner 72c295df5b unit-tests: Add tests for IKE SA deletion 2016-06-17 18:48:05 +02:00
Tobias Brunner 78e8152d01 ike-delete: No need to wait for a response in case of concurrent deletes
RFC 7296 explicitly says we SHOULD reply as usual and forget about our
own close request.
2016-06-17 18:48:05 +02:00
Tobias Brunner 40d9a4c892 unit-tests: Only deliver messages to the SA they are addressed to 2016-06-17 18:48:05 +02:00
Tobias Brunner 498a46d22f unit-tests: Add test for simple IKE rekey collision 2016-06-17 18:48:05 +02:00
Tobias Brunner bb3899739d ikev2: Add a new state to track rekeyed IKE_SAs
This makes handling such IKE_SAs more specifically compared to keeping them
in state IKE_CONNECTING or IKE_ESTABLISHED (which we did when we lost a
collision - even triggering the ike_updown event), or using IKE_REKEYING for
them, which would also be ambiguous.

For instance, we can now reject anything but DELETES for such SAs.
2016-06-17 18:48:05 +02:00
Tobias Brunner d6ac7496e6 ike-rekey: Add the name/ID of the redundant IKE_SAs to the log messages 2016-06-17 18:48:04 +02:00
Tobias Brunner b5695bbffc unit-tests: Add tests for IKE_SA rekeying 2016-06-17 18:48:04 +02:00
Tobias Brunner d7b3ee6cca unit-tests: Add asserts against IKE_SAs 2016-06-17 18:48:04 +02:00
Tobias Brunner 735bd4ca14 unit-tests: Make sure to flush the IKE_SA manager before destroying the sender
As the static plugin that creates and destroys the default sender was
not initialized because of the missing socket the daemon won't destroy
our sender.  Test cases will eventually have to flush the IKE_SA manager to
satisfy the leak detective.  However, in case of a test failure and if there
are IKE_SAs in the manager the daemon will flush the SAs when deinitializing,
which will cause deletes to get sent.  This crashes if the sender is already
destroyed.
2016-06-17 18:48:04 +02:00
Tobias Brunner b76c1decd4 unit-tests: Return status from process_message() 2016-06-17 18:48:04 +02:00
Tobias Brunner 7c6e0c2979 unit-tests: Use wrapper for add_listener in bus_t related asserts 2016-06-17 18:48:04 +02:00
Tobias Brunner 5d10ef316d unit-tests: Provide a wrapper around bus_t::add_listener and unregister them during cleanup
In case listeners on the stack are triggered while cleaning up after a
test failed (e.g. via ike_sa_manager_t::flush) remaining listeners defined on
the stack would cause a segmentation fault.
2016-06-17 18:48:04 +02:00
Tobias Brunner b7fac1d96e ike-sa-manager: Make sure rng is defined before destroying it in flush()
This allows calling flush() multiple times.
2016-06-17 18:48:04 +02:00
Tobias Brunner 851ee4eeb7 ike-rekey: Establish new IKE_SA earlier as responder, but only if no collision
Moving to the new SA only after receiving the DELETE for the old SA was
not ideal as it rendered the new SA unusable (because it simply didn't
exist in the manager) if the DELETE was delayed/got dropped.
2016-06-17 18:48:04 +02:00