Commit Graph
1137 Commits
Author SHA1 Message Date
Martin Willi a336aefa89 curl: For SSL features, depend on thread-safety provided by our crypto plugins
To use SSL in curl, we need to initialize the SSL library in a thread-safe
manner and provide the appropriate callbacks. As we already do that in our
crypto plugins using these libraries, we depend on these features.

This implies that we need the same plugin enabled (openssl, gcrypt) as the
curl backend is configured to use to fetch from HTTPS URIs.
2014-09-24 17:35:16 +02:00
Martin Willi d717b42b51 curl: Dynamically query supported protocols and register appropriate features 2014-09-24 11:35:59 +02:00
Martin Willi 85c95db17a curl: Try to initialize with SSL support to handle https:// URIs
If initialization fails, we fall back to the old behavior.
2014-09-24 11:35:59 +02:00
Martin Willi 5421092b75 plugin-loader: Support a reload() callback for static features 2014-09-22 13:55:12 +02:00
Tobias Brunner 7e433456fc curl: Log error code too
It seems libcurl does not always return an error message.
2014-09-09 10:56:14 +02:00
Tobias Brunner 5818467639 openssl: Report correct key length for EC keys when not using NIST curves
Fixes #688.
2014-09-02 08:15:17 +02:00
Tobias Brunner 118b2879aa winhttp: Do not use countof() on pointer argument 2014-07-02 12:38:45 +02:00
Martin Willi 6fb1283242 gcrypt: Use predefined pthread locking functions instead of custom hooks
Starting with libgcrypt 1.6, it seems that custom locking functions are not
supported anymore. Instead, the user has to select from one of the pre-defined
set of locking functions.

Given that we have a proper threading abstraction API with optional profiling
on all platforms, this is somewhat annoying. However, there does not seem to be
a way to use custom functions, and we have no other choice than using the
provided macro magic to support all libgcrypt versions.

Fixes #630.
2014-07-01 12:23:19 +02:00
Martin Willi 866514c70c charon: Set CLOEXEC flag on daemon PID file and /dev/(u)random source FDs
On Fedora, SELinux complains about these open file descriptors when the
updown script invokes iptables. While it seems difficult to set the flag
on all file descriptors, this at least fixes those covered by the SELinux
policy.

As these two cases are in code executed while the daemon is still single
threaded, we avoid the use of atomic but not fully portable fdopen("e") or
open(O_CLOEXEC) calls.

Fixes #519.
2014-06-24 15:26:38 +02:00
Martin Willi b384daafde winhttp: Fix a typo to properly release connection handle
Fixes a rather large memory leak in HTTP fetches.
2014-06-19 11:09:20 +02:00
Tobias Brunner 846fd70eec sshkey: Fix loading of ECDSA keys from files 2014-06-18 09:16:24 +02:00
Tobias Brunner 1cda692110 sshkey: Add support to parse SSH public keys from files with left|rightsigkey 2014-06-18 09:16:24 +02:00
Martin Willi 8a072fc50a winhttp: Support basic authentication for URLs having credentials 2014-06-04 16:34:16 +02:00
Martin Willi 2e0816e1df winhttp: Support new response code fetcher option 2014-06-04 16:34:15 +02:00
Martin Willi 6f90fc8061 winhttp: Implement a http(s) fetcher based on Microsofts WinHTTP API 2014-06-04 16:34:15 +02:00
Martin Willi c079c098c4 x509: Check return value when signing attribute certificates
In addition that this lets AC generation fail properly if private key signing
fails, it also fixes an issue when compiling on Windows with MinGW 4.8.1, where
for some reason the attributeCertificateInfo got encoded incorrectly.
2014-06-04 15:53:12 +02:00
Martin Willi d34d800c6c openssl: Don't re-enter FIPS mode if we are already using it
If FIPS mode has been enabled by other means, under some environments it can't
be entered again. It fails with "FIPS mode already set". To avoid it, we first
check the mode before changing it.
2014-06-04 15:53:11 +02:00
Martin Willi 93168c5f1d openssl: Be less verbose about FIPS mode when not running as daemon
While this is valuable information, printing it for pki and other tools is
annoying.
2014-06-04 15:53:09 +02:00
Martin Willi 9df2a04a93 sqlite: Avoid name clash when building on Windows 2014-06-04 15:53:04 +02:00
Martin Willi 8e1c0d15a9 mysql: Add Windows support
As the mysql_config script is not available for Windows, we use a hardcoded
library name and no additional CFLAGS. This builds fine against the binary
MySQL Connector/C distribution.
2014-06-04 15:53:04 +02:00
Martin Willi 06c33ebf6a openssl: Fix includes to prevent <winsock2.h> to complain about include order 2014-06-04 15:53:03 +02:00
Martin Willi 4f310a2e75 openssl: Undef OpenSSLs X509_NAME defined by <wincrypt.h> 2014-06-04 15:53:02 +02:00
Martin Willi b7a4d44bd0 openssl: Check and link against libeay32 instead of libcrypto on Windows
Most Windows OpenSSL builds come with the crypto library named libeay32.
2014-06-04 15:53:02 +02:00
Martin Willi 8f3a3656d3 sha1: Include <library.h> instead of directly including <arpa/inet.h>
On Windows we don't have <arpa/inet.h>
2014-06-04 15:53:02 +02:00
Martin Willi 2dbb719b76 x509: Undef OCSP_RESPONSE from <wincrypt.h> before using it 2014-06-04 15:53:02 +02:00
Martin Willi 4163421f91 plugins: Don't link with -rdynamic on Windows 2014-06-04 15:53:02 +02:00
Martin Willi 2e6c203bad windows: Provide wrappers for dlopen() function family 2014-06-03 12:24:34 +02:00
Tobias Brunner e14507cb71 curl: Don't set CURLOPT_FAILONERROR
With the strongTNC REST API some errors will actually be accompanied by
a response we want to receive completely.
2014-05-31 20:37:55 +02:00
Tobias Brunner 271c2dd24e soup: Add support to retrieve the response code 2014-05-19 14:29:48 +02:00
Tobias Brunner 703a0b4c3e curl: Add support to return the response code 2014-05-19 14:28:40 +02:00
Martin Willi 9ee8b3b41f enum: Don't directly include enum.h
To allow enum.h to depend on utils.h definitions, avoid its direct inclusion.
Instead include utils.h, which includes enum.h as well.
2014-05-16 15:42:07 +02:00
Martin Willi 0746e38c51 unbound: Explicitly cast from ldns RR type/class to our types
These definitions are directly derived from the RFC, so it should be safe
to cast them. clang complains about the different types, so cast them
explicitly.
2014-05-16 15:42:06 +02:00
Martin Willi fb515325cc x509: Remove some unused ASN1 OID constants 2014-05-16 15:42:06 +02:00
Martin Willi d3cf9ca322 aes: Remove unused build variants
The AES code historically has different build options for various size/speed
trade-offs. We never made use of them, so just drop the obsolete code. The code
now has four hard-coded fixed tables, both inverse and original.
2014-05-16 15:42:06 +02:00
Andreas Steffen a81bd670b0 Added PUBKEY_RSA_MODULUS encoding type 2014-05-02 19:50:43 +02:00
Tobias Brunner 24ea377458 sqlite: Allow query arguments to be freed before starting the enumeration
By marking the string/blob arguments as transient, SQLite will copy and
free them automatically.
2014-04-30 09:37:32 +02:00
Tobias Brunner f7d04ba6c4 x509: Don't include authKeyIdentifier in self-signed certificates
As the comment indicates this was the intention in
d7be290643 all along.
2014-04-09 16:06:18 +02:00
Tobias Brunner 3f3680ec3f x509: Initialize certs when building optionalSignature for OCSP requests 2014-04-09 16:06:17 +02:00
Andreas Steffen 98ae0492b6 Added support for msSmartcardLogon EKU 2014-04-08 13:09:03 +02:00
Andreas Steffen 6a44fcf929 Initialize m1 to suppress compiler warning 2014-04-07 13:29:39 +02:00
Tobias Brunner a800253fbf test-vectors: Renumber AES-GCM test vectors according to original source
Also adds several missing ones.
2014-03-31 16:38:30 +02:00
Martin Willi e5d73b0dfa aead: Support custom AEAD salt sizes
The salt, or often called implicit nonce, varies between AEAD algorithms and
their use in protocols. For IKE and ESP, GCM uses 4 bytes, while CCM uses
3 bytes. With TLS, however, AEAD mode uses 4 bytes for both GCM and CCM.

