]> git.ipfire.org Git - thirdparty/strongswan.git/log
thirdparty/strongswan.git
2 years agounit-tests: Make TLS echo server cancelable
Tobias Brunner [Mon, 5 Sep 2022 15:10:21 +0000 (17:10 +0200)] 
unit-tests: Make TLS echo server cancelable

Seems to be required on macOS (libtls tests didn't run before the recent
implicit enabling via pki).  Other platforms apparently let accept() fail
if the socket is shutdown/closed in teardown_creds(), macOS apparently
doesn't do that.

2 years agolibtls: Fix encoding of TLS 1.3 certificate extension as server
Tobias Brunner [Mon, 5 Sep 2022 11:06:20 +0000 (13:06 +0200)] 
libtls: Fix encoding of TLS 1.3 certificate extension as server

Same as 9664ef4ba60f ("libtls: Fixed encoding of TLS 1.3 certificate
extension") but for the server.

2 years agoUse wolfSSL 5.5.0 for tests
Tobias Brunner [Mon, 5 Sep 2022 09:11:49 +0000 (11:11 +0200)] 
Use wolfSSL 5.5.0 for tests

2 years agoVersion bump to 5.9.8dr2 5.9.8dr2
Andreas Steffen [Fri, 2 Sep 2022 04:32:13 +0000 (06:32 +0200)] 
Version bump to 5.9.8dr2

2 years agopki: pki --req can use old certreq as template
Andreas Steffen [Mon, 29 Aug 2022 08:34:58 +0000 (10:34 +0200)] 
pki: pki --req can use old certreq as template

When an X.509 certificate has to be renewed it is helpful to use
the old PKCS#10 certificate request as a template, so that the
distinguishedName (DN), the subjectAlternativeName (SAN) and
a certificate profile name don't have to be typed-in again.

The old public key in the existing certreq is replaced with the
new key and the signature is re-generated using the new private key.

2 years agopki: Fixed memory leak in pki --scep
Andreas Steffen [Sun, 28 Aug 2022 09:42:13 +0000 (11:42 +0200)] 
pki: Fixed memory leak in pki --scep

2 years agopki: Fixed filenames in pki --estca/--scepca man pages
Andreas Steffen [Fri, 26 Aug 2022 14:43:58 +0000 (16:43 +0200)] 
pki: Fixed filenames in pki --estca/--scepca man pages

2 years agoconnmark: Fix wrong plugin name in log message
Noel Kuntze [Sat, 20 Aug 2022 23:08:28 +0000 (01:08 +0200)] 
connmark: Fix wrong plugin name in log message

Closes strongswan/strongswan#1244

2 years agoVersion bump to 5.9.8dr1 5.9.8dr1
Andreas Steffen [Fri, 26 Aug 2022 10:32:04 +0000 (12:32 +0200)] 
Version bump to 5.9.8dr1

2 years agotesting: Fixed typo of mfg1 to mgf1 plugin
Andreas Steffen [Fri, 26 Aug 2022 10:31:33 +0000 (12:31 +0200)] 
testing: Fixed typo of mfg1 to mgf1 plugin

2 years agoMerge branch 'pki-scep'
Andreas Steffen [Fri, 26 Aug 2022 10:19:17 +0000 (12:19 +0200)] 
Merge branch 'pki-scep'

2 years agoleak_detective: Whitelist botan_privkey_load_rsa_pkcs1()
Andreas Steffen [Thu, 25 Aug 2022 08:48:55 +0000 (10:48 +0200)] 
leak_detective: Whitelist botan_privkey_load_rsa_pkcs1()

2 years agolibtls: the signature unit tests use scheme-specific credentials
Andreas Steffen [Wed, 24 Aug 2022 13:06:12 +0000 (15:06 +0200)] 
libtls: the signature unit tests use scheme-specific credentials

2 years agolibtls: call create_public_enumerator() with key_type
Andreas Steffen [Wed, 24 Aug 2022 10:01:51 +0000 (12:01 +0200)] 
libtls: call create_public_enumerator() with key_type

2 years agolibtls: enforce correct signature scheme for ECDSA keys
Andreas Steffen [Tue, 23 Aug 2022 21:52:39 +0000 (23:52 +0200)] 
libtls: enforce correct signature scheme for ECDSA keys

2 years agolibtls: unit tests with crypto libs need additional plugins
Andreas Steffen [Mon, 22 Aug 2022 12:33:00 +0000 (14:33 +0200)] 
libtls: unit tests with crypto libs need additional plugins

In order for libtls to run with the gcrypt libraryi, additionally the
random, pem, gcm, hmac, kdf, x509, constraints, and the curve2519
plugins are needed.

The botan library additionally need the hmac (for HMAC_MD5), x509 and
constraints plugins.

The wolfssl library additionally need the pkcs1, pkcs8, x509 and constraints
plugins.

2 years agolibtls: Fixed encoding of TLS 1.3 certificate extension
Andreas Steffen [Mon, 22 Aug 2022 12:27:48 +0000 (14:27 +0200)] 
libtls: Fixed encoding of TLS 1.3 certificate extension

2 years agopki: use libtls for pki --est|--estca
Andreas Steffen [Mon, 22 Aug 2022 10:42:09 +0000 (12:42 +0200)] 
pki: use libtls for pki --est|--estca

2 years agopki: --est adds --keyid and --certid options
Andreas Steffen [Sun, 21 Aug 2022 13:21:22 +0000 (15:21 +0200)] 
pki: --est adds --keyid and --certid options

With the --keyid option private keys stored on a smartcard or in
a TPM 2.0 can be used for public key based client authentication.

With the --certid option the corresponding client certificate
can reside on a smartcard or a TPM 2.0.

2 years agopki: Optimize certificate download for --scep and --est
Andreas Steffen [Sun, 21 Aug 2022 09:13:53 +0000 (11:13 +0200)] 
pki: Optimize certificate download for --scep and --est

2 years agolibtls: unit tests run with default plugins
Andreas Steffen [Fri, 19 Aug 2022 15:18:52 +0000 (17:18 +0200)] 
libtls: unit tests run with default plugins

The gcm plugin has been added to the default plugins and all
certificate types are loaded to allow the libtls socket unit
tests to run with the strongSwan default plugins.

2 years agolibtls: Send empty cert payload upon cert request
Andreas Steffen [Fri, 19 Aug 2022 15:09:02 +0000 (17:09 +0200)] 
libtls: Send empty cert payload upon cert request

Currently when a TLS client doesn't have a certificate, it doesn't
send a certficiate payload upon receiving a certificate request
from the TLS server. According to the TLS 1.2 and 1.3 RFCs an
empty certificate payload must be sent.

2 years agopki: use libtls for pki --est
Andreas Steffen [Fri, 19 Aug 2022 00:04:58 +0000 (02:04 +0200)] 
pki: use libtls for pki --est

2 years agopki: Created pki --est man page
Andreas Steffen [Tue, 16 Aug 2022 13:24:02 +0000 (15:24 +0200)] 
pki: Created pki --est man page

2 years agopki: Enroll an X.509 certificate with an EST server
Andreas Steffen [Mon, 15 Aug 2022 19:16:11 +0000 (21:16 +0200)] 
pki: Enroll an X.509 certificate with an EST server

2 years agopki: Created pki --estca man page
Andreas Steffen [Sun, 14 Aug 2022 02:51:23 +0000 (04:51 +0200)] 
pki: Created pki --estca man page

2 years agopki: Clean up SCEP functions
Andreas Steffen [Sun, 14 Aug 2022 02:29:44 +0000 (04:29 +0200)] 
pki: Clean up SCEP functions

2 years agopki: Get CA certs via EST (RFC 7030)
Andreas Steffen [Sat, 13 Aug 2022 10:31:44 +0000 (12:31 +0200)] 
pki: Get CA certs via EST (RFC 7030)

2 years agopkcs10: Support of Microsoft CertTypeExtension
Andreas Steffen [Wed, 10 Aug 2022 22:21:28 +0000 (00:21 +0200)] 
pkcs10: Support of Microsoft CertTypeExtension

The msCertificateTypeExtension OID (1.3.6.1.4.1.311.20.2) can
be used in a PKCS#10 certificate request to define a certificate
profile. It consists of an UTF8 string.

pki: profile option

2 years agoscepclient: Removal and replacement by pki subcommands
Andreas Steffen [Tue, 9 Aug 2022 08:15:36 +0000 (10:15 +0200)] 
scepclient: Removal and replacement by pki subcommands

The "ipsec scepclient" tool has been removed and replaced by the
pki subcommands "pki --scep" and "pki --scepca" which implement the
new SCEP RFC 8894 standard that was released in September 2020 and
which supports trusted "certificate renewal" based on the existing
client certificate.

2 years agopki: Additional pki.scep options for strongswan.conf
Andreas Steffen [Tue, 9 Aug 2022 05:38:06 +0000 (07:38 +0200)] 
pki: Additional pki.scep options for strongswan.conf

2 years agopki: Created pki --scep man page
Andreas Steffen [Sat, 6 Aug 2022 10:23:09 +0000 (12:23 +0200)] 
pki: Created pki --scep man page

2 years agopki: Enroll an X.509 certificate with a SCEP server
Andreas Steffen [Mon, 1 Aug 2022 09:57:41 +0000 (11:57 +0200)] 
pki: Enroll an X.509 certificate with a SCEP server

2 years agopki: Created pki --scepca man page
Andreas Steffen [Sat, 30 Jul 2022 12:21:50 +0000 (14:21 +0200)] 
pki: Created pki --scepca man page

2 years agopki: Get CA certs via SCEP
Andreas Steffen [Fri, 29 Jul 2022 04:48:41 +0000 (06:48 +0200)] 
pki: Get CA certs via SCEP

2 years agowolfssl: Rename `encrypt` methods to avoid conflicts with system headers
Fabrice Fontaine [Mon, 8 Aug 2022 07:52:19 +0000 (09:52 +0200)] 
wolfssl: Rename `encrypt` methods to avoid conflicts with system headers

Rename `encrypt` methods to avoid the following build failure when wolfSSL
is built with --enable-opensslextra:

In file included from ../../../../src/libstrongswan/utils/utils.h:59,
                 from ../../../../src/libstrongswan/library.h:101,
                 from wolfssl_common.h:29,
                 from wolfssl_aead.c:23:
wolfssl_aead.c:90:16: error: conflicting types for 'encrypt'; have '_Bool(union <anonymous>,  chunk_t,  chunk_t,  chunk_t,  chunk_t *)'
   90 | METHOD(aead_t, encrypt, bool,
      |                ^~~~~~~
../../../../src/libstrongswan/utils/utils/object.h:99:20: note: in definition of macro 'METHOD'
   99 |         static ret name(union {iface *_public; this;} \
      |                    ^~~~
In file included from /home/autobuild/autobuild/instance-5/output-1/host/powerpc64le-buildroot-linux-musl/sysroot/usr/include/wolfssl/wolfcrypt/wc_port.h:573,
                 from /home/autobuild/autobuild/instance-5/output-1/host/powerpc64le-buildroot-linux-musl/sysroot/usr/include/wolfssl/wolfcrypt/types.h:35,
                 from /home/autobuild/autobuild/instance-5/output-1/host/powerpc64le-buildroot-linux-musl/sysroot/usr/include/wolfssl/wolfcrypt/logging.h:33,
                 from /home/autobuild/autobuild/instance-5/output-1/host/powerpc64le-buildroot-linux-musl/sysroot/usr/include/wolfssl/ssl.h:35,
                 from wolfssl_common.h:64,
                 from wolfssl_aead.c:23:
/home/autobuild/autobuild/instance-5/output-1/host/powerpc64le-buildroot-linux-musl/sysroot/usr/include/unistd.h:149:6: note: previous declaration of 'encrypt' with type 'void(char *, int)'
  149 | void encrypt(char *, int);
      |      ^~~~~~~

Closes strongswan/strongswan#1201

2 years agoandroid: Slightly increase NDK version
Tobias Brunner [Mon, 15 Aug 2022 15:46:04 +0000 (17:46 +0200)] 
android: Slightly increase NDK version

This version was installed in the base image until Aug 1st (the other we
installed was not actually used for a while).

2 years agoeap-mschapv2: Fix compile warning/error when compiled with -Warray-bounds
Tobias Brunner [Mon, 15 Aug 2022 12:34:34 +0000 (14:34 +0200)] 
eap-mschapv2: Fix compile warning/error when compiled with -Warray-bounds

Since the allocated data was smaller than sizeof(eap_mschapv2_header_t),
the following compile error was triggered (with newer GCC versions):

eap_mschapv2.c: In function 'process_peer_success':
eap_mschapv2.c:945:12: error: array subscript 'eap_mschapv2_header_t[0]' is partly outside array bounds of 'unsigned char[6]' [-Werror=array-bounds]
  945 |         eap->code = EAP_RESPONSE;
      |            ^~
In file included from /usr/include/stdlib.h:587,
                 from ../../../../src/libstrongswan/utils/printf_hook/printf_hook.h:26,
                 from ../../../../src/libstrongswan/library.h:101,
                 from ../../../../src/libcharon/sa/eap/eap_method.h:28,
                 from eap_mschapv2.h:27,
                 from eap_mschapv2.c:18:
eap_mschapv2.c:944:15: note: object of size 6 allocated by '__builtin_alloca'
  944 |         eap = alloca(len);
      |               ^~~~~~

Closes strongswan/strongswan#1188
Closes strongswan/strongswan#1215

3 years agopkcs7: Allow for missing optional content field
Andreas Steffen [Thu, 28 Jul 2022 09:18:54 +0000 (11:18 +0200)] 
pkcs7: Allow for missing optional content field

The content field of type OCTET STRING of a ContentInfo object
with ContentType Data

  ContentInfo ::= SEQUENCE {
     contentType ContentType,
     content
        [0] EXPLICIT OCTET STRING OPTIONAL

is optional and can be missing if no data is available

3 years agoVersion bump to 5.9.7 5.9.7
Andreas Steffen [Fri, 29 Jul 2022 04:54:09 +0000 (06:54 +0200)] 
Version bump to 5.9.7

3 years agoNEWS: Add news for 5.9.7
Tobias Brunner [Tue, 26 Jul 2022 13:58:33 +0000 (15:58 +0200)] 
NEWS: Add news for 5.9.7

3 years agoike-cfg: Fix typo in method description
Tobias Brunner [Tue, 26 Jul 2022 12:35:42 +0000 (14:35 +0200)] 
ike-cfg: Fix typo in method description

3 years agomock-dh: Fix typo in comment
Tobias Brunner [Tue, 26 Jul 2022 08:03:23 +0000 (10:03 +0200)] 
mock-dh: Fix typo in comment

3 years agoVersion bump to 5.9.7rc1 5.9.7rc1
Andreas Steffen [Sat, 23 Jul 2022 12:38:36 +0000 (14:38 +0200)] 
Version bump to 5.9.7rc1

3 years agotesting: Increased memory of KVM instance sun
Andreas Steffen [Sat, 23 Jul 2022 12:36:50 +0000 (14:36 +0200)] 
testing: Increased memory of KVM instance sun

3 years agotesting: Replace deprecated tempfile command by mktemp
Andreas Steffen [Sat, 23 Jul 2022 09:28:08 +0000 (11:28 +0200)] 
testing: Replace deprecated tempfile command by mktemp

3 years agodhcp: Fix retransmission timeouts
Tobias Brunner [Wed, 20 Jul 2022 13:13:39 +0000 (15:13 +0200)] 
dhcp: Fix retransmission timeouts

The previous code did not ensure that there was a delay of at least
`try` seconds after each sent request.  Instead, whenever the condvar was
signaled, which could be due to retransmitted responses or messages for
unrelated transactions (there could even be spurious wakeups), the counter
was increased and a retransmit sent.  So instead of actually waiting for
15 seconds for a response (and sending 4 retransmits over that timespan),
it could happen that all five messages were sent within a second without
enough time to actually receive a response.

Using an absolute timeout that we reuse as long as there was no timeout
and the condvar was signaled for something unrelated, should ensure we
wait at least the intended delay after each sent message.

Closes strongswan/strongswan#1154

3 years agoconnmark: Consider configured mask in installed firewall rules
Tobias Brunner [Fri, 17 Jun 2022 10:10:19 +0000 (12:10 +0200)] 
connmark: Consider configured mask in installed firewall rules

This allows using the upper parts of the marks for other purposes.  For
instance, with `mark_in=mark_out=%unique/0x0000ffff` mark values in the
upper two bytes would not get reset by the rules installed by this plugin.
However, note that in this example the daemon would have to get restarted
after 65'535 CHILD_SAs to reset the counter for unique marks, which is a
global 32-bit counter that's unaware of any masks.

Closes strongswan/strongswan#1087

3 years agoaf-alg: Fix "'strncpy' specified bound equals destination size" warnings
Tobias Brunner [Mon, 18 Jul 2022 12:29:04 +0000 (14:29 +0200)] 
af-alg: Fix "'strncpy' specified bound equals destination size" warnings

3 years agoopenssl: Add support for AES and Camellia in CTR mode
Tobias Brunner [Tue, 31 May 2022 14:03:43 +0000 (16:03 +0200)] 
openssl: Add support for AES and Camellia in CTR mode

3 years agoaggressive-mode: Determine local identity before deriving keys
Tobias Brunner [Thu, 16 Jun 2022 14:36:04 +0000 (16:36 +0200)] 
aggressive-mode: Determine local identity before deriving keys

This might require a PSK, for which the local identity might be necessary.

3 years agochild-cfg: Skip non-matching TS instead of replacing them for transport mode
Tobias Brunner [Thu, 14 Jul 2022 11:22:55 +0000 (13:22 +0200)] 
child-cfg: Skip non-matching TS instead of replacing them for transport mode

get_traffic_selectors() is called the same way also as responder when
selecting child configs via peer_cfg_t::select_child_cfg().  Replacing
TS for all child configs could lead to selecting one that later fails
to actually narrow the traffic selectors.  Ignoring non-matching TS also
helps if we have a trap config with multiple remote subnets (otherwise,
we'd have to filter duplicates afterwards).

When installing traps, the hosts might be %any, in which case we allow
the configured (technically non-matching) TS for the wildcard use case.

Fixes: da82786b2d8c ("child-cfg: Always apply hosts to traffic selectors if proposing transport mode")
Closes strongswan/strongswan#1143

3 years agoconfigure: Add option to build with extended compiler warnings and -Werror
Tobias Brunner [Fri, 15 Jul 2022 08:42:56 +0000 (10:42 +0200)] 
configure: Add option to build with extended compiler warnings and -Werror

Setting -Werror in CFLAGS passed to configure is not ideal as that affects
all the checks performed by the script.

This caused an issue with newer versions of Autoconf and the AC_PROG_LEX
macro that insisted on finding a lexer library.  But due to warnings from
the generated test lexer (misleading indentation) that got turned into
errors no library was found (none would have been necessary), so LEX was
not set and no lexers were built.

With this option enabled, we add -Werror to CFLAGS after all tests ran.
It also enables additional warnings via -Wextra.

The option is auto-enabled when building from the repository.

3 years agolibfast: Fix incompatible function types warning
Tobias Brunner [Fri, 15 Jul 2022 12:48:02 +0000 (14:48 +0200)] 
libfast: Fix incompatible function types warning

3 years agoforecast: Fix incompatible function types warning
Tobias Brunner [Fri, 15 Jul 2022 11:50:43 +0000 (13:50 +0200)] 
forecast: Fix incompatible function types warning

3 years agotest-runner: Fix compiler warning
Tobias Brunner [Fri, 15 Jul 2022 11:01:29 +0000 (13:01 +0200)] 
test-runner: Fix compiler warning

Making the variable volatile avoids a "variable â€˜failure’ might be
clobbered by â€˜longjmp’" warning (or error when compiling with
-Werror) that's triggered via -Wextra.

3 years agoconfigure: Add noyywrap option to AC_PROG_LEX for Autoconf 2.70+
Tobias Brunner [Thu, 14 Jul 2022 07:52:21 +0000 (09:52 +0200)] 
configure: Add noyywrap option to AC_PROG_LEX for Autoconf 2.70+

FreeBSD packages 2.71 and that spits out a deprecation warning if we
don't set this.

3 years agoUse wolfSSL 5.4.0 for tests
Tobias Brunner [Tue, 12 Jul 2022 07:46:03 +0000 (09:46 +0200)] 
Use wolfSSL 5.4.0 for tests

The 5.4.0 update changed the default bignum implementation to what
could explicitly be enabled via `--enable-sp-math-all`.  Since this uses
fixed-sized buffers sufficient for key sizes of SP_INT_BITS, with a default
of 4096, modp6144 and modp8192 didn't work anymore (wc_DhGenerateKeyPair()
returned MP_EXPTMOD_E).  So we have to adapt the feature checks for this.

To support the larger DH groups we can either increase the buffer size
via `--with-max-rsa-bits` or add `--enable-heapmath` so buffers get
(re-)allocated as needed.  We go with the latter for now.

3 years agodoc: Removed the standards directory
Andreas Steffen [Tue, 12 Jul 2022 08:20:30 +0000 (10:20 +0200)] 
doc: Removed the standards directory

This collection of Internet standards and drafts hadn't been
updated for a long time and the documents are readily available
on the Internet anyway. The strongSwan documentation page

  https://docs.strongswan.org/docs/5.9/features/ietf.html

specifies which standards are currently supported.

3 years agopem: Support PEM-encoded PKCS#7 container
Andreas Steffen [Wed, 6 Jul 2022 18:38:00 +0000 (20:38 +0200)] 
pem: Support PEM-encoded PKCS#7 container

3 years agoVersion bump to 5.9.7dr2 5.9.7dr2
Andreas Steffen [Wed, 29 Jun 2022 09:33:34 +0000 (11:33 +0200)] 
Version bump to 5.9.7dr2

3 years agoMerge branch 'multi-ke-backport'
Tobias Brunner [Wed, 29 Jun 2022 08:29:16 +0000 (10:29 +0200)] 
Merge branch 'multi-ke-backport'

This merge includes changes that were created for the upcoming IKEv2
extension for multiple key exchanges over the last four years, but which
are not directly related to the actual protocol changes.

Changes include renaming diffie_hellman_t to the more generic
key_exchange_t (also renamed are some of the interface's methods),
making utility functions that deal with DH groups more generic, and let
tasks handle the first IKE_AUTH message more reliably by not depending
on e.g. specific message IDs.

One significant change is delaying the IKEv2 key derivation until
the keys are actually needed to process or send the next message.  So
instead of deriving the keys directly while processing an IKE_SA_INIT
request (which could come from a spoofed address), this is delayed until
the corresponding IKE_AUTH request is received.  Implementations of the
key_exchange_t interface are now expected to do the key derivation and
any costly public key validation in get_shared_secret() and not
set_public_key().

Sent IKE_SA_INIT messages are now also not pre-generated anymore to collect
their encoding for the authentication.  Instead, a new post_build() hook
allows the ike-auth task to do so after the actual message has been built,
which allows later tasks and plugins (via message() hook) to modify the
message (e.g. add notifies) after the ike-auth task's build() method
already ran.

Also changed is how inbound requests are processed and retransmits are
detected.  Instead of parsing all inbound messages right away (which
might trigger a key derivation or require keys we don't have anymore in
the multi-KE use case), we now first check a request's message ID and
compare its hash to that of the previous request to decide if it's a
valid retransmit.  For fragmented messages, we only keep track of the
first fragment so we can send the corresponding response immediately if
a retransmit of it is received, instead of waiting for all fragments
and reconstructing the message, which we did before.

3 years agounit-tests: Allow configuring log levels for individual groups
Tobias Brunner [Tue, 27 Jul 2021 16:37:26 +0000 (18:37 +0200)] 
unit-tests: Allow configuring log levels for individual groups

3 years agodebug: Support configuring different log levels for groups in default logger
Tobias Brunner [Mon, 26 Jul 2021 16:16:00 +0000 (18:16 +0200)] 
debug: Support configuring different log levels for groups in default logger

3 years agowolfssl: Move shared secret calculation to get_shared_secret()
Tobias Brunner [Fri, 23 Jul 2021 15:29:41 +0000 (17:29 +0200)] 
wolfssl: Move shared secret calculation to get_shared_secret()

The ECDH implementation gets a bit simpler since we removed the
ecp_x_coordinate_only option a while ago.

Also added calls to verify public keys.

3 years agopkcs11: Move shared secret calculation to get_shared_secret()
Tobias Brunner [Fri, 23 Jul 2021 15:25:19 +0000 (17:25 +0200)] 
pkcs11: Move shared secret calculation to get_shared_secret()

3 years agogcrypt: Move shared secret calculation to get_shared_secret()
Tobias Brunner [Fri, 23 Jul 2021 14:29:44 +0000 (16:29 +0200)] 
gcrypt: Move shared secret calculation to get_shared_secret()

3 years agocurve25519: Move shared secret calculation to get_shared_secret()
Tobias Brunner [Fri, 23 Jul 2021 13:38:27 +0000 (15:38 +0200)] 
curve25519: Move shared secret calculation to get_shared_secret()

3 years agobotan: Move shared secret calculation to get_shared_secret()
Tobias Brunner [Fri, 23 Jul 2021 12:53:15 +0000 (14:53 +0200)] 
botan: Move shared secret calculation to get_shared_secret()

3 years agogmp: Move shared secret calculation to get_shared_secret()
Tobias Brunner [Mon, 19 Jul 2021 15:27:53 +0000 (17:27 +0200)] 
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.

3 years agokey-exchange: Warn about costly operations in set_public_key()
Tobias Brunner [Mon, 19 Jul 2021 15:46:58 +0000 (17:46 +0200)] 
key-exchange: Warn about costly operations in set_public_key()

3 years agoike-auth: Move packet collection to post_build() method
Tobias Brunner [Mon, 19 Jul 2021 14:36:16 +0000 (16:36 +0200)] 
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.

3 years agoikev2: Delay IKE key derivation until next message
Tobias Brunner [Fri, 16 Jul 2021 15:39:12 +0000 (17:39 +0200)] 
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.

3 years agoikev2: Use hashes to detect retransmits
Tobias Brunner [Mon, 23 Jul 2018 15:49:15 +0000 (17:49 +0200)] 
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.

3 years agochild-sa: Cache and forward actual initiator flag for outbound SA
Tobias Brunner [Tue, 18 Aug 2020 07:40:17 +0000 (09:40 +0200)] 
child-sa: Cache and forward actual initiator flag for outbound SA

Kernel interfaces (e.g. TKM) might rely on this flag to be correct.

3 years agoikev2: Send deletes also for rekeyed SAs
Tobias Brunner [Wed, 17 Jun 2020 14:04:10 +0000 (16:04 +0200)] 
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.

3 years agoikev2: Let ike/child-rekey tasks indicate if the passive task was adopted
Tobias Brunner [Fri, 12 Jun 2020 09:24:18 +0000 (11:24 +0200)] 
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.

3 years agoike-rekey: Remove collision task type checks
Tobias Brunner [Thu, 11 Jun 2020 13:06:24 +0000 (15:06 +0200)] 
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.

3 years agoike-rekey: Don't actively rekey already rekeyed SAs
Tobias Brunner [Thu, 11 Jun 2020 12:33:22 +0000 (14:33 +0200)] 
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.

3 years agoike-init: Ignore COOKIE payloads during rekeying
Tobias Brunner [Thu, 9 Apr 2020 16:42:22 +0000 (18:42 +0200)] 
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.

3 years agoike-sa-manager: Log SPIs when checking in an IKE_SA
Tobias Brunner [Mon, 16 Jul 2018 13:48:30 +0000 (15:48 +0200)] 
ike-sa-manager: Log SPIs when checking in an IKE_SA

3 years agomessage: Fix payload type in last unprotected payload of a fragmented message
Tobias Brunner [Fri, 5 Jul 2019 09:01:42 +0000 (11:01 +0200)] 
message: Fix payload type in last unprotected payload of a fragmented message

3 years agoike-rekey: Reset IKE_SA after processing CREATE_CHILD_SA request
Tobias Brunner [Tue, 10 Jul 2018 12:36:28 +0000 (14:36 +0200)] 
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.

3 years agoikev2: Allow tasks to do work after processing requests/responses
Tobias Brunner [Thu, 22 Aug 2019 12:23:44 +0000 (14:23 +0200)] 
ikev2: Allow tasks to do work after processing requests/responses

3 years agotask: Add optional post_process() method
Tobias Brunner [Thu, 22 Aug 2019 12:22:48 +0000 (14:22 +0200)] 
task: Add optional post_process() method

This will allows tasks to do some work after a message has been
processed.

3 years agoikev2: Allow tasks to do work after generating requests/responses
Tobias Brunner [Thu, 28 Jun 2018 08:44:40 +0000 (10:44 +0200)] 
ikev2: Allow tasks to do work after generating requests/responses

3 years agotask: Add optional post_build() method
Tobias Brunner [Thu, 28 Jun 2018 08:44:03 +0000 (10:44 +0200)] 
task: Add optional post_build() method

This will allow tasks to do some work after the message has been
generated.

3 years agoike-auth: Support exchange between IKE_SA_INIT and IKE_AUTH
Tobias Brunner [Mon, 25 Jun 2018 12:27:16 +0000 (14:27 +0200)] 
ike-auth: Support exchange between IKE_SA_INIT and IKE_AUTH

3 years agochild-create: Support exchange between IKE_SA_INIT and IKE_AUTH
Tobias Brunner [Mon, 25 Jun 2018 12:14:59 +0000 (14:14 +0200)] 
child-create: Support exchange between IKE_SA_INIT and IKE_AUTH

3 years agoike-mobike: Support exchange between IKE_SA_INIT and IKE_AUTH
Tobias Brunner [Mon, 25 Jun 2018 12:03:56 +0000 (14:03 +0200)] 
ike-mobike: Support exchange between IKE_SA_INIT and IKE_AUTH

This changes the MID of the first IKE_AUTH message.

3 years agoike-config: Support exchange between IKE_SA_INIT and IKE_AUTH
Tobias Brunner [Mon, 25 Jun 2018 10:32:27 +0000 (12:32 +0200)] 
ike-config: Support exchange between IKE_SA_INIT and IKE_AUTH

This changes the MID of the first IKE_AUTH message.

3 years agoike-cert-post: Make absolutely sure certificates are only added to IKE_AUTH
Tobias Brunner [Mon, 25 Jun 2018 10:23:50 +0000 (12:23 +0200)] 
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.

3 years agoike-cert-pre: Support exchange between IKE_SA_INIT and IKE_AUTH
Tobias Brunner [Mon, 25 Jun 2018 10:07:50 +0000 (12:07 +0200)] 
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.

3 years agostatus: Add return_need_more() utility function
Tobias Brunner [Fri, 13 Jul 2018 12:52:05 +0000 (14:52 +0200)] 
status: Add return_need_more() utility function

3 years agochild-cfg: Generalize get_ke_method() method
Tobias Brunner [Fri, 20 Jul 2018 09:11:00 +0000 (11:11 +0200)] 
child-cfg: Generalize get_ke_method() method

3 years agoike-cfg: Generalize get_ke_method() method
Tobias Brunner [Thu, 19 Jul 2018 14:53:01 +0000 (16:53 +0200)] 
ike-cfg: Generalize get_ke_method() method

3 years agoproposal: Generalize KE methods
Tobias Brunner [Mon, 9 Jul 2018 14:27:04 +0000 (16:27 +0200)] 
proposal: Generalize KE methods

3 years agoRename MODP_NONE to KE_NONE
Andreas Steffen [Thu, 1 Jul 2021 17:42:55 +0000 (19:42 +0200)] 
Rename MODP_NONE to KE_NONE

3 years agoRename diffie_hellman_t to key_exchange_t and change the interface etc.
Tobias Brunner [Thu, 24 Oct 2019 07:49:14 +0000 (09:49 +0200)] 
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.

3 years agobliss: Remove stray URLs from headers
Tobias Brunner [Wed, 29 Jun 2022 08:27:54 +0000 (10:27 +0200)] 
bliss: Remove stray URLs from headers