|
|
Subscribe / Log in / New account

Kernel support for HDCP

By Jonathan Corbet
December 7, 2017
High-bandwidth Digital Content Protection (or HDCP) is an Intel-designed copy-protection mechanism for video and audio streams. It is a digital rights management (DRM) system of the type disliked by many in the Linux community. But does that antipathy mean that Linux should not support HDCP? That question is being answered — probably in favor of support — in a conversation underway on the kernel mailing lists.

HDCP is based on encryption and authentication. An HDCP-compliant device is not allowed to send high-quality media streams to any other device that cannot authenticate itself under the HDCP protocol and show that it contains a suitable key. In theory, HDCP prevents the extraction of digital media streams from a chain of devices using it; the practice is, as is often the case, a bit less certain. That notwithstanding, various content providers require HDCP to be present before making their offerings available.

Many of the devices implementing HDCP — set-top boxes, televisions, etc. — run Linux, but the kernel itself does not currently have HDCP support. That may be about to change with this patch set from Sean Paul implementing HDCP for Intel i915 graphics. One part of the patch set in particular provides a generic capability in the direct-rendering layer to enable user space to turn on the content protection feature of the hardware; the application can also verify whether the graphics subsystem was able to establish an authenticated connection with the device at the other end of the cable. Said application is likely to use that information to refuse to play content in the absence of an HDCP-compliant device on the line.

This patch is not new; it was first posted in 2014. Paul noted that: "We [Google] have been using this in ChromeOS across exynos, mediatek, and rockchip over that time". So, in a sense, the kernel has had HDCP support for some time, it just hasn't found its way into the mainline.

Naturally, some developers might prefer that such a feature not get into the mainline now either. Pavel Machek, in particular, questioned the value of HDCP support, asking when the user of a machine would ever want to turn this feature on. Alex Deucher replied that it could be used to protect sensitive video streams in governmental offices (though Alan Cox questioned that idea). Paul said: "We have a lot of Chrome OS users who would really like to enjoy premium hd content on their tvs". There is truth in that latter claim. Just like many users didn't see a Linux system as being usable without the ability to play MP3 files regardless of that format's patent issues, others want to use their systems to play content that is only available through HDCP-protected streams.

The defenders of HDCP also made the point that the hardware has the content-protection capability already; the kernel patches are merely exposing that capability to user space. They bring the feature in from the cold and put it where it can be seen; as Paul put it: "Having all of the code in the open allows users to see what is happening with their hardware, how is this a bad thing?" The alternative, he noted, might be to hide the feature entirely in the firmware or in a user-space binary blob.

The real complaint, arguably, is not that the patch makes an undesirable feature available. User space can instruct current kernels to do no end of unpleasant things already. Instead, consider this reply from Daniel Vetter explaining that the HDCP feature is not a full content-protection implementation:

If you want to actually lock down a machine to implement content protection, then you need secure boot without unlockable boot-loader and a pile more bits in userspace. If you do all that, only then do you have full content protection. And yes, then you don't really own the machine fully, and I think users who are concerned with being able to update their kernels and be able to exercise their software freedoms already know to avoid such locked down systems.

Machek complained that having the feature available would lead to the creation of more systems that are locked down in just this manner. "That is evil, and [a] direct threat to [the] free software movement", he said. No doubt, others will agree with that sentiment.

The problem with this argument, of course, is that those systems already exist, and the kernel patches that enable hardware DRM capabilities already exist. Hardware vendors have not proved to be even slightly reluctant to apply out-of-tree patches to their kernels, so keeping this feature out of the mainline is unlikely to have any measurable effect on the number of locked-down systems in the market. The technology exists, and content providers seem to be of the opinion that it will prevent their precious shows from being pirated, so it will be shipped in consumer devices regardless of the state of mainline kernel support.

What keeping this code out of the kernel would do is to make a statement that digital rights management technologies are unwelcome in general. That is an unlikely position for the kernel community to take, though. It is worthwhile to take a look back at Linus Torvalds's 2003 "DRM is perfectly OK with Linux!" posting for the policy that he applies to kernel code implementing this sort of feature. Beyond that, one should remember that the bulk of kernel development is supported by companies working in this area; such companies have proved remarkably reluctant to take this kind of philosophical position.

So the end result is almost certainly that this patch set will go in without a whole lot of fuss. In the distant future, when consumer-electronics device vendors upgrade their kernels, they'll have one less out-of-tree patch to apply in the process. Beyond that, it is unlikely that anybody will notice any difference.


