Source release v3.0.5

This commit is contained in:
Joey Parrish
2015-12-16 10:08:48 -08:00
parent 973eb25a17
commit 7a7f78d654
11 changed files with 118 additions and 72 deletions

View File

@@ -1,3 +1,14 @@
## 3.0.5 (2015-12-16)
Features:
- Add openssl\_config variable for gyp-based projects which already include
OpenSSL or BoringSSL
Bugfixes:
- Sleep between tests to avoid triggering OEMCrypto nonce-flood errors on
very fast machines
## 3.0.4 (2015-12-14) ## 3.0.4 (2015-12-14)
Features: Features:

Binary file not shown.

View File

@@ -13,6 +13,18 @@
# If set to 'dummy', privacy mode in the CDM will fail. # If set to 'dummy', privacy mode in the CDM will fail.
'privacy_crypto_impl%': 'openssl', 'privacy_crypto_impl%': 'openssl',
# There are two openssl configurations:
#
# 1) openssl_config == 'system'
# Use the openssl headers found in the sysroot and link the system library.
#
# 2) openssl_config == 'target'
# Use the openssl implementation in an existing GYP target.
# Specify the openssl target in openssl_target. This target should forward
# the include path to its headers to its dependents.
'openssl_config%': 'system',
'openssl_target%': '',
# There are three protobuf configurations: # There are three protobuf configurations:
# #
# 1) protobuf_config == 'system' # 1) protobuf_config == 'system'
@@ -136,8 +148,24 @@
'../core/src/oemcrypto_adapter_static_v10.cpp', '../core/src/oemcrypto_adapter_static_v10.cpp',
], ],
}], }],
['privacy_crypto_impl=="openssl"', {
'conditions': [
['openssl_config == "target"', {
'dependencies': [
'<(openssl_target)',
],
}, {
# openssl_config == "system"
'link_settings': {
'libraries': [
'-lcrypto',
], ],
}, },
}],
], # conditions
}], # privacy_crypto_impl=="openssl"
], # conditions
}, # widevine_cdm_core target
{ {
'target_name': 'widevine_ce_cdm_static', 'target_name': 'widevine_ce_cdm_static',
'type': 'static_library', 'type': 'static_library',
@@ -177,7 +205,7 @@
'src/log.cpp', 'src/log.cpp',
'src/properties_ce.cpp', 'src/properties_ce.cpp',
], ],
}, }, # widevine_cdm_static target
{ {
'target_name': 'widevine_ce_cdm_shared', 'target_name': 'widevine_ce_cdm_shared',
'type': 'shared_library', 'type': 'shared_library',

View File

@@ -5,6 +5,8 @@
{ {
'variables': { 'variables': {
'oemcrypto_lib%': '', 'oemcrypto_lib%': '',
'openssl_config%': 'system',
'openssl_target%': '',
}, },
'targets': [ 'targets': [
{ {
@@ -28,8 +30,6 @@
'cdm_unittests.gypi', 'cdm_unittests.gypi',
], ],
'libraries': [ 'libraries': [
'-lcrypto', # oec_mock
'-lssl', # oec_mock
'-lpthread', # gtest '-lpthread', # gtest
], ],
'dependencies': [ 'dependencies': [

View File

@@ -21,4 +21,19 @@
'UNIT_TEST', 'UNIT_TEST',
'CDM_TESTS', 'CDM_TESTS',
], ],
'conditions': [
# OpenSSL needed for http_socket
['openssl_config == "target"', {
'dependencies': [
'<(openssl_target)',
],
}, {
# openssl_config == "system"
'link_settings': {
'libraries': [
'-lssl',
],
},
}],
],
} }

View File

@@ -33,4 +33,19 @@
# correct path. # correct path.
'<(cdm_dir)/cdm/cdm.gyp:license_protocol', '<(cdm_dir)/cdm/cdm.gyp:license_protocol',
], ],
'conditions': [
# OpenSSL needed for http_socket
['openssl_config == "target"', {
'dependencies': [
'<(openssl_target)',
],
}, {
# openssl_config == "system"
'link_settings': {
'libraries': [
'-lssl',
],
},
}],
],
} }

View File

@@ -1,2 +1,2 @@
// Widevine CE CDM Version // Widevine CE CDM Version
#define CDM_VERSION "v3.0.4-0-g4dee2a8-ce" #define CDM_VERSION "v3.0.5-0-g897db53-ce"

View File

