Commit Graph
4103 Commits
Author SHA1 Message Date
Tobias Brunner 7550463d51 Replace some other mentions of "Linux strongSwan" 2023-12-14 11:27:19 +01: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 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
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 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 1e8a72e7a0 chunk: Add helper to hash chunks via pointer 2023-11-13 12:50:47 +01:00
Tobias Brunner efac611566 openxpki: Register as OCSP responder 2023-11-13 12:50:24 +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 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
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
Tobias Brunner 799511d90f pkcs12: Add support for PKCS#12 containers with empty or no password 2023-11-13 12:26:07 +01:00
Tobias Brunner bdd8f14354 pkcs7: Add supported for unprotected PKCS#7 encrypted-data 2023-11-13 12:26:07 +01:00
Tobias Brunner dc704cf206 pkcs8: Add support for unprotected PKCS#8 containers 2023-11-13 12:26:07 +01:00
Tobias Brunner ad804fa036 pkcs12: Treat empty string and no password differently
When deriving the PKCS#12 key, the empty string should result in a
non-zero length Unicode string (two bytes for the 0 terminator).
2023-11-13 12:26:07 +01:00
Tobias Brunner 7bb6aed5ab openssl: Add support for unprotected PKCS#12 containers 2023-11-13 12:26:07 +01:00
Tobias Brunner 1589f2d9ae constraints: Add support for IP address nameConstraints 2023-11-13 12:23:33 +01:00
Tobias Brunner 1c3096fe50 openssl: Add support for IP address nameConstraints 2023-11-13 12:23:33 +01:00
Tobias Brunner ede96fe3db x509: Add support for IP address nameConstraints
According to RFC 5280, section 4.2.1.10, these are encoded as address
followed by a network mask of the same length.
2023-11-13 12:23:33 +01:00
Tobias Brunner f781b9d326 openssl: Add support for nameConstraints X.509 extension
Closes strongswan/strongswan#1990
2023-11-13 12:23:02 +01:00
Tobias Brunner 04c17ab56a credential-manager: Add option to reject trusted end-entity certificates
This allows preventing peers from authenticating with certificates
that are locally trusted, in particular, our own local certificate (which
safeguards against accidental reuse of certificates on multiple peers).

On the other hand, if this option is enabled, end-entity certificates
for peers can't be configured anymore explicitly (e.g. via remote.certs
in swanctl.conf).
2023-11-13 12:01:41 +01:00
Tobias Brunner bb14a28671 unit-tests: Add a test case for explicit ECDSA parameters
Currently only warns about it as older OpenSSL versions (AppVeyor)
don't reject them.
2023-10-13 09:10:46 +02:00
Tobias Brunner 0b989c7b20 botan: Reject EC keys with explicitly encoded parameters
This requires a function that will be added in the upcoming Botan 3.2
release.
2023-10-13 09:10:46 +02:00
Tobias Brunner 2bccdefc2c openssl: Reject EC keys with explicitly encoded parameters
EC_KEY_decoded_from_explicit_params() was added with 1.1.1h but has been
deprecated with 3.0.
2023-10-13 09:10:46 +02:00
Tobias Brunner a69184fb9d wolfssl: Reject EC keys with explicitly encoded parameters
These are not allowed in X.509 certificates according to RFC 5480 and
some newer validations apparently explicitly check for this.

Note that WolfSSL rejects such keys, by default.  Only when compiled with
WOLFSSL_NO_ASN_STRICT are they accepted.
2023-10-13 09:10:46 +02:00
Tobias Brunner ba9228ab00 watcher: Change handling of POLLERR and remove WATCHER_EXCEPT
We can't actually explicitly listen for errors by passing POLLERR in
`events` (the man page for poll() clearly states it's ignored).  On the
other hand, POLLERR can be returned for any FD and, even worse, it might
be the only event indicated.

The latter caused an infinite loop as we didn't notify the callback nor
clear the error by calling `getsockopt(..., SOL_SOCKET, SO_ERROR, ...)`.
And while the latter would be able to reset the state to break the loop,
it seems to leave the FD in a defunct state where no further events will
be returned by poll().  Notifying the callback works better (the error
is then reported by e.g. recvfrom()) and automatically happened already
if POLLERR was returned together with e.g. POLLIN.

So we now treat POLLERR like the other error indicators we handle (POLLHUP
and POLLINVAL) and just notify the callbacks.
2023-07-26 15:14:50 +02:00
Tobias Brunner e0e99c1dd3 sha3: Make sure to wipe the internal Keccak state 2023-07-26 15:08:33 +02:00
Tobias Brunner bbbd15dd5c pkcs12: Make sure to wipe potentially decrypted PKCS#7 data 2023-07-26 15:08:33 +02:00
Tobias Brunner b4694aef49 pkcs7: Make sure to wipe decrypted content 2023-07-26 15:08:33 +02:00
Tobias Brunner ad8484a6cc aesni: Make sure to wipe salt 2023-07-26 15:08:33 +02:00
Tobias Brunner 9bda4a4415 ccm: Make sure to wipe salt 2023-07-26 15:08:33 +02:00
Tobias Brunner 0abb37b830 gcm: Make sure to wipe salt and H 2023-07-26 15:08:33 +02:00
Tobias Brunner 36b1a6d76c Use Botan 3.1.1 for tests
The all-zero Ed25519 public key is rejected by botan_pubkey_check_key()
when the key is loaded.

Note that Botan 3 requires GCC 11 or CLANG 14, i.e. can't easily be built
on Debian bullseye or Ubuntu 20.04.

The thread-local storage function gets flagged via various botan FFI
functions when using Botan 3, whitelist that instead of all of them.
2023-07-26 13:09:22 +02:00
Tobias Brunner fbc25f1c25 leak-detective: Whitelist C++'s __cxa_get_globals() 2023-07-13 10:48:53 +02:00