Backed out changeset ca27bcfe3e5b (bug 1060179)

This commit is contained in:
Carsten "Tomcat" Book 2014-10-09 12:48:13 +02:00
Родитель cd937732c3
Коммит 86379545f9
1 изменённых файлов: 1 добавлений и 44 удалений

Просмотреть файл

@ -25,21 +25,6 @@ using mozilla::dom::CrashReporterChild;
#include <unistd.h> // for _exit()
#endif
#if defined(XP_WIN)
// In order to provide EME plugins with a "device binding" capability,
// in the parent we generate and store some random bytes as salt for every
// (origin, urlBarOrigin) pair that uses EME. We store these bytes so
// that every time we revisit the same origin we get the same salt.
// We send this salt to the child on startup. The child collects some
// device specific data and munges that with the salt to create the
// "node id" that we expose to EME plugins. It then overwrites the device
// specific data, and activates the sandbox.
#define HASH_NODE_ID_WITH_DEVICE_ID 1
#include "rlz/lib/machine_id.h"
#include "rlz/lib/string_utils.h"
#include "mozilla/SHA1.h"
#endif
#if defined(MOZ_SANDBOX) && defined(XP_WIN)
#define TARGET_SANDBOX_EXPORTS
#include "mozilla/sandboxTarget.h"
@ -254,36 +239,8 @@ GMPChild::Init(const std::string& aPluginPath,
bool
GMPChild::RecvSetNodeId(const nsCString& aNodeId)
{
#ifdef HASH_NODE_ID_WITH_DEVICE_ID
if (!aNodeId.IsEmpty() && !aNodeId.EqualsLiteral("null")) {
string16 deviceId;
int volumeId;
if (!rlz_lib::GetRawMachineId(&deviceId, &volumeId)) {
return false;
}
// TODO: Switch to SHA256.
mozilla::SHA1Sum hash;
hash.update(deviceId.c_str(), deviceId.size() * sizeof(string16::value_type));
hash.update(aNodeId.get(), aNodeId.Length());
hash.update(&volumeId, sizeof(int));
uint8_t digest[mozilla::SHA1Sum::kHashSize];
hash.finish(digest);
if (!rlz_lib::BytesToString(digest, mozilla::SHA1Sum::kHashSize, &mNodeId)) {
return false;
}
// Overwrite device id as it could potentially identify the user, so
// there's no chance a GMP can read it and use it for identity tracking.
volumeId = 0;
memset(&deviceId.front(), '*', sizeof(string16::size_type) * deviceId.size());
deviceId = L"";
} else {
mNodeId = "null";
}
#else
// TODO: hash mNodeId with machine specific data.
mNodeId = std::string(aNodeId.BeginReading(), aNodeId.EndReading());
#endif
return true;
}