Closed Bug 1214018 Opened 4 years ago Closed 4 years ago

[EME] Generate machine ID on MacOSX

Categories

(Core :: Audio/Video: MediaStreamGraph, defect, P2)

Unspecified
macOS
defect

Tracking

()

RESOLVED FIXED
mozilla45
Tracking Status
firefox45 --- fixed

People

(Reporter: cpearce, Assigned: gerald)

References

(Blocks 1 open bug)

Details

Attachments

(4 files, 2 obsolete files)

For Adobe EME to be supported on MacOSX, we'll need a machine-specific ID. We used rlz on Windows, I don't recall whether that has a MacOSX implementation.
Assignee: nobody → gsquelart
Part 1: Using vector to pass machine id.

GetRawMachineId was returning its generated data through a 'string16', which on
Windows was conveniently equivalent to a std::wstring.

However on Mac, wstring uses 32-bit characters, so in order to comply with the
string16 interface, a lot of non-trivial code would have to be imported and
vetted.

Also, in the end GMPLoader::Load passes this string16 to SHA256_Update() as a
sequence of bytes, the actual type of the data is lost!

So to simplify this work, GetRawMachineId will now return its data through a
vector of bytes, and the platform-dependent implementations may use whatever
data type they want internally.

The Windows GetRawMachineId actually returns the same data in this vector, so
it stays compatible with the previous code.
Attachment #8680946 - Flags: review?(cpearce)
Part 3: Modify machine_id_mac for FF build.

Necessary routines were extracted from other files in:
https://chromium.googlesource.com/chromium/src/+/6c3bf032651d5f912775e0c8cd7e962454145ced/
(otherwise a lot of code would have had to be imported, most of which would be
unused anyway.)
These extracted routines were reduced to only the actually-used code.

base::StringPrintf was only used to stringify a few hex values, this particular
use was easier to reimplement in a small loop rather than trying to extract the
whole printf suite.

base::UTF8toUTF16 is not needed, as we just return bytes. So internally a
std::string (containing UTF8) is used and its contents transferred to the
output buffer.
Attachment #8680949 - Flags: review?(cpearce)
Part 4: Use machine_id_mac in GMPLoader.

Having HASH_NODE_ID_WITH_DEVICE_ID #defined is enough for GMPLoader to start
using the Mac version of GetRawMachineId.

Note: The stack (that may contain information gathered during GetRawMachineId)
is not erased, so it could theoretically be possible for a compromised GMP to
find out some sensitive user information. Another bug will deal with this.
Attachment #8680950 - Flags: review?(cpearce)
Attachment #8680946 - Flags: review?(cpearce) → review+
Attachment #8680947 - Flags: review?(cpearce) → review+
Comment on attachment 8680949 [details] [diff] [review]
1214018-p3-port-machine_id_mac.patch

Review of attachment 8680949 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/media/gmp/rlz/mac/lib/machine_id_mac.cc
@@ +11,3 @@
>  
> +// Note: The original machine_id_mac.cc code is in namespace rlz_lib below.
> +// It depends on some external files, which would bring in a log of Android code

"log of Android code"

You mean "lot of Chromium code", right?

@@ +286,5 @@
> +    id += "mac:";
> +    static const char hex[] =
> +      { '0', '1', '2', '3', '4', '5', '6', '7',
> +        '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
> +    for (int i = 0; i < 6; ++i) {

s/6/kIOEthernetAddressSize/
Attachment #8680949 - Flags: review?(cpearce) → review+
Attachment #8680950 - Flags: review?(cpearce) → review+
Only changed check-in comment (Android->Chromium), no actual code change; carrying r=cpearce.
Attachment #8680947 - Attachment is obsolete: true
Attachment #8681022 - Flags: review+
Small update to address review comments from comment 5. Carrying r=cpearce.
Attachment #8680949 - Attachment is obsolete: true
Attachment #8681024 - Flags: review+
removing the b2g 2.5 flag since this commit has been reverted due to an incorrect merge, sorry for the confusion
See Also: → 1422669
You need to log in before you can comment on or make changes to this bug.