Commit Graph

222 Commits

Author SHA1 Message Date
Andreas Steffen b12c53ce77 Use standard unsigned integer types 2016-03-24 18:52:48 +01:00
Tobias Brunner 5452e3d66e credential-manager: Make online revocation checks optional for public key enumerator 2016-03-10 11:07:14 +01:00
Martin Willi ee9f691915 unit-tests: Forward variable argument list in TEST_SUITE_DEPEND
For some plugin features, such as crypters or AEADs, we have some additional
feature arguments, such as the key size.
2015-07-12 13:25:50 +02:00
Martin Willi 47e96391f2 libtls: As client, reject DH exchanges using primes smaller than 1024 bit
While the server signs the ephemeral DH parameters, it can be tricked to its
lowest supported DH group by a man-in-the-middle:

  https://weakdh.org/imperfect-forward-secrecy.pdf

While we at least use 2048-bit DH groups as server, the client accepts any
DH prime the server sends. If it supports export ciphers, only a 512-bit prime
may be used.

As TLS does not define nor negotiate a DH group for cipher suites, the client
actually must accept what the server offers. To avoid downgrades to weak
DH groups, we must reject what we consider insecure. We set this limit to
1024-bit primes. While this breaks compatibility with TLS servers using weaker
primes, this is what we expect servers at least use. Most browser vendors use
the same limit in a similar fix.
2015-05-26 11:36:24 +02:00
Martin Willi 161a015782 utils: Use chunk_equals_const() for all cryptographic purposes 2015-04-14 12:02:51 +02:00
Martin Willi a777155ffe diffie-hellman: Add a bool return value to set_other_public_value() 2015-03-23 17:54:03 +01:00
Martin Willi 42431690e0 diffie-hellman: Add a bool return value to get_my_public_value() 2015-03-23 17:54:03 +01:00
Martin Willi bace1d6479 diffie-hellman: Use bool instead of status_t as get_shared_secret() return value
While such a change is not unproblematic, keeping status_t makes the API
inconsistent once we introduce return values for the public value operations.
2015-03-23 17:54:02 +01:00
Tobias Brunner 18597950fa tls-peer: Make sure to use the right trusted public key for peer
In case a CA certificate uses the same subject DN as the server the
previous code could end up trying to verify the server's signature with
the CA certificate's public key.  By comparing the certificate with the
one sent by the peer we make sure to use the right one.

Fixes #849.
2015-03-09 15:40:06 +01:00
Martin Willi 666c552381 libtls: Add getters for TLS handshake authentication details 2015-03-03 14:08:00 +01:00
Martin Willi aba5b76ce1 libtls: Merge trustchain auth verification details done during TLS handhsake 2015-03-03 14:08:00 +01:00
Martin Willi 970378c557 libtls: Don't send TLS close notifies in EAP after application succeeds
With the introduction of PT-TLS, we started sending TLS close notifies after
the application layer completes (7bbf7aa9). While this makes sense for TCP based
transports, it is not required in EAP methods. In EAP, handshake completion
can be directly signaled using the outer EAP-SUCCESS message. This also saves
one round-trip in the EAP exchange.

Windows 7/8 does not seem to like TLS close notifies at all in EAP, and either
stalls (EAP-TTLS) or disconnects (PEAP).

Fixes #556.
2015-02-19 11:29:07 +01:00
Martin Willi 780bf2b8e9 libtls: Check for CHANGE_CIPHER_SPEC type only if upper layer returns NEED_MORE
A type is returned only if upper layers successfully created a record, that is
returns NEED_MORE. If we do not check for the return value, we might check a
previous record or the uninitialized type variable and falsely reset the
sequence number.
2015-01-12 14:18:24 +01:00
Martin Willi 4ef819a379 libtls: Catch POLLHUP/NVAL in TLS socket splicing
If one of the sockets gets disconnected, some systems return POLLHUP. Signal
the socket as ready to let the read/write call fail properly.
2014-11-28 15:53:50 +01:00
Martin Willi 10743ac9d6 libtls: Use poll(2) instead of select() in tls_socket 2014-11-21 12:02:07 +01:00
Martin Willi cbb86a2df3 tls: Fix an invalid free on CBC encryption failure 2014-10-15 14:26:03 +02:00
Martin Willi 867d04b72e tls: Fix a memory leak if AEAD encryption fails 2014-10-15 14:21:01 +02:00
Martin Willi c0bf721357 tls: Check all bytes of the padding if they equal the padding length 2014-10-15 14:21:01 +02:00
Martin Willi 30308c5fdb libtls: Link against ws_w32 on Windows 2014-06-04 15:53:05 +02:00
Tobias Brunner 435fecd751 unit-tests: Make sure plugins in the builddir are loaded
When running the tests in GDB the working directory apparently is
different.  With the relative path used previously the plugins would not
be found and those installed on the system would get used.
2014-05-19 14:06:43 +02:00
Martin Willi 064fe9c963 enum: Return boolean result for enum_from_name() lookup
Handling the result for enum_from_name() is difficult, as checking for
negative return values requires a cast if the enum type is unsigned. The new
signature clearly differentiates lookup result from lookup value.

Further, this actually allows to convert real -1 enum values, which could not
be distinguished from "not-found" and the -1 return value.

