Commit Graph
14669 Commits
Author SHA1 Message Date
Tobias Brunner 980491ebcd android: Replace PowerMock with mechanism provided by newer Mockito versions
PowerMock isn't maintained anymore and causes issues with newer Java
versions.  We only used it to mock static methods, which Mockito now
supports as well.  Instead of using the try-with-resources construct,
this uses a @Before and @After method so we don't have to change all the
test methods.
2024-01-16 11:00:29 +01:00
Tobias Brunner 1cab544c75 android: Update Gradle plugin and build scripts and dependencies
This also references the NDK via ndkVersion and replaces the custom
ndk-build tasks.  It also replaces the deprecated compileSdkVersion and
increases it because dependencies of updated dependencies require that.

targetSdkVersion is not yet updated because there might be some work
required for Android 14 compatibility.
2024-01-16 11:00:29 +01:00
Tobias Brunner 2b74b63691 github: Increase timeout for process_t tests
This seems to be necessary on macOS 12 for some reason (note that handling
timeouts in these test cases doesn't really work).
2024-01-16 11:00:29 +01:00
Tobias Brunner fea02fb297 simaka-crypto: Fix constructor declaration
Prototype didn't match the implementation.
2024-01-16 11:00:29 +01:00
Tobias Brunner 52d6189892 unit-tests: Use function pointers to test generic return_* helper functions
These functions are declared without arguments, passing arguments to them
causes warnings such as the following with newer compilers:

  passing arguments to 'return_null' without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]

We only use them via function pointers, which doesn't trigger any warnings
and hopefully continues to work.
2024-01-16 11:00:29 +01:00
Tobias Brunner bf017a9d17 curl: Fix issue with printf checks in newer curl versions
Newer curl versions (as used on macOS via Homebrew) add attributes like

  __attribute__ ((format(printf, a, b)))

to their `curl_*printf*` functions, which fails if we redefine `printf`
as e.g. `builtin_printf` (pulled in via library.h).  We could disable
these checks via CURL_NO_FMT_CHECKS, but reordering the headers should
do the trick as well.
2024-01-16 11:00:29 +01:00
Tobias Brunner 67f0990530 Suppress compiler warnings with specific bison and compiler combinations
Bison generates code that only increases the yynerrs counter, it's never
read.  This causes a warning in newer compilers (in particular clang).
Newer versions of bison mark yynerrs with __attribute__((unused)), but
at least on FreeBSD 14 that's not yet available.
2024-01-16 11:00:29 +01:00
Tobias Brunner 22fc539edd leak-detective: Add implementation of malloc_usable_size()
systemd seems to use this and if we indirectly use libraries provided
by it, which can e.g. happen via getgrnam_r() and nss-systemd, this may
be called on pointers returned by leak detective's malloc(), which will
not point to the original start of the block and cause a segmentation
fault.