to post comments

Kernel support for HDCP

Posted Dec 8, 2017 3:46 UTC (Fri) by pabs (subscriber, #43278) [Link] (4 responses)

The HDCP master key leaked 7 years ago. It would be interesting to have Linux embed this key and use it to provide a decryption API to userspace for any DRMed content that happens to be passing through to the hardware.

https://freedom-to-tinker.com/2010/09/16/understanding-hd...
http://www.zdnet.com/blog/hardware/high-bandwidth-digital...
https://web.archive.org/web/20101126154314/http://pastebi...

Kernel support for HDCP

Posted Dec 8, 2017 3:50 UTC (Fri) by pabs (subscriber, #43278) [Link]

Kernel support for HDCP

Posted Dec 12, 2017 11:53 UTC (Tue) by daniels (subscriber, #16193) [Link] (2 responses)

Content isn't encrypted when passing the device. As it passes through the media decoder, GPU and display engine, it is unencrypted; the encryption only happens immediately before it goes to the wire. I wrote up more here: https://www.collabora.com/news-and-blog/blog/2017/12/11/w...

Kernel support for HDCP

Posted Dec 12, 2017 16:08 UTC (Tue) by excors (subscriber, #95769) [Link] (1 responses)

Regarding that blog post: I'm not sure encrypted vs unencrypted is the right distinction to make. What people care about is whether users can access the pixel data. If it's stored unencrypted in RAM, but that region of RAM is inaccessible to the Linux kernel on the CPU (protected by TrustZone etc), then that's just as well protected / just as freedom-limiting as if it were encrypted in (accessible) RAM.

HDCP support by itself isn't sufficient for implementing a secure video path (i.e. proper hard-to-break DRM), but it's a necessary step towards it. It seems rational for people who object to DRM to object to every step towards it, hoping they can increase the cost of supporting DRM to be so high that its proponents decide it's no longer worthwhile and stop using DRM.

(On the other hand it appears to be far too late for that, since device manufacturers already consider the value of supporting DRM to be greater than the cost of maintaining out-of-tree patches, so objecting at this point won't stop DRM and will just increase costs with no benefit.)

Kernel support for HDCP

Posted Dec 12, 2017 16:47 UTC (Tue) by farnz (subscriber, #17727) [Link]

On the other hand, HDCP support has uses outside DRM, thanks to buggy sinks that require HDCP before they handle the data at all (this is not just a hypothetical - I've encountered an A/V amp that would only play HDMI Basic Audio unless the source had HDCP, which was fun to debug when both ends said they had valid audio data - and all my "consumer" kit does HDCP if the sink supports it, so a normal user won't know that their sink has this bug until they switch to a free OS).

So, while this might well be the first step towards a protected video path, it's also got other uses beyond DRM, thanks to buggy kit that's already in the wild.

Kernel support for HDCP

Posted Dec 8, 2017 6:43 UTC (Fri) by Otus (subscriber, #67685) [Link] (14 responses)

So the userspace application is supposed to trust the kernel when it says "yeah, HDCP enabled"? I could compile another driver/kernel that just always says yes without doing anything and it's all good?

Might as well just add the interface that always says encryption is enabled. Would amount to the same thing DRM-wise.

(If there really is a non-DRM use case it's another matter of course.)

Kernel support for HDCP

Posted Dec 8, 2017 8:03 UTC (Fri) by blackwood (guest, #44174) [Link] (13 responses)

You missed the part of the article that explains that this obviously only works as a somewhat effective content protection scheme if the machine is fully locked down using secure boot or similar. You will not be able to just patch your kernel in the DRM scenario.

Kernel support for HDCP

Posted Dec 8, 2017 21:56 UTC (Fri) by dsommers (subscriber, #55274) [Link] (1 responses)

I've compiled my own kernel module with Secure Boot enabled. I had to do some tricks with SHIM to install an additional key though. But once that was done, my kernel module was accepted like on a non Secure Boot system.

How to do that is quite well described here:
https://access.redhat.com/documentation/en-us/red_hat_ent...

The issues DRM (thus HDCP) tries to resolve can not be resolved fully by technical limitations. But lawyers and other non-techs coming up with these ideas initially are not capable of fully comprehend this. I wish they would learn at some point, but I doubt it.

Kernel support for HDCP

Posted Dec 8, 2017 23:32 UTC (Fri) by nybble41 (subscriber, #55106) [Link]

>> this obviously only works as a somewhat effective content protection scheme if the machine is fully locked down using secure boot or similar.
> I've compiled my own kernel module with Secure Boot enabled. I had to do some tricks with SHIM to install an additional key though.

Your machine used Secure Boot but was not fully locked down. On a locked-down system there would be no mechanism for installing additional keys. Even in systems which are not locked down, installing your own keys might disable support for DRM. For example, witness all the problems people have with SafetyNet on Android—just unlocking the bootloader can be enough to trigger it, even if you don't modify any of the software.

One area where this interface to enable HDCP might come in handy, outside of a locked-down system, is supplying Dolby TrueHD audio over HDMI. The relevant standards mandate that TrueHD audio can only be carried over HDMI interfaces which have HDCP enabled. It makes no difference that the _source_ of the audio was not encumbered by DRM—without HDCP, a compliant receiver won't accept TrueHD input.

Kernel support for HDCP

Posted Dec 9, 2017 10:51 UTC (Sat) by Otus (subscriber, #67685) [Link] (10 responses)

> You missed the part of the article that explains that this obviously only works as a somewhat effective content protection scheme if the machine is fully locked down using secure boot or similar.

How does the software know whether that's the case?

I mean if you have a piece of software that only comes preinstalled on, say, Chrome OS devices, then maybe you can assume that. But a media streaming app that is supposed to work on any device cannot. Firefox cannot. Those are the interesting applications for users.

Kernel support for HDCP

Posted Dec 9, 2017 12:30 UTC (Sat) by excors (subscriber, #95769) [Link]

You could do it by having some bit of hardware that contains the secret DRM-related keys, and that only allows access to them once it has done the secure-boot verification. Non-trusted user software (e.g. Firefox) can call APIs to decode and display protected video content, but can't directly access the keys or decrypted bitstream or decoded pixels. The trusted hardware/firmware/software is responsible for enforcing those access restrictions (perhaps including only permitting display over HDCP-enabled links), and the device manufacturer won't be given legal permission to use the DRM keys until they've given sufficient assurances that they've designed their system well enough.

Firefox might still need to know about HDCP so it can enable it when desired, present meaningful error messages to the user, etc, so it needs APIs for that; but it can't subvert the DRM, since that's enforced at lower levels.

Kernel support for HDCP

Posted Dec 9, 2017 13:32 UTC (Sat) by emunson (subscriber, #44357) [Link] (8 responses)

TPM attestation, this is one of the primary use cases of it. Through the TPM userspace can verify the boot chain from firmware* up.

*Caveats apply about trusting firmware, etc

Kernel support for HDCP

Posted Dec 9, 2017 20:28 UTC (Sat) by mjg59 (subscriber, #23239) [Link] (7 responses)

No it can't - userspace has no way of knowing whether it's talking to a real TPM, and you can modify userspace so it thinks it is even if there's no TPM present at all.

Kernel support for HDCP

Posted Dec 10, 2017 3:27 UTC (Sun) by emunson (subscriber, #44357) [Link] (2 responses)

Then I am at a loss for how this will be useful in kernel. Vendors can sell locked down devices like chromecast, etc. But they are likely already carrying this sort of thing.

Kernel support for HDCP

Posted Dec 11, 2017 11:53 UTC (Mon) by matthias (subscriber, #94967) [Link]

Vendors need to ship one less out-of-tree patch. The advantages are the usual: no added maintenance efforts to port the patch when internal kernel structures change. As these changes are done by the Kernel community for in-tree code.

Kernel support for HDCP

Posted Dec 12, 2017 12:20 UTC (Tue) by farnz (subscriber, #17727) [Link]

I've encountered A/V gear that will only handle 48 kHz, 16 bit stereo PCM or lower quality audio without HDCP - it simply outputs silence if you give it anything else. Without this change, Linux is limited to low quality audio; with it, it can send bitstream audio to that device (Dolby Digital, DTS and friends), or it can send anything up to 192 kHz 8 channel 24 bit PCM and have it heard.

So, that's one gain - better interoperability with buggy gear.

Kernel support for HDCP

Posted Dec 11, 2017 13:45 UTC (Mon) by mageta (subscriber, #89696) [Link] (3 responses)

That is not true.

TPM designed a way for this: EK certificates. The EK private portion is saved on the TPM, the public part is signed on a certificate by a third party and proves that the key-pair belongs to a real TPM. If the DRM software would verify this, then it'll be hard for you to "fake" a TPM in software, w/o also convincing the signing party that your software TPM is "real".

At least that is my somewhat outdated understanding (last time I did something with TPM was 3 years ago).

Kernel support for HDCP

Posted Dec 11, 2017 19:37 UTC (Mon) by mjg59 (subscriber, #23239) [Link] (2 responses)

How can the DRM software verify it? You can just patch out the check.

Kernel support for HDCP

Posted Dec 11, 2017 21:43 UTC (Mon) by mageta (subscriber, #89696) [Link] (1 responses)

I am not an expert in tamper proof/resistant software. From the top of my head I know that even commodity hardware now a days have stuff like Intel TXT + TPM, that would allow to preprogram a TPM with accepted program states (hashes of ELF binaries or something) and then let you proof this via signatures to the 3. party, before that 3. party is gonna let you have whatever content/access you wanna have.

Anyway. I am by no means an expert in making tamper proof/resistant software. I just knew that for the one case you mentioned, there was a solution. How to build that into a closed complete stack is too much for my limited knowledge.

Kernel support for HDCP

Posted Dec 11, 2017 21:59 UTC (Mon) by mjg59 (subscriber, #23239) [Link]

Yes, you can perform remote attestation (although that's easily circumvented by simply using a second TPM), but there's no practical mechanism to deploy that in the real world.

Kernel support for HDCP

Posted Dec 8, 2017 15:18 UTC (Fri) by JFlorian (guest, #49650) [Link] (5 responses)

I am no fan of DRM, quite the opposite in fact, but it seems incongruous to reject an attempt to bring something like this into the mainline. There's no end of preaching about how much better it would be if some proprietary driver were simply mainlined. Shouldn't Linux be more welcoming?

Kernel support for HDCP

Posted Dec 8, 2017 17:20 UTC (Fri) by mageta (subscriber, #89696) [Link] (1 responses)

I doubt even a single company will consider bringing more drivers into the kernel, just because some DRM was accepted. Maybe more DRM drivers, at best.

Showing "goodwill" here buys us nothing.

But I guess its the practical thing to do...

Kernel support for HDCP

Posted Dec 8, 2017 19:29 UTC (Fri) by JFlorian (guest, #49650) [Link]

I completely agree. My comment was intended to point out the double standard.

Kernel support for HDCP

Posted Dec 9, 2017 6:24 UTC (Sat) by flussence (guest, #85566) [Link] (2 responses)

I don't see it as any different than the wireless regulatory code. That's been mainline for years now, and all that changed is corporate imbeciles like Broadcom/Qualcomm lost their main excuse to hide everything behind proprietary firmware, and indeed they eventually caved and we no longer need b43-fwcutter or ndiswrapper. Not that the vendor-written mainline drivers are much better…

Now the same spotlight will be shining on AMD and nVidia, who've both just lost the #1 excuse for, respectively, gerrymandering radeonhd/avivo to death and being nVidia. If they won't shape up, the hacker subculture that's currently tearing Intel ME to shreds will probably answer for them without the mercy of an NDA. Who knows what skeletons are in their blob firmware closets?

Kernel support for HDCP

Posted Dec 10, 2017 0:54 UTC (Sun) by pabs (subscriber, #43278) [Link] (1 responses)

When did Broadcom/Qualcomm release their WiFi firmware source code under a FLOSS license?

The only WiFi vendor I know of who did that was Atheros before they were bought by Qualcomm (ar9170.fw and open-ath9k-htc-firmware). The Free Software advocate who was responsible for that left the company before the sale IIRC, so it seems unlikely Qualcomm would start releasing code.

The WiFi firmware reverse engineering efforts I'm aware of are not doing very well. The last OpenFWWF release was one year ago. p54u is completely dead and the source code seems gone from the Internet.

Kernel support for HDCP

Posted Dec 15, 2017 8:27 UTC (Fri) by flussence (guest, #85566) [Link]

>When did Broadcom/Qualcomm release their WiFi firmware source code under a FLOSS license?
They didn't, but for a long time they clung to regulatory laws as an excuse for having proprietary *drivers* too - that's the whole charade CRDA was built to shoot down, and it was mostly successful. We no longer need b43-fwcutter because there's no driver blob to cut the firmware out of.

My point is that by having HDCP in-kernel, there's another nail in the coffin for proprietary graphics driver blobs (Broadcom/Qualcomm are awful in this area too). Closed firmware is still Evil™ but it's usually tiny compared to drivers, thus much easier to figure out what's being kept hidden and put targeted pressure on the vendors.


Copyright © 2017, Eklektix, Inc.
This article may be redistributed under the terms of the Creative Commons CC BY-SA 4.0 license
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds