Commit graph

62 commits

Author SHA1 Message Date
Rosen Penev
29d48ce8a1 dtls: Fix compilation without deprecated APIs on OpenSSL 1.1.x 2018-11-14 14:55:37 -08:00
Jan Alexander Steffens (heftig)
84d3f58c4a
dtls: Link against winsock2 on Windows
Should fix the Windows build after
b1509b1047.
2018-11-06 18:48:44 +01:00
Jan Alexander Steffens (heftig)
b1509b1047 dtlsconnection: Print out errno info for syscall errors
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
2018-11-06 16:23:50 +00:00
Andreas Frisch
51f0307900 dtls: Properly display all errors/warnings from ERR queue
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.
2018-11-06 16:23:50 +00:00
Jan Alexander Steffens (heftig)
7bb6ce352b dtlsconnection: Replace if-else chain with switch
A more idiomatic construct for testing a bunch of integers.
2018-11-06 16:23:50 +00:00
Jan Alexander Steffens (heftig)
49cc7b8091 dtlsconnection: Clear error queue before SSL_do_handshake
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
2018-11-06 16:23:50 +00:00
Jan Alexander Steffens (heftig)
fa92909d0d dtlsconnection: Lower BIO error log level to DEBUG
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
2018-11-06 16:23:50 +00:00
Jan Alexander Steffens (heftig)
a9b9994738 dtlsconnection: Run gst-indent 2018-11-06 16:23:50 +00:00
Nirbheek Chauhan
b55dfb5313 Add feature options for almost all plugins
The only plugins remaining are those that haven't been ported to Meson
yet, and msdk. Also, the tests are still automagic.

https://bugzilla.gnome.org/show_bug.cgi?id=795107
2018-07-27 19:04:38 +05:30
Tim-Philipp Müller
3c6f642fa6 dtls: Update for g_type_class_add_private() deprecation in recent GLib 2018-06-24 01:06:24 +02:00
Xavier Claessens
83d0623293 Meson: Generate pc file for all plugins in bad
https://bugzilla.gnome.org/show_bug.cgi?id=794568
2018-04-25 11:08:09 +01:00
Matthew Waters
eaef193d08 dtls: drop upstream segment and stream-start events
Fixes tests with GstHarness

We will push our own from the srcpad task.
2018-02-05 17:44:33 +11:00
Matthew Waters
dc452aa799 dtls: don't leak the system clock
Obtain and release it as needed.
2018-02-05 17:44:33 +11:00
Matthew Waters
18a62b144d dtlsenc: fix typo in is-client property description 2018-02-05 17:44:33 +11:00
Matthew Waters
94a7bf9ede dtls: remove reliance on a default GMainContext/Loop
By removing the indirection to the main loop completely when receiving
the peer certificate. For reference, the on-decoder-key signal does not
have a redirection.
2018-02-01 23:25:18 +11:00
Nicolas Dufresne
4261692187 Remove plugin specific static build option
Static and dynamic plugins now have the same interface. The standard
--enable-static/--enable-shared toggle are sufficient.
2017-05-16 14:05:52 -04:00
Scott D Phillips
1a43d57359 dtls: Set openssl's threadid the 1.0.x way
For pre-1.1.x openssl, a callback to set the thread id needs to be
provided to openssl. In 0.9.x the thread id was an unsigned long. In
1.0.x it was expanded to be able to hold a void*. Here we change to use
the 1.0.x API so that the thread id can always hold a GThread*, even on
platforms like msvc x64 where unsigned long is only 32 bits.

All of this is still #ifdef'd out of existence when building with
openssl 1.1.x or later which changed the thread API again, and does not
need a thread id callback.

https://bugzilla.gnome.org/show_bug.cgi?id=775292
2016-12-05 11:26:15 +02:00
Sebastian Dröge
3a069193e2 dtlscertificate: Fix error checking in RSA_generate_key_ex() usage
Was broken during the port for OpenSSL 1.1.