@@ -160,6 +160,13 @@ class CdmTest : public Test,
SetDefaultServerCertificate(); SetDefaultServerCertificate();
} }
virtual void TearDown() OVERRIDE {
// So the OEMCrypto nonce flood check does not trigger.
// A 500ms delay allows up to 10 nonces to be generated per test without
// triggering an OEMCrypto error.
usleep(500 * 1000);
}
void RecreateCdm(bool privacy_mode) { void RecreateCdm(bool privacy_mode) {
CreateAdditionalCdm(privacy_mode, &cdm_); CreateAdditionalCdm(privacy_mode, &cdm_);
} }

View File

@@ -8,6 +8,7 @@
#include <set> #include <set>
#include <string> #include <string>
#include "device_files.pb.h"
#include "scoped_ptr.h" #include "scoped_ptr.h"
#include "wv_cdm_types.h" #include "wv_cdm_types.h"
@@ -107,7 +108,7 @@ class DeviceFiles {
bool StoreFileRaw(const std::string& name, bool StoreFileRaw(const std::string& name,
const std::string& serialized_file); const std::string& serialized_file);
bool RetrieveHashedFile(const std::string& name, bool RetrieveHashedFile(const std::string& name,
std::string* serialized_file); video_widevine_client::sdk::File* file);
bool FileExists(const std::string& name); bool FileExists(const std::string& name);
bool RemoveFile(const std::string& name); bool RemoveFile(const std::string& name);
ssize_t GetFileSize(const std::string& name); ssize_t GetFileSize(const std::string& name);

View File

@@ -5,7 +5,6 @@
#include <string.h> #include <string.h>
#include <string> #include <string>
#include "device_files.pb.h"
#include "file_store.h" #include "file_store.h"
#include "log.h" #include "log.h"
#include "properties.h" #include "properties.h"
@@ -125,14 +124,8 @@ bool DeviceFiles::RetrieveCertificate(const std::string& origin,
SecurityLevelPathBackwardCompatibility(); SecurityLevelPathBackwardCompatibility();
} }
std::string serialized_file;
if (!RetrieveHashedFile(GetCertificateFileName(origin), &serialized_file)) {
return false;
}
video_widevine_client::sdk::File file; video_widevine_client::sdk::File file;
if (!file.ParseFromString(serialized_file)) { if (!RetrieveHashedFile(GetCertificateFileName(origin), &file)) {
LOGW("DeviceFiles::RetrieveCertificate: Unable to parse file");
return false; return false;
} }
@@ -242,14 +235,8 @@ bool DeviceFiles::RetrieveLicense(
return false; return false;
} }
std::string serialized_file;
if (!RetrieveHashedFile(key_set_id + kLicenseFileNameExt, &serialized_file)) {
return false;
}
video_widevine_client::sdk::File file; video_widevine_client::sdk::File file;
if (!file.ParseFromString(serialized_file)) { if (!RetrieveHashedFile(key_set_id + kLicenseFileNameExt, &file)) {
LOGW("DeviceFiles::RetrieveLicense: Unable to parse file");
return false; return false;
} }
@@ -362,14 +349,13 @@ bool DeviceFiles::StoreUsageInfo(const std::string& provider_session_token,
return false; return false;
} }
std::string serialized_file;
video_widevine_client::sdk::File file; video_widevine_client::sdk::File file;
std::string file_name = GetUsageInfoFileName(app_id); std::string file_name = GetUsageInfoFileName(app_id);
if (!RetrieveHashedFile(file_name, &serialized_file)) { if (!FileExists(file_name)) {
file.set_type(video_widevine_client::sdk::File::USAGE_INFO); file.set_type(video_widevine_client::sdk::File::USAGE_INFO);
file.set_version(video_widevine_client::sdk::File::VERSION_1); file.set_version(video_widevine_client::sdk::File::VERSION_1);
} else { } else {
if (!file.ParseFromString(serialized_file)) { if (!RetrieveHashedFile(file_name, &file)) {
LOGW("DeviceFiles::StoreUsageInfo: Unable to parse file"); LOGW("DeviceFiles::StoreUsageInfo: Unable to parse file");
return false; return false;
} }
@@ -384,6 +370,7 @@ bool DeviceFiles::StoreUsageInfo(const std::string& provider_session_token,
provider_session->set_license(key_response.data(), key_response.size()); provider_session->set_license(key_response.data(), key_response.size());
provider_session->set_key_set_id(key_set_id.data(), key_set_id.size()); provider_session->set_key_set_id(key_set_id.data(), key_set_id.size());
std::string serialized_file;
file.SerializeToString(&serialized_file); file.SerializeToString(&serialized_file);
return StoreFileWithHash(file_name, serialized_file); return StoreFileWithHash(file_name, serialized_file);
} }
@@ -394,15 +381,9 @@ bool DeviceFiles::DeleteUsageInfo(const std::string& app_id,
LOGW("DeviceFiles::DeleteUsageInfo: not initialized"); LOGW("DeviceFiles::DeleteUsageInfo: not initialized");
return false; return false;
} }
std::string serialized_file;
std::string file_name = GetUsageInfoFileName(app_id);
if (!RetrieveHashedFile(file_name, &serialized_file)) return false;
video_widevine_client::sdk::File file; video_widevine_client::sdk::File file;
if (!file.ParseFromString(serialized_file)) { std::string file_name = GetUsageInfoFileName(app_id);
LOGW("DeviceFiles::DeleteUsageInfo: Unable to parse file"); if (!RetrieveHashedFile(file_name, &file)) return false;
return false;
}
UsageInfo* usage_info = file.mutable_usage_info(); UsageInfo* usage_info = file.mutable_usage_info();
int index = 0; int index = 0;
@@ -429,6 +410,7 @@ bool DeviceFiles::DeleteUsageInfo(const std::string& app_id,
} }
sessions->RemoveLast(); sessions->RemoveLast();
std::string serialized_file;
file.SerializeToString(&serialized_file); file.SerializeToString(&serialized_file);
return StoreFileWithHash(file_name, serialized_file); return StoreFileWithHash(file_name, serialized_file);
} }
@@ -448,16 +430,11 @@ bool DeviceFiles::DeleteAllUsageInfoForApp(
std::string file_name = GetUsageInfoFileName(app_id); std::string file_name = GetUsageInfoFileName(app_id);
if (!FileExists(file_name)) return true; if (!FileExists(file_name)) return true;
std::string serialized_file;
if (RetrieveHashedFile(file_name, &serialized_file)) { video_widevine_client::sdk::File file;
video_widevine_client::sdk::File file_proto; if (RetrieveHashedFile(file_name, &file)) {
if (!file_proto.ParseFromString(serialized_file)) { for (int i = 0; i < file.usage_info().sessions_size(); ++i) {
LOGW("DeviceFiles::DeleteAllUsageInfoForApp: Unable to parse file"); provider_session_tokens->push_back(file.usage_info().sessions(i).token());
} else {
for (int i = 0; i < file_proto.usage_info().sessions_size(); ++i) {
provider_session_tokens->push_back(
file_proto.usage_info().sessions(i).token());
}
} }
} else { } else {
LOGW("DeviceFiles::DeleteAllUsageInfoForApp: Unable to retrieve file"); LOGW("DeviceFiles::DeleteAllUsageInfoForApp: Unable to retrieve file");
@@ -480,19 +457,14 @@ bool DeviceFiles::RetrieveUsageInfo(
return false; return false;
} }
std::string serialized_file;
std::string file_name = GetUsageInfoFileName(app_id); std::string file_name = GetUsageInfoFileName(app_id);
if (!RetrieveHashedFile(file_name, &serialized_file)) {
if (!FileExists(file_name) || GetFileSize(file_name) == 0) { if (!FileExists(file_name) || GetFileSize(file_name) == 0) {
usage_info->resize(0); usage_info->resize(0);
return true; return true;
} }
return false;
}
video_widevine_client::sdk::File file; video_widevine_client::sdk::File file;
if (!file.ParseFromString(serialized_file)) { if (!RetrieveHashedFile(file_name, &file)) {
LOGW("DeviceFiles::RetrieveUsageInfo: Unable to parse file"); LOGW("DeviceFiles::RetrieveUsageInfo: Unable to parse file");
return false; return false;
} }
@@ -515,13 +487,10 @@ bool DeviceFiles::RetrieveUsageInfo(const std::string& app_id,
LOGW("DeviceFiles::RetrieveUsageInfo: not initialized"); LOGW("DeviceFiles::RetrieveUsageInfo: not initialized");
return false; return false;
} }
std::string serialized_file;
std::string file_name = GetUsageInfoFileName(app_id);
if (!RetrieveHashedFile(file_name, &serialized_file)) return false;
std::string file_name = GetUsageInfoFileName(app_id);
video_widevine_client::sdk::File file; video_widevine_client::sdk::File file;
if (!file.ParseFromString(serialized_file)) { if (!RetrieveHashedFile(file_name, &file)) {
LOGW("DeviceFiles::RetrieveUsageInfo: Unable to parse file");
return false; return false;
} }
@@ -546,13 +515,10 @@ bool DeviceFiles::RetrieveUsageInfoByKeySetId(
LOGW("DeviceFiles::RetrieveUsageInfoByKeySetId: not initialized"); LOGW("DeviceFiles::RetrieveUsageInfoByKeySetId: not initialized");
return false; return false;
} }
std::string serialized_file;
std::string file_name = GetUsageInfoFileName(app_id);
if (!RetrieveHashedFile(file_name, &serialized_file)) return false;
std::string file_name = GetUsageInfoFileName(app_id);
video_widevine_client::sdk::File file; video_widevine_client::sdk::File file;
if (!file.ParseFromString(serialized_file)) { if (!RetrieveHashedFile(file_name, &file)) {
LOGW("DeviceFiles::RetrieveUsageInfoByKeySetId: Unable to parse file");
return false; return false;
} }
@@ -634,16 +600,16 @@ bool DeviceFiles::StoreFileRaw(const std::string& name,
} }
bool DeviceFiles::RetrieveHashedFile(const std::string& name, bool DeviceFiles::RetrieveHashedFile(const std::string& name,
std::string* serialized_file) { video_widevine_client::sdk::File* file) {
std::string serialized_file;
if (!file_.get()) { if (!file_.get()) {
LOGW("DeviceFiles::RetrieveHashedFile: Invalid file handle"); LOGW("DeviceFiles::RetrieveHashedFile: Invalid file handle");
return false; return false;
} }
if (!serialized_file) { if (!file) {
LOGW( LOGW("DeviceFiles::RetrieveHashedFile: Unspecified file parameter");
"DeviceFiles::RetrieveHashedFile: Unspecified serialized_file "
"parameter");
return false; return false;
} }
@@ -707,7 +673,10 @@ bool DeviceFiles::RetrieveHashedFile(const std::string& name,
return false; return false;
} }
*serialized_file = hash_file.file(); if (!file->ParseFromString(hash_file.file())) {
LOGW("DeviceFiles::RetrieveHashedFile: Unable to parse file");
return false;
}
return true; return true;
} }

