Google-style override & virtual
(This is a merge of http://go/wvgerrit/66625) Google C++ Style dictates that methods which override base class or interface methods should be declared "override" but not "virtual". Since our codebase has not had access to "override" until now, many of our classes do not follow this rule. I've updated as many places as I could find to follow Google C++ Style, which should hopefully help us catch errors better in the future. Bug: 111851141 Test: CE CDM Unit Tests Test: Android Unit Tests Change-Id: Ic23e2e482e967256da306791532b5fec7b81b2f2
This commit is contained in:
@@ -18,38 +18,38 @@ class ContentKeySession : public KeySession {
|
|||||||
: KeySession(metrics),
|
: KeySession(metrics),
|
||||||
oec_session_id_(oec_session_id),
|
oec_session_id_(oec_session_id),
|
||||||
cipher_mode_(kCipherModeCtr) {}
|
cipher_mode_(kCipherModeCtr) {}
|
||||||
virtual ~ContentKeySession() {}
|
~ContentKeySession() override {}
|
||||||
|
|
||||||
virtual KeySessionType Type() override { return kDefault; }
|
KeySessionType Type() override { return kDefault; }
|
||||||
|
|
||||||
// Generate Derived Keys for ContentKeySession
|
// Generate Derived Keys for ContentKeySession
|
||||||
virtual bool GenerateDerivedKeys(const std::string& message) override;
|
bool GenerateDerivedKeys(const std::string& message) override;
|
||||||
|
|
||||||
// Generate Derived Keys (from session key) for ContentKeySession
|
// Generate Derived Keys (from session key) for ContentKeySession
|
||||||
virtual bool GenerateDerivedKeys(const std::string& message,
|
bool GenerateDerivedKeys(const std::string& message,
|
||||||
const std::string& session_key) override;
|
const std::string& session_key) override;
|
||||||
|
|
||||||
// Load Keys for ContentKeySession
|
// Load Keys for ContentKeySession
|
||||||
virtual OEMCryptoResult LoadKeys(const std::string& message,
|
OEMCryptoResult LoadKeys(const std::string& message,
|
||||||
const std::string& signature,
|
const std::string& signature,
|
||||||
const std::string& mac_key_iv,
|
const std::string& mac_key_iv,
|
||||||
const std::string& mac_key,
|
const std::string& mac_key,
|
||||||
const std::vector<CryptoKey>& keys,
|
const std::vector<CryptoKey>& keys,
|
||||||
const std::string& provider_session_token,
|
const std::string& provider_session_token,
|
||||||
CdmCipherMode* cipher_mode,
|
CdmCipherMode* cipher_mode,
|
||||||
const std::string& srm_requirement) override;
|
const std::string& srm_requirement) override;
|
||||||
|
|
||||||
virtual OEMCryptoResult LoadEntitledContentKeys(
|
OEMCryptoResult LoadEntitledContentKeys(
|
||||||
const std::vector<CryptoKey>&) override {
|
const std::vector<CryptoKey>&) override {
|
||||||
return OEMCrypto_ERROR_INVALID_CONTEXT;
|
return OEMCrypto_ERROR_INVALID_CONTEXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Select Key for ContentKeySession
|
// Select Key for ContentKeySession
|
||||||
virtual OEMCryptoResult SelectKey(const std::string& key_id,
|
OEMCryptoResult SelectKey(const std::string& key_id,
|
||||||
CdmCipherMode cipher_mode) override;
|
CdmCipherMode cipher_mode) override;
|
||||||
|
|
||||||
// Decrypt for ContentKeySession
|
// Decrypt for ContentKeySession
|
||||||
virtual OEMCryptoResult Decrypt(
|
OEMCryptoResult Decrypt(
|
||||||
const CdmDecryptionParameters& params,
|
const CdmDecryptionParameters& params,
|
||||||
OEMCrypto_DestBufferDesc& buffer_descriptor,
|
OEMCrypto_DestBufferDesc& buffer_descriptor,
|
||||||
OEMCrypto_CENCEncryptPatternDesc& pattern_descriptor) override;
|
OEMCrypto_CENCEncryptPatternDesc& pattern_descriptor) override;
|
||||||
@@ -60,8 +60,7 @@ class ContentKeySession : public KeySession {
|
|||||||
const std::string& mac_key_iv, const std::string& mac_key,
|
const std::string& mac_key_iv, const std::string& mac_key,
|
||||||
const std::vector<CryptoKey>& keys,
|
const std::vector<CryptoKey>& keys,
|
||||||
const std::string& provider_session_token, CdmCipherMode* cipher_mode,
|
const std::string& provider_session_token, CdmCipherMode* cipher_mode,
|
||||||
const std::string& srm_requirement,
|
const std::string& srm_requirement, OEMCrypto_LicenseType license_type);
|
||||||
OEMCrypto_LicenseType license_type);
|
|
||||||
|
|
||||||
CryptoSessionId oec_session_id_;
|
CryptoSessionId oec_session_id_;
|
||||||
|
|
||||||
|
|||||||
@@ -19,23 +19,23 @@ class EntitlementKeySession : public ContentKeySession {
|
|||||||
public:
|
public:
|
||||||
EntitlementKeySession(CryptoSessionId oec_session_id,
|
EntitlementKeySession(CryptoSessionId oec_session_id,
|
||||||
metrics::CryptoMetrics* metrics);
|
metrics::CryptoMetrics* metrics);
|
||||||
virtual ~EntitlementKeySession() {}
|
~EntitlementKeySession() override {}
|
||||||
|
|
||||||
KeySessionType Type() { return kEntitlement; }
|
KeySessionType Type() { return kEntitlement; }
|
||||||
|
|
||||||
// Load Keys for ContentKeySession
|
// Load Keys for ContentKeySession
|
||||||
virtual OEMCryptoResult LoadKeys(const std::string& message,
|
OEMCryptoResult LoadKeys(const std::string& message,
|
||||||
const std::string& signature,
|
const std::string& signature,
|
||||||
const std::string& mac_key_iv,
|
const std::string& mac_key_iv,
|
||||||
const std::string& mac_key,
|
const std::string& mac_key,
|
||||||
const std::vector<CryptoKey>& keys,
|
const std::vector<CryptoKey>& keys,
|
||||||
const std::string& provider_session_token,
|
const std::string& provider_session_token,
|
||||||
CdmCipherMode* cipher_mode,
|
CdmCipherMode* cipher_mode,
|
||||||
const std::string& srm_requirement) override;
|
const std::string& srm_requirement) override;
|
||||||
virtual OEMCryptoResult LoadEntitledContentKeys(
|
OEMCryptoResult LoadEntitledContentKeys(
|
||||||
const std::vector<CryptoKey>& keys) override;
|
const std::vector<CryptoKey>& keys) override;
|
||||||
virtual OEMCryptoResult SelectKey(const std::string& key_id,
|
OEMCryptoResult SelectKey(const std::string& key_id,
|
||||||
CdmCipherMode cipher_mode) override;
|
CdmCipherMode cipher_mode) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// The message is populated with the fields of the provided CryptoKey and the
|
// The message is populated with the fields of the provided CryptoKey and the
|
||||||
|
|||||||
@@ -34,21 +34,21 @@ namespace wvcdm {
|
|||||||
class UsagePropertySet : public CdmClientPropertySet {
|
class UsagePropertySet : public CdmClientPropertySet {
|
||||||
public:
|
public:
|
||||||
UsagePropertySet() {}
|
UsagePropertySet() {}
|
||||||
virtual ~UsagePropertySet() {}
|
~UsagePropertySet() override {}
|
||||||
void set_security_level(SecurityLevel security_level) {
|
void set_security_level(SecurityLevel security_level) {
|
||||||
if (kLevel3 == security_level)
|
if (kLevel3 == security_level)
|
||||||
security_level_ = QUERY_VALUE_SECURITY_LEVEL_L3;
|
security_level_ = QUERY_VALUE_SECURITY_LEVEL_L3;
|
||||||
else
|
else
|
||||||
security_level_.clear();
|
security_level_.clear();
|
||||||
}
|
}
|
||||||
virtual const std::string& security_level() const { return security_level_; }
|
const std::string& security_level() const override { return security_level_; }
|
||||||
virtual bool use_privacy_mode() const { return false; }
|
bool use_privacy_mode() const override { return false; }
|
||||||
virtual const std::string& service_certificate() const { return empty_; }
|
const std::string& service_certificate() const override { return empty_; }
|
||||||
virtual void set_service_certificate(const std::string&) {}
|
void set_service_certificate(const std::string&) override {}
|
||||||
virtual bool is_session_sharing_enabled() const { return false; }
|
bool is_session_sharing_enabled() const override { return false; }
|
||||||
virtual uint32_t session_sharing_id() const { return 0; }
|
uint32_t session_sharing_id() const override { return 0; }
|
||||||
virtual void set_session_sharing_id(uint32_t /* id */) {}
|
void set_session_sharing_id(uint32_t /* id */) override {}
|
||||||
virtual const std::string& app_id() const { return app_id_; }
|
const std::string& app_id() const override { return app_id_; }
|
||||||
void set_app_id(const std::string& appId) { app_id_ = appId; }
|
void set_app_id(const std::string& appId) { app_id_ = appId; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -48,9 +48,9 @@ class WvCdmEnginePreProvTest : public WvCdmTestBase {
|
|||||||
WvCdmEnginePreProvTest()
|
WvCdmEnginePreProvTest()
|
||||||
: cdm_engine_(&file_system_), session_opened_(false) {}
|
: cdm_engine_(&file_system_), session_opened_(false) {}
|
||||||
|
|
||||||
virtual ~WvCdmEnginePreProvTest() {}
|
~WvCdmEnginePreProvTest() override {}
|
||||||
|
|
||||||
virtual void SetUp() {
|
void SetUp() override {
|
||||||
WvCdmTestBase::SetUp();
|
WvCdmTestBase::SetUp();
|
||||||
session_opened_ = false;
|
session_opened_ = false;
|
||||||
}
|
}
|
||||||
@@ -69,7 +69,7 @@ class WvCdmEnginePreProvTest : public WvCdmTestBase {
|
|||||||
session_opened_ = true;
|
session_opened_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void TearDown() {
|
void TearDown() override {
|
||||||
if (cdm_engine_.IsProvisioned(kSecurityLevelL1)) {
|
if (cdm_engine_.IsProvisioned(kSecurityLevelL1)) {
|
||||||
cdm_engine_.Unprovision(kSecurityLevelL1);
|
cdm_engine_.Unprovision(kSecurityLevelL1);
|
||||||
}
|
}
|
||||||
@@ -150,7 +150,7 @@ class WvCdmEngineTest : public WvCdmEnginePreProvTest {
|
|||||||
public:
|
public:
|
||||||
WvCdmEngineTest() {}
|
WvCdmEngineTest() {}
|
||||||
|
|
||||||
virtual void SetUp() {
|
void SetUp() override {
|
||||||
WvCdmTestBase::SetUp();
|
WvCdmTestBase::SetUp();
|
||||||
session_opened_ = false;
|
session_opened_ = false;
|
||||||
WvCdmEnginePreProvTest::OpenSession();
|
WvCdmEnginePreProvTest::OpenSession();
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ class MockCdmLicense : public CdmLicense {
|
|||||||
|
|
||||||
class CdmSessionTest : public WvCdmTestBase {
|
class CdmSessionTest : public WvCdmTestBase {
|
||||||
protected:
|
protected:
|
||||||
virtual void SetUp() {
|
void SetUp() override {
|
||||||
WvCdmTestBase::SetUp();
|
WvCdmTestBase::SetUp();
|
||||||
cdm_session_.reset(new CdmSession(NULL, &metrics_));
|
cdm_session_.reset(new CdmSession(NULL, &metrics_));
|
||||||
// Inject testing mocks.
|
// Inject testing mocks.
|
||||||
@@ -186,7 +186,7 @@ class CdmSessionTest : public WvCdmTestBase {
|
|||||||
cdm_session_->set_file_handle(file_handle_);
|
cdm_session_->set_file_handle(file_handle_);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void TearDown() {
|
void TearDown() override {
|
||||||
// Force the cdm_session_ to be deleted. This enforces a requirement that
|
// Force the cdm_session_ to be deleted. This enforces a requirement that
|
||||||
// the CDM session metrics exist at least as long as the CDM session.
|
// the CDM session metrics exist at least as long as the CDM session.
|
||||||
cdm_session_.reset();
|
cdm_session_.reset();
|
||||||
|
|||||||
@@ -2006,7 +2006,7 @@ using ::testing::StrEq;
|
|||||||
|
|
||||||
class DeviceFilesTest : public ::testing::Test {
|
class DeviceFilesTest : public ::testing::Test {
|
||||||
protected:
|
protected:
|
||||||
virtual void SetUp() {
|
void SetUp() override {
|
||||||
ASSERT_TRUE(Properties::GetDeviceFilesBasePath(kSecurityLevelL1,
|
ASSERT_TRUE(Properties::GetDeviceFilesBasePath(kSecurityLevelL1,
|
||||||
&device_base_path_));
|
&device_base_path_));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class FileTest : public testing::Test {
|
|||||||
protected:
|
protected:
|
||||||
FileTest() {}
|
FileTest() {}
|
||||||
|
|
||||||
virtual void TearDown() { RemoveTestDir(); }
|
void TearDown() override { RemoveTestDir(); }
|
||||||
|
|
||||||
void RemoveTestDir() {
|
void RemoveTestDir() {
|
||||||
EXPECT_TRUE(file_system.Remove(test_vectors::kTestDir));
|
EXPECT_TRUE(file_system.Remove(test_vectors::kTestDir));
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class WvGenericOperationsTest : public WvCdmTestBase {
|
|||||||
WvGenericOperationsTest()
|
WvGenericOperationsTest()
|
||||||
: cdm_engine_(&file_system_), holder_(&cdm_engine_) {}
|
: cdm_engine_(&file_system_), holder_(&cdm_engine_) {}
|
||||||
|
|
||||||
virtual void SetUp() {
|
void SetUp() override {
|
||||||
WvCdmTestBase::SetUp();
|
WvCdmTestBase::SetUp();
|
||||||
EnsureProvisioned();
|
EnsureProvisioned();
|
||||||
holder_.OpenSession(config_.key_system());
|
holder_.OpenSession(config_.key_system());
|
||||||
@@ -61,7 +61,7 @@ class WvGenericOperationsTest : public WvCdmTestBase {
|
|||||||
iv_ = std::string(iv_vector_.begin(), iv_vector_.end());
|
iv_ = std::string(iv_vector_.begin(), iv_vector_.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void TearDown() { holder_.CloseSession(); }
|
void TearDown() override { holder_.CloseSession(); }
|
||||||
|
|
||||||
// Create a single key, and add it to the license.
|
// Create a single key, and add it to the license.
|
||||||
void AddOneKey(const KeyId& key_id, const std::vector<uint8_t>& key_data,
|
void AddOneKey(const KeyId& key_id, const std::vector<uint8_t>& key_data,
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ class LicenseKeysTest : public ::testing::Test {
|
|||||||
static const KeyFlag kContentClearFalse = kKeyFlagFalse;
|
static const KeyFlag kContentClearFalse = kKeyFlagFalse;
|
||||||
static const KeyFlag kContentClearTrue = kKeyFlagTrue;
|
static const KeyFlag kContentClearTrue = kKeyFlagTrue;
|
||||||
|
|
||||||
virtual void SetUp() {
|
void SetUp() override {
|
||||||
LicenseIdentification* id = license_.mutable_id();
|
LicenseIdentification* id = license_.mutable_id();
|
||||||
id->set_version(1);
|
id->set_version(1);
|
||||||
id->set_type(STREAMING);
|
id->set_type(STREAMING);
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ class CdmLicenseTest : public WvCdmTestBase {
|
|||||||
protected:
|
protected:
|
||||||
CdmLicenseTest(const std::string& pssh = (kCencInitDataHdr + kCencPssh))
|
CdmLicenseTest(const std::string& pssh = (kCencInitDataHdr + kCencPssh))
|
||||||
: pssh_(pssh) {}
|
: pssh_(pssh) {}
|
||||||
virtual void SetUp() {
|
void SetUp() override {
|
||||||
WvCdmTestBase::SetUp();
|
WvCdmTestBase::SetUp();
|
||||||
clock_ = new MockClock();
|
clock_ = new MockClock();
|
||||||
crypto_session_ = new MockCryptoSession(&crypto_metrics_);
|
crypto_session_ = new MockCryptoSession(&crypto_metrics_);
|
||||||
@@ -219,7 +219,7 @@ class CdmLicenseTest : public WvCdmTestBase {
|
|||||||
DoAll(SetArgPointee<0>(kDefaultSupportedCertTypes), Return(true)));
|
DoAll(SetArgPointee<0>(kDefaultSupportedCertTypes), Return(true)));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void TearDown() {
|
void TearDown() override {
|
||||||
if (cdm_license_) delete cdm_license_;
|
if (cdm_license_) delete cdm_license_;
|
||||||
if (policy_engine_) delete policy_engine_;
|
if (policy_engine_) delete policy_engine_;
|
||||||
if (init_data_) delete init_data_;
|
if (init_data_) delete init_data_;
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ class PolicyEngineConstraintsTest : public WvCdmTestBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void SetUp() {
|
void SetUp() override {
|
||||||
WvCdmTestBase::SetUp();
|
WvCdmTestBase::SetUp();
|
||||||
current_time_ = 0;
|
current_time_ = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ class PolicyEngineTest : public WvCdmTestBase {
|
|||||||
PolicyEngineTest() : crypto_session_(&dummy_metrics_) {
|
PolicyEngineTest() : crypto_session_(&dummy_metrics_) {
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
virtual void SetUp() {
|
void SetUp() override {
|
||||||
WvCdmTestBase::SetUp();
|
WvCdmTestBase::SetUp();
|
||||||
policy_engine_.reset(
|
policy_engine_.reset(
|
||||||
new PolicyEngine(kSessionId, &mock_event_listener_,
|
new PolicyEngine(kSessionId, &mock_event_listener_,
|
||||||
@@ -1927,7 +1927,7 @@ TEST_F(PolicyEngineKeyAllowedUsageTest, AllowedUsageGeneric) {
|
|||||||
|
|
||||||
class PolicyEngineQueryTest : public PolicyEngineTest {
|
class PolicyEngineQueryTest : public PolicyEngineTest {
|
||||||
protected:
|
protected:
|
||||||
virtual void SetUp() {
|
void SetUp() override {
|
||||||
PolicyEngineTest::SetUp();
|
PolicyEngineTest::SetUp();
|
||||||
policy_engine_.reset(new PolicyEngine(kSessionId, NULL, &crypto_session_));
|
policy_engine_.reset(new PolicyEngine(kSessionId, NULL, &crypto_session_));
|
||||||
InjectMockClock();
|
InjectMockClock();
|
||||||
|
|||||||
@@ -57,27 +57,27 @@ class StubCdmClientPropertySet : public CdmClientPropertySet {
|
|||||||
session_sharing_id_(0),
|
session_sharing_id_(0),
|
||||||
app_id_(kAppId) {}
|
app_id_(kAppId) {}
|
||||||
|
|
||||||
virtual const std::string& security_level() const { return security_level_; }
|
const std::string& security_level() const override { return security_level_; }
|
||||||
|
|
||||||
virtual bool use_privacy_mode() const { return use_privacy_mode_; }
|
bool use_privacy_mode() const override { return use_privacy_mode_; }
|
||||||
|
|
||||||
virtual const std::string& service_certificate() const {
|
const std::string& service_certificate() const override {
|
||||||
return raw_service_certificate_;
|
return raw_service_certificate_;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void set_service_certificate(const std::string& cert) {
|
void set_service_certificate(const std::string& cert) override {
|
||||||
raw_service_certificate_ = cert;
|
raw_service_certificate_ = cert;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool is_session_sharing_enabled() const {
|
bool is_session_sharing_enabled() const override {
|
||||||
return is_session_sharing_enabled_;
|
return is_session_sharing_enabled_;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual uint32_t session_sharing_id() const { return session_sharing_id_; }
|
uint32_t session_sharing_id() const override { return session_sharing_id_; }
|
||||||
|
|
||||||
virtual void set_session_sharing_id(uint32_t id) { session_sharing_id_ = id; }
|
void set_session_sharing_id(uint32_t id) override { session_sharing_id_ = id; }
|
||||||
|
|
||||||
virtual const std::string& app_id() const { return app_id_; }
|
const std::string& app_id() const override { return app_id_; }
|
||||||
|
|
||||||
void enable_privacy_mode() { use_privacy_mode_ = true; }
|
void enable_privacy_mode() { use_privacy_mode_ = true; }
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ namespace wvcdm {
|
|||||||
class WvCdmTestBase : public ::testing::Test {
|
class WvCdmTestBase : public ::testing::Test {
|
||||||
public:
|
public:
|
||||||
WvCdmTestBase() : config_(default_config_), binary_provisioning_(false) {}
|
WvCdmTestBase() : config_(default_config_), binary_provisioning_(false) {}
|
||||||
virtual ~WvCdmTestBase() {}
|
~WvCdmTestBase() override {}
|
||||||
virtual void SetUp();
|
void SetUp() override;
|
||||||
virtual std::string binary_key_id() const { return a2bs_hex(config_.key_id()); }
|
virtual std::string binary_key_id() const { return a2bs_hex(config_.key_id()); }
|
||||||
|
|
||||||
// Returns true if the test program should continue, if false, the caller
|
// Returns true if the test program should continue, if false, the caller
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ class UsageTableHeaderTest : public WvCdmTestBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void SetUp() {
|
void SetUp() override {
|
||||||
WvCdmTestBase::SetUp();
|
WvCdmTestBase::SetUp();
|
||||||
// UsageTableHeader will take ownership of the pointer
|
// UsageTableHeader will take ownership of the pointer
|
||||||
device_files_ = new MockDeviceFiles();
|
device_files_ = new MockDeviceFiles();
|
||||||
@@ -276,7 +276,7 @@ class UsageTableHeaderTest : public WvCdmTestBase {
|
|||||||
usage_table_header_->SetCryptoSession(crypto_session_);
|
usage_table_header_->SetCryptoSession(crypto_session_);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void TearDown() {
|
void TearDown() override {
|
||||||
if (usage_table_header_ != NULL) delete usage_table_header_;
|
if (usage_table_header_ != NULL) delete usage_table_header_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class Key {
|
|||||||
Key(const std::vector<uint8_t>& key_string, const KeyControlBlock& control)
|
Key(const std::vector<uint8_t>& key_string, const KeyControlBlock& control)
|
||||||
: value_(key_string), control_(control), ctr_mode_(true){};
|
: value_(key_string), control_(control), ctr_mode_(true){};
|
||||||
|
|
||||||
virtual ~Key(){};
|
virtual ~Key() {};
|
||||||
void UpdateDuration(const KeyControlBlock& control);
|
void UpdateDuration(const KeyControlBlock& control);
|
||||||
virtual const std::vector<uint8_t>& value() const { return value_; }
|
virtual const std::vector<uint8_t>& value() const { return value_; }
|
||||||
const KeyControlBlock& control() const { return control_; }
|
const KeyControlBlock& control() const { return control_; }
|
||||||
@@ -65,8 +65,8 @@ class Key {
|
|||||||
class EntitlementKey : public Key {
|
class EntitlementKey : public Key {
|
||||||
public:
|
public:
|
||||||
EntitlementKey(const Key& key) : Key(key) {}
|
EntitlementKey(const Key& key) : Key(key) {}
|
||||||
virtual ~EntitlementKey() {}
|
~EntitlementKey() override {}
|
||||||
virtual const std::vector<uint8_t>& value() const { return content_key_; }
|
const std::vector<uint8_t>& value() const override { return content_key_; }
|
||||||
const std::vector<uint8_t>& content_key() { return content_key_; }
|
const std::vector<uint8_t>& content_key() { return content_key_; }
|
||||||
const std::vector<uint8_t>& content_key_id() { return content_key_id_; }
|
const std::vector<uint8_t>& content_key_id() { return content_key_id_; }
|
||||||
const std::vector<uint8_t>& entitlement_key() { return Key::value(); }
|
const std::vector<uint8_t>& entitlement_key() { return Key::value(); }
|
||||||
|
|||||||
@@ -55,20 +55,20 @@ namespace wvoec_ref {
|
|||||||
class ContentKeysContext : public SessionContextKeys {
|
class ContentKeysContext : public SessionContextKeys {
|
||||||
public:
|
public:
|
||||||
explicit ContentKeysContext() {}
|
explicit ContentKeysContext() {}
|
||||||
virtual ~ContentKeysContext() {}
|
~ContentKeysContext() override {}
|
||||||
virtual size_t size() { return session_keys_.size(); }
|
size_t size() override { return session_keys_.size(); }
|
||||||
bool Insert(const KeyId& key_id, const Key& key_data);
|
bool Insert(const KeyId& key_id, const Key& key_data) override;
|
||||||
virtual Key* Find(const KeyId& key_id);
|
Key* Find(const KeyId& key_id) override;
|
||||||
virtual void Remove(const KeyId& key_id);
|
void Remove(const KeyId& key_id) override;
|
||||||
virtual void UpdateDuration(const KeyControlBlock& control);
|
void UpdateDuration(const KeyControlBlock& control) override;
|
||||||
|
|
||||||
virtual OEMCrypto_LicenseType type() { return OEMCrypto_ContentLicense; }
|
OEMCrypto_LicenseType type() override { return OEMCrypto_ContentLicense; }
|
||||||
|
|
||||||
virtual bool SetContentKey(const KeyId& entitlement_id,
|
bool SetContentKey(const KeyId& entitlement_id,
|
||||||
const KeyId& content_key_id,
|
const KeyId& content_key_id,
|
||||||
const std::vector<uint8_t>& content_key);
|
const std::vector<uint8_t>& content_key) override;
|
||||||
virtual bool GetEntitlementKey(const KeyId& entitlement_id,
|
bool GetEntitlementKey(const KeyId& entitlement_id,
|
||||||
const std::vector<uint8_t>** entitlement_key);
|
const std::vector<uint8_t>** entitlement_key) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SessionKeyTable session_keys_;
|
SessionKeyTable session_keys_;
|
||||||
@@ -109,19 +109,19 @@ bool ContentKeysContext::GetEntitlementKey(const KeyId& entitlement_id,
|
|||||||
class EntitlementKeysContext : public SessionContextKeys {
|
class EntitlementKeysContext : public SessionContextKeys {
|
||||||
public:
|
public:
|
||||||
EntitlementKeysContext() {}
|
EntitlementKeysContext() {}
|
||||||
virtual ~EntitlementKeysContext() {}
|
~EntitlementKeysContext() override {}
|
||||||
virtual size_t size() { return session_keys_.size(); }
|
size_t size() override { return session_keys_.size(); }
|
||||||
bool Insert(const KeyId& key_id, const Key& key_data);
|
bool Insert(const KeyId& key_id, const Key& key_data) override;
|
||||||
virtual Key* Find(const KeyId& key_id);
|
Key* Find(const KeyId& key_id) override;
|
||||||
virtual void Remove(const KeyId& key_id);
|
void Remove(const KeyId& key_id) override;
|
||||||
virtual void UpdateDuration(const KeyControlBlock& control);
|
void UpdateDuration(const KeyControlBlock& control) override;
|
||||||
virtual bool SetContentKey(const KeyId& entitlement_id,
|
bool SetContentKey(const KeyId& entitlement_id,
|
||||||
const KeyId& content_key_id,
|
const KeyId& content_key_id,
|
||||||
const std::vector<uint8_t>& content_key);
|
const std::vector<uint8_t>& content_key) override;
|
||||||
virtual bool GetEntitlementKey(const KeyId& entitlement_id,
|
bool GetEntitlementKey(const KeyId& entitlement_id,
|
||||||
const std::vector<uint8_t>** key);
|
const std::vector<uint8_t>** key) override;
|
||||||
|
|
||||||
virtual OEMCrypto_LicenseType type() { return OEMCrypto_EntitlementLicense; }
|
OEMCrypto_LicenseType type() override { return OEMCrypto_EntitlementLicense; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
EntitlementKeyTable session_keys_;
|
EntitlementKeyTable session_keys_;
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ class OEMCryptoClientTest : public ::testing::Test, public SessionUtil {
|
|||||||
protected:
|
protected:
|
||||||
OEMCryptoClientTest() {}
|
OEMCryptoClientTest() {}
|
||||||
|
|
||||||
virtual void SetUp() {
|
void SetUp() override {
|
||||||
::testing::Test::SetUp();
|
::testing::Test::SetUp();
|
||||||
wvcdm::g_cutoff = wvcdm::LOG_INFO;
|
wvcdm::g_cutoff = wvcdm::LOG_INFO;
|
||||||
const ::testing::TestInfo* const test_info =
|
const ::testing::TestInfo* const test_info =
|
||||||
@@ -100,7 +100,7 @@ class OEMCryptoClientTest : public ::testing::Test, public SessionUtil {
|
|||||||
ASSERT_EQ(OEMCrypto_SUCCESS, OEMCrypto_Initialize());
|
ASSERT_EQ(OEMCrypto_SUCCESS, OEMCrypto_Initialize());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void TearDown() {
|
void TearDown() override {
|
||||||
OEMCrypto_Terminate();
|
OEMCrypto_Terminate();
|
||||||
::testing::Test::TearDown();
|
::testing::Test::TearDown();
|
||||||
}
|
}
|
||||||
@@ -492,7 +492,7 @@ TEST_F(OEMCryptoClientTest, CanLoadTestKeys) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class OEMCryptoKeyboxTest : public OEMCryptoClientTest {
|
class OEMCryptoKeyboxTest : public OEMCryptoClientTest {
|
||||||
virtual void SetUp() {
|
void SetUp() override {
|
||||||
OEMCryptoClientTest::SetUp();
|
OEMCryptoClientTest::SetUp();
|
||||||
OEMCryptoResult sts = OEMCrypto_IsKeyboxValid();
|
OEMCryptoResult sts = OEMCrypto_IsKeyboxValid();
|
||||||
// If the production keybox is valid, use it for these tests. Most of the
|
// If the production keybox is valid, use it for these tests. Most of the
|
||||||
@@ -710,7 +710,7 @@ class OEMCryptoSessionTests : public OEMCryptoClientTest {
|
|||||||
protected:
|
protected:
|
||||||
OEMCryptoSessionTests() {}
|
OEMCryptoSessionTests() {}
|
||||||
|
|
||||||
virtual void SetUp() {
|
void SetUp() override {
|
||||||
OEMCryptoClientTest::SetUp();
|
OEMCryptoClientTest::SetUp();
|
||||||
EnsureTestKeys();
|
EnsureTestKeys();
|
||||||
if (global_features.usage_table) {
|
if (global_features.usage_table) {
|
||||||
@@ -738,7 +738,7 @@ class OEMCryptoSessionTests : public OEMCryptoClientTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void TearDown() {
|
void TearDown() override {
|
||||||
// If we installed a bad keybox, end with a good one installed.
|
// If we installed a bad keybox, end with a good one installed.
|
||||||
if (global_features.derive_key_method == DeviceFeatures::FORCE_TEST_KEYBOX)
|
if (global_features.derive_key_method == DeviceFeatures::FORCE_TEST_KEYBOX)
|
||||||
InstallKeybox(kTestKeybox, true);
|
InstallKeybox(kTestKeybox, true);
|
||||||
@@ -1294,7 +1294,7 @@ TEST_F(OEMCryptoSessionTests, LoadKeyUnalignedMessage) {
|
|||||||
class SessionTestAlternateVerification : public OEMCryptoSessionTests,
|
class SessionTestAlternateVerification : public OEMCryptoSessionTests,
|
||||||
public WithParamInterface<int> {
|
public WithParamInterface<int> {
|
||||||
public:
|
public:
|
||||||
virtual void SetUp() {
|
void SetUp() override {
|
||||||
OEMCryptoSessionTests::SetUp();
|
OEMCryptoSessionTests::SetUp();
|
||||||
target_api_ = static_cast<uint32_t>(GetParam());
|
target_api_ = static_cast<uint32_t>(GetParam());
|
||||||
}
|
}
|
||||||
@@ -1569,7 +1569,7 @@ class SessionTestRefreshKeyTest
|
|||||||
: public OEMCryptoSessionTests,
|
: public OEMCryptoSessionTests,
|
||||||
public WithParamInterface<std::pair<bool, int> > {
|
public WithParamInterface<std::pair<bool, int> > {
|
||||||
public:
|
public:
|
||||||
virtual void SetUp() {
|
void SetUp() override {
|
||||||
OEMCryptoSessionTests::SetUp();
|
OEMCryptoSessionTests::SetUp();
|
||||||
new_mac_keys_ =
|
new_mac_keys_ =
|
||||||
GetParam().first; // Whether to put new mac keys in LoadKeys.
|
GetParam().first; // Whether to put new mac keys in LoadKeys.
|
||||||
@@ -1831,7 +1831,7 @@ class OEMCryptoSessionTestsDecryptTests
|
|||||||
public WithParamInterface<tuple<OEMCrypto_CENCEncryptPatternDesc,
|
public WithParamInterface<tuple<OEMCrypto_CENCEncryptPatternDesc,
|
||||||
OEMCryptoCipherMode, bool> > {
|
OEMCryptoCipherMode, bool> > {
|
||||||
protected:
|
protected:
|
||||||
virtual void SetUp() {
|
void SetUp() override {
|
||||||
OEMCryptoSessionTests::SetUp();
|
OEMCryptoSessionTests::SetUp();
|
||||||
pattern_ = ::testing::get<0>(GetParam());
|
pattern_ = ::testing::get<0>(GetParam());
|
||||||
cipher_mode_ = ::testing::get<1>(GetParam());
|
cipher_mode_ = ::testing::get<1>(GetParam());
|
||||||
@@ -2789,7 +2789,7 @@ TEST_F(OEMCryptoLoadsCertificate, SupportsCertificatesAPI13) {
|
|||||||
|
|
||||||
class OEMCryptoUsesCertificate : public OEMCryptoLoadsCertificate {
|
class OEMCryptoUsesCertificate : public OEMCryptoLoadsCertificate {
|
||||||
protected:
|
protected:
|
||||||
virtual void SetUp() {
|
void SetUp() override {
|
||||||
OEMCryptoLoadsCertificate::SetUp();
|
OEMCryptoLoadsCertificate::SetUp();
|
||||||
ASSERT_NO_FATAL_FAILURE(session_.open());
|
ASSERT_NO_FATAL_FAILURE(session_.open());
|
||||||
if (global_features.derive_key_method !=
|
if (global_features.derive_key_method !=
|
||||||
@@ -2802,7 +2802,7 @@ class OEMCryptoUsesCertificate : public OEMCryptoLoadsCertificate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void TearDown() {
|
void TearDown() override {
|
||||||
session_.close();
|
session_.close();
|
||||||
OEMCryptoLoadsCertificate::TearDown();
|
OEMCryptoLoadsCertificate::TearDown();
|
||||||
}
|
}
|
||||||
@@ -4067,14 +4067,14 @@ class GenericCryptoTest : public OEMCryptoSessionTests {
|
|||||||
// reasonable number of blocks for most of the tests.
|
// reasonable number of blocks for most of the tests.
|
||||||
GenericCryptoTest() : buffer_size_(160) {}
|
GenericCryptoTest() : buffer_size_(160) {}
|
||||||
|
|
||||||
virtual void SetUp() {
|
void SetUp() override {
|
||||||
OEMCryptoSessionTests::SetUp();
|
OEMCryptoSessionTests::SetUp();
|
||||||
ASSERT_NO_FATAL_FAILURE(session_.open());
|
ASSERT_NO_FATAL_FAILURE(session_.open());
|
||||||
ASSERT_NO_FATAL_FAILURE(InstallTestSessionKeys(&session_));
|
ASSERT_NO_FATAL_FAILURE(InstallTestSessionKeys(&session_));
|
||||||
ASSERT_NO_FATAL_FAILURE(MakeFourKeys());
|
ASSERT_NO_FATAL_FAILURE(MakeFourKeys());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void TearDown() {
|
void TearDown() override {
|
||||||
session_.close();
|
session_.close();
|
||||||
OEMCryptoSessionTests::TearDown();
|
OEMCryptoSessionTests::TearDown();
|
||||||
}
|
}
|
||||||
@@ -4626,7 +4626,7 @@ const unsigned int kLongKeyId = 2;
|
|||||||
|
|
||||||
class GenericCryptoKeyIdLengthTest : public GenericCryptoTest {
|
class GenericCryptoKeyIdLengthTest : public GenericCryptoTest {
|
||||||
protected:
|
protected:
|
||||||
virtual void SetUp() {
|
void SetUp() override {
|
||||||
GenericCryptoTest::SetUp();
|
GenericCryptoTest::SetUp();
|
||||||
const uint32_t kNoNonce = 0;
|
const uint32_t kNoNonce = 0;
|
||||||
session_.set_num_keys(5);
|
session_.set_num_keys(5);
|
||||||
@@ -4702,7 +4702,7 @@ TEST_F(GenericCryptoKeyIdLengthTest, UniformLongKeyId) {
|
|||||||
|
|
||||||
class UsageTableTest : public GenericCryptoTest {
|
class UsageTableTest : public GenericCryptoTest {
|
||||||
public:
|
public:
|
||||||
virtual void SetUp() {
|
void SetUp() override {
|
||||||
GenericCryptoTest::SetUp();
|
GenericCryptoTest::SetUp();
|
||||||
new_mac_keys_ = true;
|
new_mac_keys_ = true;
|
||||||
}
|
}
|
||||||
@@ -4758,7 +4758,7 @@ class UsageTableTest : public GenericCryptoTest {
|
|||||||
class UsageTableTestWithMAC : public UsageTableTest,
|
class UsageTableTestWithMAC : public UsageTableTest,
|
||||||
public WithParamInterface<bool> {
|
public WithParamInterface<bool> {
|
||||||
public:
|
public:
|
||||||
virtual void SetUp() {
|
void SetUp() override {
|
||||||
UsageTableTest::SetUp();
|
UsageTableTest::SetUp();
|
||||||
new_mac_keys_ = GetParam();
|
new_mac_keys_ = GetParam();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,12 +23,12 @@ namespace wvoec {
|
|||||||
// These tests are required for LollyPop Android devices.
|
// These tests are required for LollyPop Android devices.
|
||||||
class OEMCryptoAndroidLMPTest : public ::testing::Test {
|
class OEMCryptoAndroidLMPTest : public ::testing::Test {
|
||||||
protected:
|
protected:
|
||||||
virtual void SetUp() {
|
void SetUp() override {
|
||||||
OEMCrypto_SetSandbox(kTestSandbox, sizeof(kTestSandbox));
|
OEMCrypto_SetSandbox(kTestSandbox, sizeof(kTestSandbox));
|
||||||
ASSERT_EQ(OEMCrypto_SUCCESS, OEMCrypto_Initialize());
|
ASSERT_EQ(OEMCrypto_SUCCESS, OEMCrypto_Initialize());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void TearDown() { OEMCrypto_Terminate(); }
|
void TearDown() override { OEMCrypto_Terminate(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Android devices must have a keybox, or use provisioning 3.0.
|
// Android devices must have a keybox, or use provisioning 3.0.
|
||||||
|
|||||||
Reference in New Issue
Block a user