https://bugzilla.gnome.org/show_bug.cgi?id=774328
2016-11-14 11:32:17 +02:00
Sebastian Dröge
31317fd666 dtls: Fix compiler warnings with openssl 1.1 or newer
- DTLSv1_method() is deprecated, and since 1.0.2 replaced by
  DTLS_method().
- CRYPTO_set_locking_callback() and CRYPTO_set_id_callback() are
  no-ops (empty macros) since 1.1 and are not supposed to be used
  anymore.

gstdtlsagent.c: In function ‘gst_dtls_agent_init’:
gstdtlsagent.c:173:3: error: ‘DTLSv1_method’ is deprecated [-Werror=deprecated-declarations]
   priv->ssl_context = SSL_CTX_new (DTLSv1_method ());
   ^~~~
In file included from /usr/include/openssl/ct.h:13:0,
                 from /usr/include/openssl/ssl.h:61,
                 from gstdtlsagent.c:40:
/usr/include/openssl/ssl.h:1614:1: note: declared here
 DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_method(void)) /* DTLSv1.0 */
 ^
At top level:
gstdtlsagent.c:103:1: error: ‘ssl_thread_id_function’ defined but not used [-Werror=unused-function]
 ssl_thread_id_function (void)
 ^~~~~~~~~~~~~~~~~~~~~~
gstdtlsagent.c:73:1: error: ‘ssl_locking_function’ defined but not used [-Werror=unused-function]
 ssl_locking_function (gint mode, gint lock_num, const gchar * file, gint line)
 ^~~~~~~~~~~~~~~~~~~~
2016-11-02 14:04:19 +02:00
Olivier Crête
c35b918ce1 dtls: Downgrade locking debug 2016-11-01 14:57:21 -04:00
Daiki Ueno
e938933167 dtls: port to OpenSSL 1.1.0
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
2016-10-31 12:49:11 +02:00
Nirbheek Chauhan
42af2d66d8 Add support for Meson as alternative/parallel build system
https://github.com/mesonbuild/meson

With contributions from:

Tim-Philipp Müller <tim@centricular.com>
Matej Knopp <matej.knopp@gmail.com>
Jussi Pakkanen <jpakkane@gmail.com> (original port)

Highlights of the features provided are:
* Faster builds on Linux (~40-50% faster)
* The ability to build with MSVC on Windows
* Generate Visual Studio project files
* Generate XCode project files
* Much faster builds on Windows (on-par with Linux)
* Seriously fast configure and building on embedded

... and many more. For more details see:

http://blog.nirbheek.in/2016/05/gstreamer-and-meson-new-hope.html
http://blog.nirbheek.in/2016/07/building-and-developing-gstreamer-using.html

Building with Meson should work on both Linux and Windows, but may
need a few more tweaks on other operating systems.
2016-08-20 11:35:54 +01:00
Raffaele Rossi
79f9c7671b dtsl: add some documentation
https://bugzilla.gnome.org/show_bug.cgi?id=760994
2016-04-18 12:35:40 +01:00
Santiago Carot-Nemesio
d2ef3a4c19 dtls: Use unique names for internal elements to ease debugging
https://bugzilla.gnome.org/show_bug.cgi?id=748651
2016-04-04 11:09:10 +01:00
Vineeth TM
8cdfb13658 bad: use new gst_element_class_add_static_pad_template()
https://bugzilla.gnome.org/show_bug.cgi?id=763081
2016-03-24 14:56:51 +02:00
Tim-Philipp Müller
734d5a79c5 Fix code indentation 2015-11-06 19:29:49 +00:00
Paul Arzelier
0d3ca6391c dtls: Fix name conflict with openssl on win32
https://bugzilla.gnome.org/show_bug.cgi?id=756592
2015-10-15 09:50:19 +03:00
Polochon_street
b58f711566 dtls: fix printf format on win32 2015-10-02 16:36:14 +01:00
Paul Arzelier
86443f8ae2 dtls: fix printf format on win32
https://bugzilla.gnome.org/show_bug.cgi?id=755981
2015-10-02 14:21:46 +01:00
Jan Schmidt
587e7c4a23 Don't throw compiler warnings with G_DISABLE_ASSERT
Disable code that warns about unused variables when G_DISABLE_ASSERT
is defined, as it is in tarballs and pre-releases.
2015-09-18 00:29:51 +10:00
Santiago Carot-Nemesio
f530aac115 dtlsdec: Fix critical warning "got data flow before stream-start event"
Forward sticky events on requested src pad.