Our GCM backends currently support 4 bytes and CCM 3 bytes only. This is fine
until we go for CCM mode support in TLS, which requires 4 byte nonces.
2014-03-31 15:56:12 +02:00
Martin Willi 94fb33bb88 revocation: Log error if no OCSP signer candidate found
Fixes evaluation of ikev2/ocsp-untrusted-cert.
2014-03-31 15:02:17 +02:00
Martin Willi 91d71abb16 revocation: Restrict OCSP signing to specific certificates
To avoid considering each cached OCSP response and evaluating its trustchain,
we limit the certificates considered for OCSP signing to:

- The issuing CA of the checked certificate
- A directly delegated signer by the same CA, having the OCSP signer constraint
- Any locally installed (trusted) certificate having the OCSP signer constraint

The first two options cover the requirements from RFC 6960 2.6. For
compatibility with non-conforming CAs, we allow the third option as exception,
but require the installation of such certificates locally.
2014-03-31 14:40:33 +02:00
Martin Willi a844b65890 revocation: Don't merge auth config of CLR/OCSP trustchain validation
This behavior was introduced with 6840a6fb to avoid key/signature strength
checking for the revocation trustchain as we do it for end entity certificates.
Unfortunately this breaks CA constraint checking under certain conditions, as
we merge additional intermediate/CA certificates to the auth config.

As key/signature strength checking of the revocation trustchain is a rather
exotic requirement we drop support for that to properly enforce CA constraints.
2014-03-31 14:40:33 +02:00
Tobias Brunner 5119c5fe97 x509: CERT_DECODE actually requires KEY_ANY
More specific decoders might still be needed, but the x509
plugin should not care which ones.
2014-03-31 14:32:44 +02:00
Tobias Brunner 0524028054 pkcs1: KEY_ANY public key decoder soft depends on specific decoders 2014-03-31 14:32:44 +02:00
Martin Willi 5ac0e66879 acert: Implement a plugin finding, validating and evaluating attribute certs
This validator checks for any attribute certificate it can find for validated
end entity certificates and tries to extract group membership information
used for connection authorization rules.
2014-03-31 11:14:58 +02:00
Martin Willi b06283f1e3 x509: Match acert has_subject() against entityName or holder serial
This allows us to find attribute certificates for a subject certificate in
credential sets.
2014-03-31 11:14:58 +02:00
Martin Willi 0226ca886d pem: Support encoding of attribute certificates
While there is no widely used PEM header for attribute certificates, at least
IAIK-JCE uses BEGIN ATTRIBUTE CERTIFICATE:

  http://javadoc.iaik.tugraz.at/iaik_jce/current/iaik/utils/Util.html#toPemString(iaik.x509.attr.AttributeCertificate)
2014-03-31 11:14:58 +02:00