summaryrefslogtreecommitdiff
path: root/ext/dtls/gstdtlsconnection.c
Commit message (Collapse)AuthorAgeFilesLines
* dtls: Add ability to set custom GstFlowReturn on callback errorDoug Nazar2021-05-191-3/+19
| | | | Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2229>
* dtls: Avoid bio_buffer assertion on shutdown.Jan Schmidt2020-10-311-3/+4
| | | | | | | | | | On shutdown, a previous iteration of dtsl_connection_process() might be incomplete and leave a partial bio_buffer behind. If the DTLS connection is already marked closed, drop out of dtls_connection_process early without asserting. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1741>
* dtlsconnection: Ignore OpenSSL system call errorsOlivier Crête2020-10-101-29/+7
| | | | | | | | | OpenSSL shouldn't be making real system calls, so we can safely ignore syscall errors. System interactions should happen through our BIO. So especially don't look at the system's errno, as it should be meaningless. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1656>
* gstdtlsconnection: Propagate errors from key export to the callerSebastian Dröge2020-06-261-10/+28
| | | | | | | Otherwise the DTLS connection silently does nothing instead of reporting an error via the elements. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1156>
* dtlsconnection: do not set keys_exported flag if actually not exportedMiguel Paris2020-06-261-2/+7
| | | | | | | | | | | | keys_exported flag should be set only if keys are actually exported. For that the next conditions are needed: 1 - SSL_export_keying_material on success 2 - SSL_get_selected_srtp_profile returns a valid profile 3 - The profile ID is SRTP_AES128_CM_SHA1_80 or SRTP_AES128_CM_SHA1_32 Also don't crash if NULL is returned as profile. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1156>
* dtls/connection: fix EOF handling with openssl 1.1.1eMatthew Waters2020-03-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | openssl 1.1.1e does some stricker EOF handling and will throw an error if the EOF is unexpected (like in the middle of a record). As we are streaming data into openssl here, it is entirely possible that we push data from multiple buffers/packets into openssl separately. From the openssl changelog: Changes between 1.1.1d and 1.1.1e [17 Mar 2020] *) Properly detect EOF while reading in libssl. Previously if we hit an EOF while reading in libssl then we would report an error back to the application (SSL_ERROR_SYSCALL) but errno would be 0. We now add an error to the stack (which means we instead return SSL_ERROR_SSL) and therefore give a hint as to what went wrong. [Matt Caswell] We can relax the EOF signalling to only return TRUE when we have stopped for any reason (EOS, error). Will also remove a spurious EOF error from previous openssl version.
* dtls: Keep track of the connection state and signal it through all the layersSebastian Dröge2020-01-191-20/+180
| | | | | This allows the application to keep track of the underlying DTLS connection state and act accordingly.
* dtls: Handle errors/close_notify at all steps and propagate through the ↵Sebastian Dröge2020-01-191-64/+203
| | | | | | | | | | | | | | | layers properly Previously we simply logged errors but never reported them to elements or even to the user. Fatal errors are now properly reported. Additionally proper connection closing is implemented based on EOS: - dtlsenc: EOS will cause close_notify to be sent to the peer and only if the peer also sent back close_notify we will forward the EOS event. - dtlsdec: EOS will be forwarded normally, this only means that the unterlying transport was closed. On receiving a DTLS packet containing close_notify, return EOS and send EOS downstream.
* dtls: Propagate write errors backwards through dtlsenc/dtlsconnectionSebastian Dröge2020-01-191-2/+3
|
* dtls: Use a plain function pointer instead of a GClosure for the send callbackSebastian Dröge2020-01-191-36/+22
| | | | | There's not point in using GClosure and going through all the GValue/libffi infrastructure for each DTLS packet.
* Don't pass default GLib marshallers for signalsNiels De Graef2019-11-061-8/+5
| | | | | | | | | | | | By passing NULL to `g_signal_new` instead of a marshaller, GLib will actually internally optimize the signal (if the marshaller is available in GLib itself) by also setting the valist marshaller. This makes the signal emission a bit more performant than the regular marshalling, which still needs to box into `GValue` and call libffi in case of a generic marshaller. Note that for custom marshallers, one would use `g_signal_set_va_marshaller()` with the valist marshaller instead.
* dtls: fix dtls connection object leakIlya Smelykh2019-07-251-0/+2
|
* Run gst-indent through the filesJordan Petridis2018-11-281-7/+7
| | | | | | This is required before we enabled an indent test in the CI. https://gitlab.freedesktop.org/gstreamer/gstreamer-project/issues/33
* dtlsconnection: Print out errno info for syscall errorsJan Alexander Steffens (heftig)2018-11-061-1/+18
| | | | | | | | | | As suggested in [the SSL_get_error manpage][1]. Upgrade the message to a warning if the errno isn't 0 (success). The latter apparently means the transport encountered an EOF (shutdown) without the shut down handshake on the (D)TLS level. This happens quite often for otherwise normal DTLS connections. [1]: https://www.openssl.org/docs/man1.1.1/man3/SSL_get_error.html
* dtls: Properly display all errors/warnings from ERR queueAndreas Frisch2018-11-061-5/+22
| | | | | | Print out all errors from the OpenSSL error queue instead of just looking at the topmost error. Using the callback interface also removes the need for formatting using a buffer on the stack.
* dtlsconnection: Replace if-else chain with switchJan Alexander Steffens (heftig)2018-11-061-14/+15
| | | | A more idiomatic construct for testing a bunch of integers.
* dtlsconnection: Clear error queue before SSL_do_handshakeJan Alexander Steffens (heftig)2018-11-061-0/+1
| | | | | | | As documented on [the SSL_get_error manpage][1] we need to empty the error queue before making any call that we check with SSL_get_error. [1]: https://www.openssl.org/docs/man1.1.1/man3/SSL_get_error.html
* dtlsconnection: Lower BIO error log level to DEBUGJan Alexander Steffens (heftig)2018-11-061-1/+1
| | | | | | | Periodic SSL_ERROR_SYSCALL errors with errno == 0 seem to be normal behavior for DTLS connections. Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/677
* dtlsconnection: Run gst-indentJan Alexander Steffens (heftig)2018-11-061-7/+7
|
* dtls: Update for g_type_class_add_private() deprecation in recent GLibTim-Philipp Müller2018-06-241-9/+8
|
* dtls: don't leak the system clockMatthew Waters2018-02-051-3/+2
| | | | Obtain and release it as needed.
* dtls: port to OpenSSL 1.1.0Daiki Ueno2016-10-311-9/+78
| | | | | | | | | | | | | | Changes are: - Use the wrapper functions to access opaque data types. To preserve backward compatibility, define fallback definitions - Remove the use of idiom "pqueue_size(ssl->d1->sent_messages)", since there is no replacement - Use RSA_generate_key_ex instead of the deprecated RSA_generate_key https://bugzilla.gnome.org/show_bug.cgi?id=773540
* Don't throw compiler warnings with G_DISABLE_ASSERTJan Schmidt2015-09-181-0/+6
| | | | | Disable code that warns about unused variables when G_DISABLE_ASSERT is defined, as it is in tarballs and pre-releases.
* dtlsconnection: Fix memory leak while setting closureJose Antonio Santos Cadenas2015-05-131-0/+4
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=749325
* dtls: Pass the connection instance as data to the thread poolSebastian Dröge2015-03-191-5/+6
| | | | | | No need to ref/unref the connection every time we push something on the pool. However we have to provide non-NULL data to the pool, so let's just give it some coffee.
* dtls: Remove unused thread struct fieldSebastian Dröge2015-03-191-7/+0
|
* dtls: Use a shared thread pool for the timeoutsSebastian Dröge2015-03-191-86/+95
| | | | | | | | This way we will share threads with other DTLS connections if possible, and don't have to start/stop threads for timeouts if there are many to be handled in a short period of time. Also use the system clock and async waiting on it for scheduling the timeouts.
* dtls: Shutdown timeout thread when it's not neededSebastian Dröge2015-03-181-19/+27
| | | | | It is not needed most of the time and usually we have a thread idling around doing nothing all the time after the first few seconds.
* dtls: Fix some search & replace mistakes from renaming the elementsSebastian Dröge2015-03-181-7/+7
|
* dtls: make sure we actually log into the right debug categoryTim-Philipp Müller2015-03-161-5/+1
| | | | | | | GST_DTLS_USE_GST_LOG is not defined anywhere, so we'd just log into the default category by accident. We use the gst logging system unconditionally now, so might just as well remove this #if #else.
* dtls: fix some more compiler warningsTim-Philipp Müller2015-03-161-9/+20
| | | | | | | | | | | gcc-4.9.2: gstdtlsagent.c:114:1: error: old-style function definition gstdtlsconnection.c:253:3: error: ISO C90 forbids mixed declarations and code gstdtlsconnection.c:291:3: error: ISO C90 forbids mixed declarations and code gstdtlsconnection.c:391:3: error: ISO C90 forbids mixed declarations and code gstdtlsconnection.c:434:3: error: ISO C90 forbids mixed declarations and code gstdtlsconnection.c:773:1: error: 'BIO_s_gst_dtls_connection' was used with no prototype before its definition gstdtlsconnection.c:773:1: error: old-style function definition
* dtls: Unconditionally use GStreamer debug log systemSebastian Dröge2015-03-161-79/+85
|
* dtls: Re-namespace from Er to GstSebastian Dröge2015-03-161-86/+86
|
* dtls: Fix some compiler warningsSebastian Dröge2015-03-161-3/+4
| | | | | | | | | | | | | | gstdtlsconnection.c:128:32: error: passing 'const char [30]' to parameter of type 'void *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers] SSL_get_ex_new_index (0, "gstdtlsagent connection index", NULL, NULL, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/openssl/ssl.h:1981:43: note: passing argument to parameter 'argp' here int SSL_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, ^ gstdtlsconnection.c:822:40: error: arithmetic on a pointer to void is a GNU extension [-Werror,-Wpointer-arith] memcpy (out_buffer, priv->bio_buffer + priv->bio_buffer_offset, copy_size); ~~~~~~~~~~~~~~~~ ^
* dtls: Fix indentionSebastian Dröge2015-03-161-577/+625
|
* dtls: Add new DTLS pluginSebastian Dröge2015-03-161-0/+852
This is a copy of the Ericsson DTLS plugin from https://github.com/EricssonResearch/openwebrtc-gst-plugins/tree/master/ext/erdtls/src https://bugzilla.gnome.org/show_bug.cgi?id=744582