https://bugzilla.gnome.org/show_bug.cgi?id=750348
2015-06-03 17:12:49 +02:00
Santiago Carot-Nemesio
ed21506896 dtlssrtpdec: Release requested pads
https://bugzilla.gnome.org/show_bug.cgi?id=750036
2015-05-28 22:46:47 +02:00
Santiago Carot-Nemesio
29c17a96f7 dtlsdec: Remove unnecessary ref/unref operations
https://bugzilla.gnome.org/show_bug.cgi?id=750036
2015-05-28 22:46:47 +02:00
Santiago Carot-Nemesio
665031751d dtlsdec: Fix release request pad function
Don't unref the pad reference we don't own and just remove the pad.

https://bugzilla.gnome.org/show_bug.cgi?id=750036
2015-05-28 22:46:47 +02:00
Jose Antonio Santos Cadenas
d625770a18 dtls: Fix memory leak
Keys were not correctly released when it was get as a property
nor when a second key was received

https://bugzilla.gnome.org/show_bug.cgi?id=749380
2015-05-15 15:47:39 +03:00
Jose Antonio Santos Cadenas
aae1a5e2ce dtlsenc: Fix memory leak releasing connection_id
https://bugzilla.gnome.org/show_bug.cgi?id=749318
2015-05-13 19:14:34 +03:00
Jose Antonio Santos Cadenas
6b0183b7bf dtlsenc: Fix memory leak while setting connection-id
https://bugzilla.gnome.org/show_bug.cgi?id=749318
2015-05-13 19:14:17 +03:00
Jose Antonio Santos Cadenas
3c3d6e8828 dtlsdec: Fix memory leak, release previous pem
https://bugzilla.gnome.org/show_bug.cgi?id=749322
2015-05-13 19:12:51 +03:00
Jose Antonio Santos Cadenas
2173f9f15d dtlsdec: Fix memory leak on dispose
Parent dispose function was not called

https://bugzilla.gnome.org/show_bug.cgi?id=749322
2015-05-13 19:12:32 +03:00
Jose Antonio Santos Cadenas
c44acd8bde dtlsconnection: Fix memory leak while setting closure
https://bugzilla.gnome.org/show_bug.cgi?id=749325
2015-05-13 19:10:34 +03:00
Sebastian Dröge
c534c8899c dtlssrtpdec: Don't merge RTP and RTCP streams that were just split by srtpdec
The funnel has some overhead, and later rtpbin will have to split both streams
again anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=748723
2015-05-07 21:04:30 +02:00
Sebastian Dröge
49aba362a8 dtlsdec: Fix typo 2015-04-13 19:41:15 +02:00
Sebastian Dröge
a8627a1df7 dtlssrtpdec: Add some more debug output 2015-04-13 19:41:15 +02:00
Sebastian Dröge
82b73713cb dtls: Pass the connection instance as data to the thread pool
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.
2015-03-19 14:04:28 +01:00
Sebastian Dröge
602b1ca3d2 dtls: Remove unused thread struct field 2015-03-19 13:55:53 +01:00
Sebastian Dröge
fd609f6bc0 dtls: Use a shared thread pool for the timeouts
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.
2015-03-19 13:30:00 +01:00
Sebastian Dröge
4072666c7d dtls: Shutdown timeout thread when it's not needed
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.
2015-03-18 18:21:35 +01:00
Sebastian Dröge
7782bdf286 dtlsenc: Clear the queue when deactivating the pad 2015-03-18 17:40:47 +01:00
Sebastian Dröge
4fed95c534 dtlsenc: Handle pad activity states properly 2015-03-18 17:40:34 +01:00
Sebastian Dröge
ff01df1093 dtlsenc: Don't manually activate/deactivate srcpad 2015-03-18 17:35:12 +01:00