Closes strongswan/strongswan#2045
2024-01-16 10:59:59 +01:00
Tobias Brunner fff2996a22 ipsec: Remove mention of NETKEY stack 2023-12-14 11:27:25 +01:00
Tobias Brunner 7550463d51 Replace some other mentions of "Linux strongSwan" 2023-12-14 11:27:19 +01:00
Jose Luis Duran 454069e094 ipsec: strongSwan is not exclusive to Linux kernels
The project is now called "the strongSwan project" rather than "Linux
strongSwan" to better reflect this.
2023-12-09 18:42:27 +00:00
Tobias Brunner 9c4846cdbe x509: Make sure the status in OCSP responses has the correct length 2023-11-24 17:41:18 +01:00
Tobias Brunner f3af1704d9 x509: Make length of nonces in OCSP requests configurable
Some servers might not support a length of 32 and return a malformed
request error. Lowering the value to the previous default of 16 could
help in that case.
2023-11-24 17:41:18 +01:00
Tobias Brunner 945be4ece5 pki: Generate internal error OCSP response if no signer certificate is found
That can happen if a request is sent to the wrong OCSP server.
2023-11-24 17:41:18 +01:00
Tobias Brunner 05a1f5b9c5 certificate-printer: Add some output for empty OCSP responses 2023-11-24 17:41:18 +01:00
Tobias Brunner 6d345b3dde revocation: Reject OCSP error responses
Otherwise, there is lengthy code that tries to validate such responses,
even though they don't contain any signatures.
2023-11-24 17:41:18 +01:00
Tobias Brunner b3e66aca5c x509: Add getter for status of OCSP responses 2023-11-24 17:41:18 +01:00
Tobias Brunner e7a58f46f9 x509: Correctly parse responderId as ASN.1 CHOICE in OCSP response
The two OPTs that were used previously allowed to omit it completely (hence
the fallback to ID_ANY), but that's invalid, so it's better to fail
parsing.
2023-11-24 17:41:18 +01:00
Tobias Brunner 585c40095a x509: Correctly handle missing responder ID when parsing OCSP response errors
The has_issuer() and issued_by() methods relied on it to be defined, so
if the OCSP response wasn't successful (i.e. OCSP status indicates an
error and no OCSP response is parsed), a null-pointer dereference was
caused if the caller checked if the OCSP response was issued by a
specific certificate.

That's a side-effect of the referenced commit.  Previously, error codes
caused the OCSP response to not get parsed successfully, which technically
wasn't correct as it's well formed and successfully parsed, it's just
indicating an error state.

Fixes: 00ab8d62c0 ("x509: Support generation of OCSP responses")
2023-11-24 17:41:18 +01:00
Andreas Steffen da45cf9f38 cert-enroll: Set the environment variables needed by cert-install-ssl 2023-11-23 19:05:22 +01:00
Tobias Brunner 96d7937189 charon-tkm: Validate DH public key to fix potential buffer overflow
Seems this was forgotten in the referenced commit and actually could lead
to a buffer overflow.  Since charon-tkm is untrusted this isn't that
much of an issue but could at least be easily exploited for a DoS attack
as DH public values are set when handling IKE_SA_INIT requests.