View File

@@ -2167,8 +2167,9 @@ TEST_P(DeviceFilesUsageInfoTest, Read) {
data = kUsageInfoTestData[index].file_data; data = kUsageInfoTestData[index].file_data;
} }
if (index >= 0) { if (index >= 0) {
EXPECT_CALL(file, Exists(StrEq(path))).WillOnce(Return(true)); EXPECT_CALL(file, Exists(StrEq(path))).WillRepeatedly(Return(true));
EXPECT_CALL(file, FileSize(StrEq(path))).WillOnce(Return(data.size())); EXPECT_CALL(file, FileSize(StrEq(path)))
.WillRepeatedly(Return(data.size()));
EXPECT_CALL(file, Open(StrEq(path), IsBinaryFileFlagSet())) EXPECT_CALL(file, Open(StrEq(path), IsBinaryFileFlagSet()))
.WillOnce(Return(true)); .WillOnce(Return(true));
EXPECT_CALL(file, Read(NotNull(), Eq(data.size()))) EXPECT_CALL(file, Read(NotNull(), Eq(data.size())))
@@ -2177,7 +2178,6 @@ TEST_P(DeviceFilesUsageInfoTest, Read) {
EXPECT_CALL(file, Close()).Times(1); EXPECT_CALL(file, Close()).Times(1);
} else { } else {
EXPECT_CALL(file, Exists(StrEq(path))) EXPECT_CALL(file, Exists(StrEq(path)))
.Times(2)
.WillRepeatedly(Return(false)); .WillRepeatedly(Return(false));
EXPECT_CALL(file, FileSize(_)).Times(0); EXPECT_CALL(file, FileSize(_)).Times(0);
EXPECT_CALL(file, Open(_, _)).Times(0); EXPECT_CALL(file, Open(_, _)).Times(0);
@@ -2230,7 +2230,7 @@ TEST_P(DeviceFilesUsageInfoTest, Store) {
.WillRepeatedly(Return(true)); .WillRepeatedly(Return(true));
EXPECT_CALL(file, CreateDirectory(_)).Times(0); EXPECT_CALL(file, CreateDirectory(_)).Times(0);
EXPECT_CALL(file, Exists(StrEq(path))).WillOnce(Return(index >= 0)); EXPECT_CALL(file, Exists(StrEq(path))).WillRepeatedly(Return(index >= 0));
if (index >= 0) { if (index >= 0) {
EXPECT_CALL(file, FileSize(StrEq(path))).WillOnce(Return(data.size())); EXPECT_CALL(file, FileSize(StrEq(path))).WillOnce(Return(data.size()));
EXPECT_CALL(file, Open(StrEq(path), IsBinaryFileFlagSet())) EXPECT_CALL(file, Open(StrEq(path), IsBinaryFileFlagSet()))