After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 701673 - hlsdemux: Does not implement pkcs7 unpadding for encrypted streams
hlsdemux: Does not implement pkcs7 unpadding for encrypted streams
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
1.x
Other All
: Normal major
: 1.1.3
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-06-05 20:03 UTC by Luis Linietsky
Modified: 2013-07-23 11:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
diff for adding decryption to hls. (9.43 KB, patch)
2013-06-12 19:21 UTC, Luis Linietsky
rejected Details | Review

Description Luis Linietsky 2013-06-05 20:03:50 UTC
There seems to be missing the pkcs7 unpadding implementation.
Looking at source code, the unencrypted buffer is same size as encrypted buffer, and a buffer of same size is returned.

http://tools.ietf.org/html/rfc3602#section-2.4

The encrypted fragment will always have padding, so it has to be removed or corrupted data my be streamed.

To remove the padding the last byte for the unecrypted message has to be readed, casted to gsize, and then decreace the unencrypted buffer's size by that value.

Here is a sample with hls AES 128 + CBC encryption

http://gl.dlatv.net/demohls/TestCON-AES/playlist.m3u8

Thanks.
Comment 1 Tim-Philipp Müller 2013-06-06 11:11:58 UTC
There are patches mentioned in bug #698155 which might contain a fix for this (but needs to be ported to 1.0).
Comment 2 Luis Linietsky 2013-06-12 19:21:34 UTC
Created attachment 246666 [details] [review]
diff for adding decryption to hls.

Requested by slomo
Comment 3 Sebastian Dröge (slomo) 2013-06-14 13:43:30 UTC
This patch here needs to be ported to git master too, it not only adds the unpadding but the complete AES128 support
Comment 4 Sebastian Dröge (slomo) 2013-07-23 11:31:59 UTC
commit b9124cad884205c7db716a634737964297c9d85b
Author: Sebastian Dröge <slomo@circular-chaos.org>
Date:   Tue Jul 23 13:29:18 2013 +0200

    hlsdemux: Implement pkcs7 unpadding
    
    Every encrypted fragment will be a multiple of 128 bits, the last byte
    contains the number of bytes that were added as padding in the end
    and should be removed.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=701673