This also fixes several clang warnings where enums are unsigned.
2014-05-16 15:42:07 +02:00
Martin Willi e2bf45a491 tls: Move variable sized tls_record_t struct to end of tls_t data
clang complains about the the non-last variable length member.
2014-05-16 15:42:07 +02:00
Andreas Steffen 8d59090349 Implemented PT-EAP protocol (RFC 7171) 2014-05-12 06:59:21 +02:00
Martin Willi 5ba9f73457 tls: Add a test case to check correct enum name mapping of cipher suites 2014-04-01 14:52:18 +02:00
Martin Willi 2c8d77394c tls: Add socket based tests testing all supported suites with TLS 1.2/1.1/1.0 2014-04-01 14:52:18 +02:00
Martin Willi 74162ed997 tls: Remove superfluous initializers in TLS AEAD implementations 2014-04-01 14:52:18 +02:00
Martin Willi e15f64cc81 tls: Support a maximum TLS version to negotiate using TLS socket abstraction 2014-04-01 14:28:55 +02:00
Martin Willi 5313880261 tls: Support a null encryption flag on TLS socket abstraction 2014-04-01 14:28:55 +02:00
Martin Willi ddf5222096 tls: Introduce a generic TLS purpose that accepts NULL encryption ciphers 2014-04-01 14:28:55 +02:00
Martin Willi ac5717c9e9 tls: Export a function to list supported TLS cipher suites 2014-04-01 14:28:55 +02:00
Martin Willi c0efaaebe3 tls: Create a unit-test runner 2014-04-01 14:28:55 +02:00
Martin Willi e67e8dd197 tls: Fix some TLS cipher suite enum names
It is important to have them mapped correctly, as we use these official TLS
identifiers to configure specific TLS suites.
2014-03-31 16:07:53 +02:00
Martin Willi b37080f8c9 tls: Include TLS version announced in Client Hello in encrypted premaster
While a hardcoded 1.2 version is fine when we offer that in Client Hello, we
should include the actually offered version if it has been reduced before
starting the exchange.
2014-03-31 16:07:53 +02:00
Martin Willi f93497507f tls: Check for minimal TLS record length before each record iteration
Fixes fragment reassembling if a buffer contains more than one record, but
the last record contains a partial TLS record header. Thanks to Nick Saunders
and Jamil Nimeh for identifying this issue and providing a fix for it.
2014-03-31 15:56:12 +02:00
Martin Willi b886dad498 tls: Fix AEAD algorithm filtering, avoid filtering all suites if no AEAD found 2014-03-31 15:56:12 +02:00
Martin Willi 48d6b57c30 tls: Offer TLS signature schemes in ClientHello in order of preference
Additionally, we now query plugin features to find out what schemes we exactly
support.
2014-03-31 15:56:12 +02:00
Martin Willi d06890d6e2 tls: Define AES-GCM cipher suites from RFC 5288/5289 2014-03-31 15:56:12 +02:00
Martin Willi f0f301170b tls: Implement the TLS AEAD abstraction for real AEAD modes 2014-03-31 15:56:12 +02:00
Martin Willi d3204677ba tls: Separate TLS protection to abstracted AEAD modes
To better separate the code path for different TLS versions and modes of
operation, we introduce a TLS AEAD abstraction. We provide three implementations
using traditional transforms, and get prepared for TLS AEAD modes.
2014-03-31 15:56:12 +02:00
Tobias Brunner 409adef43c libtls: Move settings to <ns>.tls with fallback to libtls 2014-02-12 14:34:32 +01:00
Tobias Brunner 9af44ef5d9 Build all shared libraries with -no-undefined and link them properly
The flag is required to convince libtool on Cygwin to build DLLs. But on
Windows these shared libraries can not have undefined symbols, so we have to
link them explicitly to the libraries they reference.

For plugins this is currently not done, so only the monolithic build is
supported.  The plugin loader wouldn't be able to load DLLs anyway, as
it tries to load files that don't exist on Cygwin.
2013-09-12 01:44:49 +02:00
Andreas Steffen 9dc3b2053d Optimize TLS socket buffer for TLS_MAX_FRAGMENT_LEN 2013-08-19 09:50:57 +02:00
Andreas Steffen 97b1d39de5 Extract client identity and authentication type from SASL authentication 2013-08-15 23:34:22 +02:00
Martin Willi 19cb07b890 automake: replace INCLUDES by AM_CPPFLAGS
INCLUDES are now deprecated and throw warnings when using automake 1.13.
We now also differentiate AM_CPPFLAGS and AM_CFLAGS, where includes and
defines are passed to AM_CPPFLAGS only.
2013-07-18 14:59:19 +02:00
Andreas Steffen 5a8dd63433 fixed typo 2013-03-27 22:56:37 +01:00
Tobias Brunner 79306b7e6e Use proper integer types when handling TLS exchanges
tls_t.build takes a size_t argument not a ssize_t.
2013-03-22 11:40:57 +01:00
Martin Willi 1db6bf2f3f If TLS peer authentication not required, the client does nonetheless, allow it to fail 2013-03-06 15:53:12 +01:00
Martin Willi 807f2facd0 Request a TLS client certificate even if no peer identity is given
This allows a peer to perform client authentication if it wants, but skip
it if not.
2013-02-28 16:46:08 +01:00
Martin Willi 257c80cb5b Wrap tls_t.get_{server,peer}_id methods in tls_socket_t 2013-02-28 16:46:08 +01:00
Martin Willi 2de481e32b Delegate tls_t.get_{peer,server}_id to handshake layer
This allows to get updated peer identities if the peer can't authenticate,
or does when it is optional.
2013-02-28 16:46:08 +01:00