Skip to contentSkip to conversation

gst1-plugins-bad: hls: allow user to select crypto backend

PATCH New Rahul Bedarkar 3 participants 5 messages Aug 3, 2016 – Aug 4, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gst1-plugins-bad: hls: allow user to select crypto backend

HLS plugin can be built with nettle or libgcrypt or openssl cryptographic backend. But current dependency on gnutls is incorrect. It has been working so far because gnutls depends on nettle.

gst-plugins-bad's build system for HLS allow user to choose which cryptographic backend to use. So it makes sense to allow user to select which cryptographic backend to use.

---
 package/gstreamer1/gst1-plugins-bad/Config.in      | 25 +++++++++++++++++++++-
 .../gst1-plugins-bad/gst1-plugins-bad.mk           | 18 +++++++++++++++-
 2 files changed, 41 insertions(+), 2 deletions(-)
package/gstreamer1/gst1-plugins-bad/Config.in +24 -1
index 0f9fb15..51c1280 100644
@@ -530,10 +530,33 @@ comment "gl needs the gst1-plugins-bad opengl library"
 
 config BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_HLS
 	bool "hls"
-	select BR2_PACKAGE_GNUTLS
 	help
 	  Fragmented streaming plugins
 
+if BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_HLS
+
+choice
+	prompt "choose HLS cryptographic backend"
+	default BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_HLS_BACKEND_NETTLE
+
+config BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_HLS_BACKEND_LIBGCRYPT
+	bool "libgcrypt"
+	depends on BR2_PACKAGE_LIBGPG_ERROR_ARCH_SUPPORTS # libgcrypt -> libgpg-error
+	select BR2_PACKAGE_LIBGCRYPT
+
+config BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_HLS_BACKEND_NETTLE
+	bool "nettle"
+	select BR2_PACKAGE_NETTLE
+
+config BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_HLS_BACKEND_OPENSSL
+	bool "openssl"
+	select BR2_PACKAGE_OPENSSL
+
+endchoice
+
+endif # BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_HLS
+
+
 config BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_LIBMMS
 	bool "libmms"
 	depends on BR2_USE_WCHAR # libmms -> libglib2
package/gstreamer1/gst1-plugins-bad/gst1-plugins-bad.mk +17 -1
index 8f739ec..e920939 100644
@@ -650,7 +650,23 @@ endif
 
 ifeq ($(BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_HLS),y)
 GST1_PLUGINS_BAD_CONF_OPTS += --enable-hls
-GST1_PLUGINS_BAD_DEPENDENCIES += gnutls
+
+ifeq ($(BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_HLS_BACKEND_LIBGCRYPT),y)
+GST1_PLUGINS_BAD_DEPENDENCIES += libgcrypt
+GST1_PLUGINS_BAD_CONF_OPTS += --with-hls-crypto=libgcrypt \
+	--with-libgcrypt-prefix=$(STAGING_DIR)/usr
+endif
+
+ifeq ($(BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_HLS_BACKEND_NETTLE),y)
+GST1_PLUGINS_BAD_DEPENDENCIES += nettle
+GST1_PLUGINS_BAD_CONF_OPTS += --with-hls-crypto=nettle
+endif
+
+ifeq ($(BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_HLS_BACKEND_OPENSSL),y)
+GST1_PLUGINS_BAD_DEPENDENCIES += openssl
+GST1_PLUGINS_BAD_CONF_OPTS += --with-hls-crypto=openssl
+endif
+
 else
 GST1_PLUGINS_BAD_CONF_OPTS += --disable-hls
 endif
Signature · 1 line
2.6.2
#1 lore raw

PATCH 1/1 gst1-plugins-bad: hls: allow user to select crypto backend

Hello,

Quoted 10 lines · Rahul Bedarkar
package/gstreamer1/gst1-plugins-bad/Config.in +10 -0
+if BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_HLS
+
+choice
+	prompt "choose HLS cryptographic backend"
+	default BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_HLS_BACKEND_NETTLE
+
+config BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_HLS_BACKEND_LIBGCRYPT
+	bool "libgcrypt"
+	depends on BR2_PACKAGE_LIBGPG_ERROR_ARCH_SUPPORTS # libgcrypt -> libgpg-error
+	select BR2_PACKAGE_LIBGCRYPT

package/gstreamer1/gst1-plugins-bad/Config.in comment "gl needs the gst1-plugins-bad opengl library" · line 555

Quoted 10 lines
package/gstreamer1/gst1-plugins-bad/Config.in +10 -0
+
+config BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_HLS_BACKEND_NETTLE
+	bool "nettle"
+	select BR2_PACKAGE_NETTLE
+
+config BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_HLS_BACKEND_OPENSSL
+	bool "openssl"
+	select BR2_PACKAGE_OPENSSL
+
+endchoice

I'm not sure I want to see a choice for this. Could we instead have the .mk file automatically selected the backend according to which crypto package(s) are available?

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 gst1-plugins-bad: hls: allow user to select crypto backend

