Commit Graph

3082 Commits

Author SHA1 Message Date
Andreas Steffen d35143bb8d Fixed two BLISS key type identifier strings 2015-03-16 17:08:14 +01:00
Tobias Brunner 1735d80f38 files: Add simple plugin to load files from file:// URIs 2015-03-09 16:08:52 +01:00
Tobias Brunner 11ac1dff9c scheduler: Add method to remove all scheduled jobs
References #840.
2015-03-09 15:57:57 +01:00
Tobias Brunner 1bfa5e0cac plugin-loader: Increase log level for warning about plugin features that failed to load
Since we can't get rid of all unmet dependencies (at least not in every
possible plugin configuration) the message is more confusing than
helpful.  In particular because a detailed warning about plugin features
that failed to load due to unmet dependencies is only logged on level 2.
2015-03-09 15:45:29 +01:00
Tobias Brunner e5009fbb66 pkcs11: Convert RFC 3279 ECDSA signatures when verifying
References #873.
2015-03-09 15:37:07 +01:00
Tobias Brunner b258ed0192 pkcs11: Properly encode RFC 3279 ECDSA signatures
Fixes #873.
2015-03-09 15:37:07 +01:00
Tobias Brunner 8c9a0b5fb5 pkcs11: Properly encode EC_POINTs created on a token
Some tokens might not fail when creating EC public keys in the incorrect
format, but they will later not be able to use them to verify signatures.

References #872.
2015-03-09 15:37:01 +01:00
Tobias Brunner 4aab3153a4 pkcs11: Properly handle EC_POINTs returned as ASN.1 octet string
This is the correct encoding but we internally only use unwrapped keys
and some tokens return them unwrapped.

Fixes #872.
2015-03-09 15:36:07 +01:00
Tobias Brunner 6133770db4 x509: Use subjectKeyIdentifier provided by issuer cert when checking CRL issuer
Some CAs don't use SHA-1 hashes of the public key as subjectKeyIdentifier and
authorityKeyIdentifier.  If that's the case we can't force the
calculation of the hash to compare that to authorityKeyIdentifier in the CRL,
instead we use the subjectKeyIdentifier stored in the issuer certificate, if
available.  Otherwise, we fall back to the SHA-1 hash (or comparing the
DNs) as before.
2015-03-06 16:49:12 +01:00
Tobias Brunner 1d384bf8aa hash-algorithm-set: Add class to manage a set of hash algorithms 2015-03-04 13:54:11 +01:00
Tobias Brunner 83dcb2d46d credential-manager: Store BLISS key strength in auth config 2015-03-04 13:54:11 +01:00
Tobias Brunner ddb09a0603 auth-cfg: Add BLISS key strength constraint 2015-03-04 13:54:11 +01:00
Tobias Brunner 1f648d756b public-key: Add helper to determine acceptable signature schemes for keys 2015-03-04 13:54:10 +01:00
Tobias Brunner d874101055 hasher: Add helper to determine hash algorithm from signature scheme 2015-03-04 13:54:09 +01:00
Tobias Brunner 353294ea5c public-key: Add helper to map signature schemes to ASN.1 OIDs
There is a similar function to map key_type_t and hasher_t to an OID,
but this maps schemes directly (and to use the other function we'd
have to have a function to map schemes to hash algorithms first).
2015-03-04 13:54:08 +01:00
Tobias Brunner 0f29f5ed02 public-key: Add helper to determine key type from signature scheme 2015-03-04 13:54:08 +01:00
Tobias Brunner 247eadb73d hasher: Add filter function for algorithms permitted by RFC 7427 2015-03-04 13:54:08 +01:00
Tobias Brunner 4f9e1c49eb hasher: Redefine hash algorithms to match values defined by RFC 7427
Other algorithms are defined in private use range.
2015-03-04 13:54:08 +01:00
Martin Willi ef2c61bc92 mem-cred: Add a method to unify certificate references, without adding it
In contrast to add_cert_ref(), get_cert_ref() does not add the certificate to
the set, but only finds a reference to the same certificate, if found.
2015-03-03 13:50:26 +01:00
Thomas Egerer 4dc72f5e57 enum: Extend printf hook to print flags
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2015-03-03 13:41:49 +01:00
Martin Willi 53013b5f0c unit-tests: Don't fail host_create_from_dns() test if IPv6 not supported
On some systems, such as the Ubuntu daily build machine, localhost does not
resolve to an IPv6 address. Accept such a lookup failure.
2015-03-02 14:05:44 +01:00
Tobias Brunner faafaf35f4 bliss: Add generated Huffman codes to the repository
While these files are generated they don't really change and are not
architecture dependant.  The previous solution prevented cross-compilation
from the repository as `bliss_huffman` was built for the target system but
was then executed on the build host to create the source files, which
naturally was bound to fail.

The `recreate-bliss-huffman` make target can be used inside the bliss
directory to update the source files if needed.

