Support CE CDM in OEMCrypto Testbed

(This is a merge of http://go/wvgerrit/81628. Although it is primarily
to support a CE CDM feature, this patch touched shared code and so must
be merged.)

The problem that has long stopped the OEMCrypto Testbed from working
with the CE CDM build is that the OEMCrypto Testbed sometimes accesses
the storage via the normal filesystem APIs rather than the FileSystem
abstraction. Furthermore, when doing this, it assumes that FileSystem
abstraction is just a wrapper around direct filesystem access and thus
it should use the same paths in both kinds of filesystem access.
However, this is not true on the CE CDM where FileSystem wraps an opaque
key/value store.

This patch adds a property that allows a platform to indicate if its
FileSystem base path represents a real file system path and sets it
appropriately. ("true" for all platforms except CE CDM) It also adds
code to the OEMCrypto Testbed that makes use of this property to modify
its behavior. When running on a device where the FileSystem base path is
not a real file system path, it will instead use the directory of the
current executable as its base path when accessing the filesystem
directly.

Bug: 129311942
Test: CE CDM Build with Fake L1
Test: Android Build
Change-Id: Iadb3cc57d3bbc8ce0d49224b7df31c46bd5ea56c
This commit is contained in:
John W. Bruce
2019-06-21 19:24:21 -07:00
committed by Rahul Frias
parent 6004c2a945
commit 435f839f7e
4 changed files with 14 additions and 0 deletions

View File

@@ -52,6 +52,9 @@ class Properties {
static inline bool allow_service_certificate_requests() {
return allow_service_certificate_requests_;
}
static inline bool device_files_is_a_real_filesystem() {
return device_files_is_a_real_filesystem_;
}
static void set_provisioning_messages_are_binary(bool flag) {
provisioning_messages_are_binary_ = flag;
}
@@ -62,6 +65,9 @@ class Properties {
static bool GetProductName(std::string* product_name);
static bool GetBuildInfo(std::string* build_info);
static bool GetWVCdmVersion(std::string* version);
// Gets the base path for the device non-secure storage. Note that, depending
// on the value of device_files_is_a_real_filesystem, this may or may not be
// a real filesystem path.
static bool GetDeviceFilesBasePath(CdmSecurityLevel security_level,
std::string* base_path);
static bool GetFactoryKeyboxPath(std::string* keybox);
@@ -136,6 +142,7 @@ class Properties {
static bool use_certificates_as_identification_;
static bool provisioning_messages_are_binary_;
static bool allow_service_certificate_requests_;
static bool device_files_is_a_real_filesystem_;
static std::unique_ptr<CdmClientPropertySetMap> session_property_set_;
CORE_DISALLOW_COPY_AND_ASSIGN(Properties);

View File

@@ -19,6 +19,7 @@ bool Properties::oem_crypto_use_fifo_;
bool Properties::oem_crypto_use_userspace_buffers_;
bool Properties::provisioning_messages_are_binary_;
bool Properties::allow_service_certificate_requests_;
bool Properties::device_files_is_a_real_filesystem_;
std::unique_ptr<CdmClientPropertySetMap> Properties::session_property_set_;
bool Properties::AddSessionPropertySet(const CdmSessionId& session_id,

View File

@@ -29,6 +29,11 @@ const bool kPropertyProvisioningMessagesAreBinary = false;
// an error will be generated.
const bool kAllowServiceCertificateRequests = true;
// Indicates whether this platform's FileSystem abstraction maps directly to the
// device filesystem or whether there is a layer of indirection. If set to true,
// code may treat the DeviceFiles base path as a raw filesystem path.
const bool kDeviceFilesIsARealFileSystem = true;
} // namespace wvcdm
#endif // CDM_BASE_WV_PROPERTIES_CONFIGURATION_H_

View File

@@ -49,6 +49,7 @@ void Properties::InitOnce() {
oem_crypto_use_userspace_buffers_ = kPropertyOemCryptoUseUserSpaceBuffers;
provisioning_messages_are_binary_ = kPropertyProvisioningMessagesAreBinary;
allow_service_certificate_requests_ = kAllowServiceCertificateRequests;
device_files_is_a_real_filesystem_ = kDeviceFilesIsARealFileSystem;
session_property_set_.reset(new CdmClientPropertySetMap());
}