Hi Thomas,

Quoted 20 lines · Thomas Petazzoni

Hello,

Quoted 16 lines · Rahul Bedarkar
package/gstreamer1/gst1-plugins-bad/Config.in +16 -0
+if BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_HLS
+
+choice
+	prompt "choose HLS cryptographic backend"
+	default BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_HLS_BACKEND_NETTLE
+
+config BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_HLS_BACKEND_LIBGCRYPT
+	bool "libgcrypt"
+	depends on BR2_PACKAGE_LIBGPG_ERROR_ARCH_SUPPORTS # libgcrypt -> libgpg-error
+	select BR2_PACKAGE_LIBGCRYPT
+
+config BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_HLS_BACKEND_NETTLE
+	bool "nettle"
+	select BR2_PACKAGE_NETTLE
+
+config BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_HLS_BACKEND_OPENSSL
Quoted 8 lines

package/gstreamer1/gst1-plugins-bad/Config.in comment "gl needs the gst1-plugins-bad opengl library" · line 555

Quoted 4 lines
package/gstreamer1/gst1-plugins-bad/Config.in +4 -0
+	bool "openssl"
+	select BR2_PACKAGE_OPENSSL
+
+endchoice

I'm not sure I want to see a choice for this. Could we instead have the .mk file automatically selected the backend according to which crypto package(s) are available?

HLS plugin only supports above three crypto backends. If user hasn't specified which backend to use then build system tries find nettle or libgcrypt or openssl in order. If none of the backend is available then HLS plugin gets disabled internally.

Automatically selecting the backend based on which crypto packages are available, will work only if atleast one of supported crypto packages are selected already. If none of the supported packages are available, then we may need to add dependency on one of those crypto packages in .mk without selecting them in Config.in. That looks like broken dependency ?

Regards,

Rahul

#3 lore raw

PATCH 1/1 gst1-plugins-bad: hls: allow user to select crypto backend

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Rahul" == Rahul Bedarkar <[email protected]> writes:

Hi,

Quoted 9 lines
Quoted 3 lines

I'm not sure I want to see a choice for this. Could we instead have the .mk file automatically selected the backend according to which crypto package(s) are available?

HLS plugin only supports above three crypto backends. If user hasn't specified which backend to use then build system tries find nettle or libgcrypt or openssl in order. If none of the backend is available then HLS plugin gets disabled internally.

Quoted 6 lines

Automatically selecting the backend based on which crypto packages are available, will work only if atleast one of supported crypto packages are selected already. If none of the supported packages are available, then we may need to add dependency on one of those crypto packages in .mk without selecting them in Config.in. That looks like broken dependency ?

Yes, but we can do something like (untested):

config BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_HLS
bool "hls"
select BR2_PACKAGE_NETTLE if !(BR2_PACKAGE_GNUTLS || BR2_PACKAGE_OPENSSL) help
Fragmented streaming plugins

and then in the .mk:

ifeq ($(BR2_PACKAGE_NETTLE),y) GST1_PLUGINS_BAD_DEPENDENCIES += nettle GST1_PLUGINS_BAD_CONF_OPTS += --with-hls-crypto=nettle else ifeq ($(BR2_PACKAGE_GNUTLS),y) GST1_PLUGINS_BAD_DEPENDENCIES += libgcrypt

GST1_PLUGINS_BAD_CONF_OPTS += --with-hls-crypto=libgcrypt \
	--with-libgcrypt-prefix=$(STAGING_DIR)/usr

else
GST1_PLUGINS_BAD_DEPENDENCIES += openssl GST1_PLUGINS_BAD_CONF_OPTS += --with-hls-crypto=openssl endif

Signature · 1 line
Bye, Peter Korsgaard
#4 lore raw

PATCH 1/1 gst1-plugins-bad: hls: allow user to select crypto backend

Hi Thomas, Peter,

Quoted 16 lines · Peter Korsgaard

Yes, but we can do something like (untested):

config BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_HLS
bool "hls"
select BR2_PACKAGE_NETTLE if !(BR2_PACKAGE_GNUTLS || BR2_PACKAGE_OPENSSL) help
Fragmented streaming plugins

and then in the .mk:

ifeq ($(BR2_PACKAGE_NETTLE),y) GST1_PLUGINS_BAD_DEPENDENCIES += nettle GST1_PLUGINS_BAD_CONF_OPTS += --with-hls-crypto=nettle else ifeq ($(BR2_PACKAGE_GNUTLS),y) GST1_PLUGINS_BAD_DEPENDENCIES += libgcrypt

Quoted 7 lines
GST1_PLUGINS_BAD_CONF_OPTS += --with-hls-crypto=libgcrypt \
	--with-libgcrypt-prefix=$(STAGING_DIR)/usr

else
GST1_PLUGINS_BAD_DEPENDENCIES += openssl GST1_PLUGINS_BAD_CONF_OPTS += --with-hls-crypto=openssl endif

Thanks for suggestion. I've sent new patch.

Regards,

Rahul