Fixes #812.
2015-03-02 12:05:07 +01:00
Andreas Steffen 03b4d11ace Fixed compiler warnings 2015-02-27 08:44:16 +01:00
Andreas Steffen 27bd0fed93 Allow SHA256 and SHA384 data hash for BLISS signatures.
The default is SHA512 since this hash function is also
used for the c_indices random oracle.
2015-02-26 08:56:12 +01:00
Andreas Steffen a7f0ab786d unit-tests: Completed BLISS tests 2015-02-25 21:45:34 +01:00
Andreas Steffen bfb708ea23 Check for null pointer before applying memwipe() 2015-02-25 21:45:34 +01:00
Andreas Steffen c2aca9eed2 Implemented improved BLISS-B signature algorithm 2015-02-25 21:45:34 +01:00
Martin Willi d0d8568356 host-resolver: Do not cancel threads waiting for new queries during cleanup
While it is currently unclear why it happens, canceling threads waiting in the
new_query condvar does not work as expected. The behavior is not fully
reproducible: Either cancel(), join() or destroying the condvar hangs.

The issue has been seen in the http-fetcher unit tests, where the stream service
triggers the use of the resolver for "localhost" hosts. It is reproducible with
any cleanup following a host_create_from_dns() use on a Ubuntu 14.04 x64 system.
Further, the issue is related to the use of libunwind, as only builds with
--enable-unwind-backtraces are affected.

As we broadcast() the new_query condvar before destruction, a hard cancel() of
these threads is actually not required. Instead we let these threads clean up
themselves after receiving the condvar signal.
2015-02-24 16:00:38 +01:00
Martin Willi 2113f48271 host-resolver: Disable resolver thread cancellation by default
The default of new threads is cancellable, but the host-resolver thread code
clearly expects the opposite.
2015-02-24 15:59:35 +01:00
Martin Willi 0ae862efd1 unit-tests: Add host_create_from_dns() test cases resolving "localhost" 2015-02-24 15:56:37 +01:00
Martin Willi 20a0fd9255 plugin-loader: Do not unload libraries during dlclose(), if supported
Unloading libraries calls any library constructor/destructor functions. Some
libraries can't handle that in our excessive unit test use. GnuTLS leaks
a /dev/urandom file descriptor, letting unit tests fail with arbitrary
out-of-resources errors.
2015-02-24 12:25:01 +01:00
Martin Willi 67a9744bb9 unit-tests: Accept numerical protocol/port numbers in traffic selector tests 2015-02-23 18:44:26 +01:00
Tobias Brunner 4e236a7e15 openssl: Return the proper IV length for OpenSSL crypters
For instance, the NULL cipher has a block size of 1 but an IV length
of 0.

Fixes #854.
2015-02-23 11:29:07 +01:00
Martin Willi cc1682bef9 ipsec-types: Support the %unique mark value 2015-02-20 16:34:53 +01:00
Martin Willi 85b238887d child-sa: Replace reqid based marks by "unique" marks
As we now use the same reqid for multiple CHILD_SAs with the same selectors,
having marks based on the reqid makes not that much sense anymore. Instead we
use unique marks that use a custom identifier. This identifier is reused during
rekeying, keeping the marks constant for any rule relying on it (for example
installed by updown).

This also simplifies handling of reqid allocation, as we do not have to query
the marks that is not yet assigned for an unknown reqid.
2015-02-20 13:34:49 +01:00
Martin Willi 6d4649573e traffic-selector: Add a hash() method 2015-02-20 13:34:48 +01:00
Martin Willi fc978f192f unit-tests: Add an initial set of traffic selector unit tests 2015-02-20 13:34:48 +01:00
Martin Willi 373a147fed traffic-selector: Add a compare function to sort traffic selectors 2015-02-20 13:34:48 +01:00
Martin Willi b851f0a105 x509: Fix public key reference leak if authority key identifier does not match 2015-02-06 13:58:58 +01:00
Andreas Steffen ee3b135687 unit-tests: Adapted to coverity fixes 2014-12-23 15:40:01 +01:00
Andreas Steffen 6139c8e524 Fixed bad bit shift and sign extension errors 2014-12-23 15:40:01 +01:00
Tobias Brunner fd19feefa4 bliss: Remove unnecessary cast to double
Coverity is still not happy when the result of an integer division is
assigned to a double (without e.g. casting the result to an int first to
indicate the intent).  The shift should avoid this issue.
2014-12-23 15:40:01 +01:00
Tobias Brunner 078fe7aae6 bliss: Log type if unsupported 2014-12-23 15:40:01 +01:00
Tobias Brunner a8e82ace8a bliss: Make sure sampler exists after checking for it earlier 2014-12-23 15:40:01 +01:00
Tobias Brunner e13ef5c434 crypto: Define MODP_CUSTOM outside of IKE DH range
Before this fix it was possible to crash charon with an IKE_SA_INIT
message containing a KE payload with DH group MODP_CUSTOM(1025).
Defining MODP_CUSTOM outside of the two byte IKE DH identifier range
prevents it from getting negotiated.

Fixes CVE-2014-9221.
2014-12-23 15:40:01 +01:00
Martin Willi 04337fed02 apple: Redefine some additional clashing Mach types
While they usually are not included in a normal strongSwan build, the XPC
header indirectly defines these Mach types. To build charon-xpc, which uses
both XPC and strongSwan includes, we have to redefine these types.
2014-12-16 17:22:28 +01:00
Tobias Brunner f9da7ef868 mgf1: Use correct Doxygen groups 2014-12-15 17:22:11 +01:00
Tobias Brunner a876018e3e bliss: Fix Doxygen comments 2014-12-15 17:19:57 +01:00
Tobias Brunner 3000f6aada Fixed some typos, courtesy of codespell 2014-12-15 17:11:14 +01:00
Andreas Steffen 9b4e411c50 Also initialize s_sign 2014-12-12 13:24:11 +01:00