Fixes: 0356089d0f ("diffie-hellman: Verify public DH values in backends")
Fixes: CVE-2023-41913
2023-11-17 17:24:34 +01:00
Tobias Brunner 74ae71d2b8 x509: Ensure extensions are encoded even if others are missing
As with the previous commit, this is probably never an issue in practice
as most certificates contain at least one SAN.
2023-11-15 17:08:46 +01:00
Tobias Brunner ba08e01b86 x509: Also encode extendedKeyUsage in cert requests if there are no SANs or certificate type
Probably never was an issue in practice as most certificates contain at
least one SAN.
2023-11-15 17:01:02 +01:00
Tobias Brunner 14cc5b845e pki: Mention --index in description 2023-11-15 15:16:51 +01:00
Tobias Brunner 724e64cac4 Move ocsp_responder_t interface as it's not a certificate 2023-11-14 10:35:47 +01:00
Tobias Brunner 14bd0bc743 Fixed some typos, courtesy of codespell 2023-11-14 10:11:16 +01:00
Andreas Steffen 6941dcb17a x509: Fix regression introduced by commit a22147a
Instead of the CA certificate's subjectKeyIdentifier erroneously
the CA's authorityKeyIdentifier was used as the authorityKeyIdentfier
of the certificate to be issued. This might work with a root CA
where the authorityKeyIdentifier equals its subjectKeyIdentfier
but introduces a severe regression when an intermediate CA is used.
2023-11-14 08:00:27 +01:00
Tobias Brunner 5764e1e506 pki: Pre-process common arguments
This way the position of --debug doesn't matter for it to apply to the
parsing of all command-specific arguments.
2023-11-13 12:50:47 +01:00
Tobias Brunner 95c7d49954 pki: Add option to load certificate status information from index.txt
Each index.txt is associated with the most recently loaded CA
certificate.
2023-11-13 12:50:47 +01:00
Tobias Brunner f26ca67d8c pki: Add index.txt-based OCSP responder 2023-11-13 12:50:47 +01:00
Tobias Brunner 1e8a72e7a0 chunk: Add helper to hash chunks via pointer 2023-11-13 12:50:47 +01:00
Tobias Brunner 3e42b2f5cb pki: Drop legacy registration for OCSP responders 2023-11-13 12:50:45 +01:00
Tobias Brunner efac611566 openxpki: Register as OCSP responder 2023-11-13 12:50:24 +01:00
Tobias Brunner 515cecfe3e pki: Use OCSP responder manager for --ocsp --respond 2023-11-13 12:50:22 +01:00
Tobias Brunner dab7c893a6 library: Add manager for OCSP responders
Registered OCSP responders should return VALIDATION_SKIPPED for issuer
certificates they are not responsible for. However, VALIDATION_FAILED is
currently treated the same way, so that's fine as well.
2023-11-13 12:45:54 +01:00
Andreas Steffen 821d7784a3 man: Extended pki man page and added pki --ocsp man page 2023-11-13 12:40:58 +01:00
Andreas Steffen a0c9f9b842 pki: Added ocsp command
The pki --ocsp command implements an OCSP responder.
2023-11-13 12:40:58 +01:00
Andreas Steffen ec325b4c09 pki: Added ocsp-req and ocsp-rsp types to pki --print 2023-11-13 12:40:58 +01:00
Andreas Steffen a0f672d3d1 unit-tests: Update test_serial_gen suite 2023-11-13 12:40:55 +01:00
Andreas Steffen 00ab8d62c0 x509: Support generation of OCSP responses 2023-11-13 12:40:55 +01:00
Andreas Steffen aa0fe149d6 certificates: Added ocsp_single_response object 2023-11-13 12:40:55 +01:00
Andreas Steffen 199c7083e1 openxpki: OCSP responder plugin accessing OpenXPKI
The openxpki plugin directly access the certificates table in
the OpenXPKI's MariaDB in order to retrieve the status of an
issued X.509 certificate based on its serial number.
2023-11-13 12:40:55 +01:00
Andreas Steffen 24d45de633 crl-reason: Fixed typo 2023-11-13 12:40:52 +01:00
Andreas Steffen d72d0c0dfa utils: Added chunk_to_dec() function 2023-11-13 12:39:10 +01:00
Andreas Steffen 9381559754 x509: Support parsing of OCSP requests 2023-11-13 12:39:10 +01:00
Andreas Steffen 09e2a9ff50 pki --pkcs7: Set default to res = 1 2023-11-13 12:39:10 +01:00
Tobias Brunner 3cb8434367 kernel-netlink: Don't add replay state twice when updating SAs
The kernel includes the XFRMA_REPLAY_ESN_VAL attribute when dumping
SAs since it was added with 2.6.39.  So we basically added this attribute
twice to the message sent to the kernel, potentially exceeding the
message buffer if the window size is large.

The XFRMA_REPLAY_VAL attribute is only dumped since 3.19, so that might
still be relevant (Google seems to maintain a 3.18 kernel) and since we
have to query the current lifetime stats anyway, we can just avoid adding
this attribute twice.

Closes strongswan/strongswan#1967
2023-11-13 12:36:57 +01:00
Tobias Brunner 9c2ca27b62 identification: Support explicit uri: prefix for SANs of type uniformResourceIdentifier 2023-11-13 12:33:39 +01:00
Tobias Brunner 500cacf6d8 x509: Add support to encode SANs of type uniformResourceIdentifier 2023-11-13 12:33:39 +01:00
Tobias Brunner a22147a1b2 x509: Use issuer certificate's subjectKeyIdentifier if available
Instead of just generating an authorityKeyIdentifier based on the
issuer's public key, this allows CA certificates to be issued by a
different tool that doesn't use a SHA-1 hash of the subjectPublicKey
for the subjectKeyIdentifier.

Closes strongswan/strongswan#1992
References strongswan/strongswan#1975
2023-11-13 12:32:32 +01:00