These are a set of CLs merged from the wv cdm repo to the android repo. * Android build fixes Author: Rahul Frias <rfrias@google.com> [ Merge of http://go/wvgerrit/36322 ] * Address android compilation errors and warnings Author: Rahul Frias <rfrias@google.com> [ Merge of http://go/wvgerrit/36300 ] * Gyp cleanup and OpenSSL v10.1 support. Author: Gene Morgan <gmorgan@google.com> [ Merge of http://go/wvgerrit/36001 ] OpenSSL 10.1 has a small number of incompatible changes. A desktop system upgrade exposed some issue in the build scripts. Specifically, the linux build was using both third_party/protobufs (2.6.1) and the version installed on the system (3.0 in this case). The linux cdm.gyp depended on cdm/cdm.gyp which caused that plus some additional issues. These changes are necessary to support g++ version: g++ (Debian 6.3.0-18) 6.3.0 20170516 Also did some cosmetic rework on run_current_tests to make it easier to figure out what is going on when something fails. Also tweaked some of the compiler settings for g++ support (revisit this later). * Refactored Service Certificate encryption to allow encryption of arbitrary data. Author: Thomas Inskip <tinskip@google.com> [ Merge of http://go/wvgerrit/36141 ] * Send cdm test requests to UAT. Author: Jeff Fore <jfore@google.com> [ Merge of http://go/wvgerrit/36221 ] This change resolves the all of the CdmDecryptTest/CdmTestWithDecryptParam.DecryptToClearBuffer tests. The license servers will return different keys and keyids. Sending the request to staging returned key ids and keys that were not matching what was expected in the unit tests. * Fix for building L3 OEMCrypto with clang and libc++ Author: yucliu <yucliu@google.com> [ Merge of http://go/wvgerrit/35740 ] 1. Include <time.h> for time(time_t*). 2. Create endian check union on stack. Clang may create const union somewhere else, which may cause crash. * Remove error result when a sublicense session does not exist. This is not considered an error. Author: Jeff Fore <jfore@google.com> [ Merge of http://go/wvgerrit/36080 ] * Set default mock handler for GetSupportedCertificateTypes for all unit tests and removed the use of StrictMock from MockCryptoSession. Author: Jeff Fore <jfore@google.com> [ Merge of http://go/wvgerrit/35922 ] The handler for this was only set for one test and resulted in a number of failures. * Set default handler for GetHdcpCapabilities. For now the default action is to call the real GetHdcpCapabilities of crypto_session. Author: Jeff Fore <jfore@google.com> [ Merge of http://go/wvgerrit/36140 ] I also changed the mock to a NiceMock to silence responses to unexpected calls to GetHdcpCapabilities. The default handler can be overridden as needed in the individual tests. This resolves the policy engine test failures. * Finalize merge of cdm_partner_3.4 to master. Author: Gene Morgan <gmorgan@google.com> [ Merge of http://go/wvgerrit/35360 ] This is the final set of updates to merge all v3.4.1 changes into master. * Embedded license: Sublicense rotation. Author: Jeff Fore <jfore@google.com> [ Merge of http://go/wvgerrit/35360 ] Handle sublicense rotation event. * Embedded license: Initial license phase. Author: Jeff Fore <jfore@google.com> [ Merge of http://go/wvgerrit/34280 ] Initial license phase - key loading subsession. * Embedded license: generate session data. Author: Jeff Fore <jfore@google.com> [ Merge of http://go/wvgerrit/33722 ] Generate session data and add it to the license request for any embedded license material. * Resolve missing symbol when building cd-cdm Author: Jeff Fore <jfore@google.com> [ Merge of http://go/wvgerrit/35840 ] * C++11: Replace OVERRIDE def with override keyword Author: Gene Morgan <gmorgan@google.com> [ Merge of http://go/wvgerrit/35400 ] BUG: 71650075 Test: Not currently passing. Will be addressed in a subsequent commit in the chain. Change-Id: I37d0cb17f255ac6389030047d616ad69f895748c
130 lines
4.9 KiB
C++
130 lines
4.9 KiB
C++
// Copyright 2013 Google Inc. All Rights Reserved.
|
|
|
|
#ifndef WVCDM_CORE_PROPERTIES_H_
|
|
#define WVCDM_CORE_PROPERTIES_H_
|
|
|
|
#include <map>
|
|
#include <string>
|
|
|
|
#include "cdm_client_property_set.h"
|
|
#include "lock.h"
|
|
#include "scoped_ptr.h"
|
|
#include "wv_cdm_types.h"
|
|
|
|
#if defined(UNIT_TEST)
|
|
# include <gtest/gtest_prod.h>
|
|
#endif
|
|
|
|
namespace wvcdm {
|
|
|
|
typedef std::map<CdmSessionId, CdmClientPropertySet*>
|
|
CdmClientPropertySetMap;
|
|
|
|
// This class saves information about features and properties enabled
|
|
// for a given platform. At initialization it initializes properties from
|
|
// property_configuration.h. That file specifies features selected for each
|
|
// platform. Core CDM can then query enabled features though specific getter
|
|
// methods.
|
|
// Setter methods are provided but their only planned use is for testing.
|
|
class Properties {
|
|
public:
|
|
static void Init();
|
|
|
|
static inline bool oem_crypto_use_secure_buffers() {
|
|
return oem_crypto_use_secure_buffers_;
|
|
}
|
|
static inline bool oem_crypto_use_fifo() { return oem_crypto_use_fifo_; }
|
|
static inline bool oem_crypto_use_userspace_buffers() {
|
|
return oem_crypto_use_userspace_buffers_;
|
|
}
|
|
static inline bool use_certificates_as_identification() {
|
|
return use_certificates_as_identification_;
|
|
}
|
|
static inline bool provisioning_messages_are_binary() {
|
|
return provisioning_messages_are_binary_;
|
|
}
|
|
static void set_provisioning_messages_are_binary(bool flag) {
|
|
provisioning_messages_are_binary_ = flag;
|
|
}
|
|
static inline bool security_level_path_backward_compatibility_support() {
|
|
return security_level_path_backward_compatibility_support_;
|
|
}
|
|
static bool GetCompanyName(std::string* company_name);
|
|
static bool GetModelName(std::string* model_name);
|
|
static bool GetArchitectureName(std::string* arch_name);
|
|
static bool GetDeviceName(std::string* device_name);
|
|
static bool GetProductName(std::string* product_name);
|
|
static bool GetBuildInfo(std::string* build_info);
|
|
static bool GetWVCdmVersion(std::string* version);
|
|
static bool GetDeviceFilesBasePath(CdmSecurityLevel security_level,
|
|
std::string* base_path);
|
|
static bool GetFactoryKeyboxPath(std::string* keybox);
|
|
static bool GetOEMCryptoPath(std::string* library_name);
|
|
static bool AlwaysUseKeySetIds();
|
|
static bool UseProviderIdInProvisioningRequest();
|
|
|
|
static bool GetSecurityLevelDirectories(std::vector<std::string>* dirs);
|
|
static bool GetApplicationId(const CdmSessionId& session_id,
|
|
std::string* app_id);
|
|
static bool GetServiceCertificate(const CdmSessionId& session_id,
|
|
std::string* service_certificate);
|
|
static bool SetServiceCertificate(const CdmSessionId& session_id,
|
|
const std::string& service_certificate);
|
|
static bool GetDeviceProvisioningServiceCertificate(
|
|
const CdmSessionId& session_id, std::string* service_certificate);
|
|
static bool SetDeviceProvisioningServiceCertificate(
|
|
const CdmSessionId& session_id, const std::string& service_certificate);
|
|
static bool UsePrivacyMode(const CdmSessionId& session_id);
|
|
static uint32_t GetSessionSharingId(const CdmSessionId& session_id);
|
|
|
|
static bool AddSessionPropertySet(const CdmSessionId& session_id,
|
|
CdmClientPropertySet* property_set);
|
|
static bool RemoveSessionPropertySet(const CdmSessionId& session_id);
|
|
|
|
private:
|
|
static CdmClientPropertySet* GetCdmClientPropertySet(
|
|
const CdmSessionId& session_id);
|
|
static void set_oem_crypto_use_secure_buffers(bool flag) {
|
|
oem_crypto_use_secure_buffers_ = flag;
|
|
}
|
|
static void set_oem_crypto_use_fifo(bool flag) {
|
|
oem_crypto_use_fifo_ = flag;
|
|
}
|
|
static void set_oem_crypto_use_userspace_buffers(bool flag) {
|
|
oem_crypto_use_userspace_buffers_ = flag;
|
|
}
|
|
static void set_use_certificates_as_identification(bool flag) {
|
|
use_certificates_as_identification_ = flag;
|
|
}
|
|
static void set_security_level_path_backward_compatibility_support(
|
|
bool flag) {
|
|
security_level_path_backward_compatibility_support_ = flag;
|
|
}
|
|
|
|
#if defined(UNIT_TEST)
|
|
FRIEND_TEST(CdmSessionTest, InitWithBuiltInCertificate);
|
|
FRIEND_TEST(CdmSessionTest, InitWithCertificate);
|
|
FRIEND_TEST(CdmSessionTest, InitWithKeybox);
|
|
FRIEND_TEST(CdmSessionTest, ReInitFail);
|
|
FRIEND_TEST(CdmSessionTest, InitFailCryptoError);
|
|
FRIEND_TEST(CdmSessionTest, InitNeedsProvisioning);
|
|
FRIEND_TEST(CdmLicenseTest, PrepareKeyRequestValidation);
|
|
FRIEND_TEST(SubLicenseTest, VerifySubSessionData);
|
|
#endif
|
|
|
|
private:
|
|
static bool oem_crypto_use_secure_buffers_;
|
|
static bool oem_crypto_use_fifo_;
|
|
static bool oem_crypto_use_userspace_buffers_;
|
|
static bool use_certificates_as_identification_;
|
|
static bool security_level_path_backward_compatibility_support_;
|
|
static bool provisioning_messages_are_binary_;
|
|
static scoped_ptr<CdmClientPropertySetMap> session_property_set_;
|
|
|
|
CORE_DISALLOW_COPY_AND_ASSIGN(Properties);
|
|
};
|
|
|
|
} // namespace wvcdm
|
|
|
|
#endif // WVCDM_CORE_PROPERTIES_H_
|