Use Inheritence for OEMCrypto Mock Properties
Merge from Widevine repo of http://go/wvgerrit/24728 We use compiler options to set different properties in the oemcrypto mock. With this CL, we define a base class that has default properties. All other variants need only define the properties that they change. b/35141278 b/37353534 Change-Id: Id38ec5bf35dcd83cea9a066ebe201e6da7c1a2b0
This commit is contained in:
@@ -8,64 +8,28 @@
|
||||
|
||||
namespace wvoec_mock {
|
||||
|
||||
// If config_local_display_only() returns true, we pretend we are using a
|
||||
// built-in display, instead of HDMI or WiFi output.
|
||||
bool CryptoEngine::config_local_display_only() {
|
||||
return true;
|
||||
}
|
||||
class L1CryptoEngine : public CryptoEngine {
|
||||
public:
|
||||
explicit L1CryptoEngine(wvcdm::FileSystem* file_system)
|
||||
: CryptoEngine(file_system) {}
|
||||
|
||||
// A closed platform is permitted to use clear buffers.
|
||||
bool CryptoEngine::config_closed_platform() {
|
||||
return false;
|
||||
}
|
||||
bool config_local_display_only() { return true; }
|
||||
|
||||
// Returns the HDCP version currently in use.
|
||||
OEMCrypto_HDCP_Capability CryptoEngine::config_current_hdcp_capability() {
|
||||
return config_local_display_only() ? HDCP_NO_DIGITAL_OUTPUT : HDCP_V1;
|
||||
}
|
||||
OEMCrypto_HDCP_Capability config_maximum_hdcp_capability() {
|
||||
return HDCP_V2;
|
||||
}
|
||||
|
||||
// Returns the max HDCP version supported.
|
||||
OEMCrypto_HDCP_Capability CryptoEngine::config_maximum_hdcp_capability() {
|
||||
return HDCP_NO_DIGITAL_OUTPUT;
|
||||
}
|
||||
bool config_is_anti_rollback_hw_present() { return true; }
|
||||
|
||||
// Returns true if the client supports persistent storage of
|
||||
// offline usage table information.
|
||||
bool CryptoEngine::config_supports_usage_table() {
|
||||
return true;
|
||||
}
|
||||
const char* config_security_level() { return "L1"; }
|
||||
|
||||
// Returns true if the client uses a keybox as the root of trust.
|
||||
bool CryptoEngine::config_supports_keybox() {
|
||||
return true;
|
||||
}
|
||||
// This should start at 0, and be incremented only when a security patch has
|
||||
// been applied to the device that fixes a security bug.
|
||||
uint8_t config_security_patch_level() { return 3; }
|
||||
};
|
||||
|
||||
// This version uses a keybox.
|
||||
OEMCrypto_ProvisioningMethod CryptoEngine::config_provisioning_method() {
|
||||
return OEMCrypto_Keybox;
|
||||
}
|
||||
|
||||
OEMCryptoResult CryptoEngine::get_oem_certificate(SessionContext *session,
|
||||
uint8_t *public_cert,
|
||||
size_t *public_cert_length) {
|
||||
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
// Returns true to indicate the client does support anti-rollback hardware.
|
||||
bool CryptoEngine::config_is_anti_rollback_hw_present() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Returns "L3" for a software only library. L1 is for hardware protected
|
||||
// data paths.
|
||||
const char* CryptoEngine::config_security_level() {
|
||||
return "L1";
|
||||
}
|
||||
|
||||
// This should start at 0, and be incremented only when a security patch has
|
||||
// been applied to the device that fixes a security bug.
|
||||
uint8_t CryptoEngine::config_security_patch_level() {
|
||||
return 3;
|
||||
CryptoEngine* CryptoEngine::MakeCryptoEngine(wvcdm::FileSystem* file_system) {
|
||||
return new L1CryptoEngine(file_system);
|
||||
}
|
||||
|
||||
} // namespace wvoec_mock
|
||||
|
||||
Reference in New Issue
Block a user