OEMCrypto Resource Rating
Merge from master branch of Widevine repo of http://go/wvgerrit/66072 Merge from oemcrypto-v15 branch of Widevine repo of http://go/wvgerrit/63764 This adds the function OEMCrypto_ResourceRatingTier to the oemcrypto referenece code, dynamic adapter, and unit tests. Bug: 117110800 Test: tested as part of http://go/ag/5501993 Change-Id: Idf47af405f0c69601108b75c788a97b30abdb39d
This commit is contained in:
@@ -54,6 +54,7 @@ OEMCryptoResult OEMCrypto_CreateOldUsageEntry(SecurityLevel level,
|
||||
size_t pst_length);
|
||||
uint32_t OEMCrypto_GetAnalogOutputFlags(SecurityLevel level);
|
||||
const char* OEMCrypto_BuildInformation(SecurityLevel level);
|
||||
uint32_t OEMCrypto_ResourceRatingTier(SecurityLevel level);
|
||||
} // namespace wvcdm
|
||||
|
||||
/* The following functions are deprecated in OEMCrypto v13. They are defined
|
||||
|
||||
@@ -40,6 +40,7 @@ std::string EncodeUint32(unsigned int u) {
|
||||
}
|
||||
|
||||
const uint32_t kRsaSignatureLength = 256;
|
||||
// TODO(b/117112392): adjust chunk size based on resource rating.
|
||||
const size_t kMaximumChunkSize = 100 * 1024; // 100 KiB
|
||||
const size_t kEstimatedInitialUsageTableHeader = 40;
|
||||
const size_t kOemCryptoApiVersionSupportsBigUsageTables = 13;
|
||||
|
||||
@@ -270,6 +270,7 @@ typedef OEMCryptoResult (*L1_CreateOldUsageEntry_t)(
|
||||
size_t pst_length);
|
||||
typedef uint32_t (*L1_GetAnalogOutputFlags_t)(void);
|
||||
typedef const char* (*L1_BuildInformation_t)(void);
|
||||
typedef uint32_t (*L1_ResourceRatingTier_t)(void);
|
||||
|
||||
struct FunctionPointers {
|
||||
uint32_t version;
|
||||
@@ -338,6 +339,7 @@ struct FunctionPointers {
|
||||
L1_CreateOldUsageEntry_t CreateOldUsageEntry;
|
||||
L1_GetAnalogOutputFlags_t GetAnalogOutputFlags;
|
||||
L1_BuildInformation_t BuildInformation;
|
||||
L1_ResourceRatingTier_t ResourceRatingTier;
|
||||
|
||||
L1_LoadKeys_V8_t LoadKeys_V8;
|
||||
L1_GenerateRSASignature_V8_t GenerateRSASignature_V8;
|
||||
@@ -695,6 +697,7 @@ class Adapter {
|
||||
LOOKUP_ALL(10, GetHDCPCapability, OEMCrypto_GetHDCPCapability);
|
||||
LOOKUP_ALL(14, GetAnalogOutputFlags, OEMCrypto_GetAnalogOutputFlags);
|
||||
LOOKUP_ALL(15, BuildInformation, OEMCrypto_BuildInformation);
|
||||
LOOKUP_ALL(15, ResourceRatingTier, OEMCrypto_ResourceRatingTier);
|
||||
LOOKUP_ALL( 8, GetKeyData, OEMCrypto_GetKeyData);
|
||||
LOOKUP_ALL(10, GetMaxNumberOfSessions, OEMCrypto_GetMaxNumberOfSessions);
|
||||
LOOKUP_ALL(10, GetNumberOfOpenSessions, OEMCrypto_GetNumberOfOpenSessions);
|
||||
@@ -840,6 +843,7 @@ class Adapter {
|
||||
level3_.GetHDCPCapability = Level3_GetHDCPCapability;
|
||||
level3_.GetAnalogOutputFlags = Level3_GetAnalogOutputFlags;
|
||||
// TODO(srujzs) level3_.BuildInformation = Level3_BuildInformation;
|
||||
// TODO(srujzs) level3_.ResourceRatingTier = Level3_ResourceRatingTier;
|
||||
level3_.SupportsUsageTable = Level3_SupportsUsageTable;
|
||||
level3_.IsAntiRollbackHwPresent = Level3_IsAntiRollbackHwPresent;
|
||||
level3_.GetNumberOfOpenSessions = Level3_GetNumberOfOpenSessions;
|
||||
@@ -1084,6 +1088,15 @@ const char* OEMCrypto_BuildInformation(SecurityLevel level) {
|
||||
return fcn->BuildInformation();
|
||||
}
|
||||
|
||||
uint32_t OEMCrypto_ResourceRatingTier(SecurityLevel level) {
|
||||
if (!gAdapter.get()) return 0;
|
||||
const FunctionPointers* fcn = gAdapter->GetFunctionPointers(level);
|
||||
if (!fcn) return 0;
|
||||
if (fcn->version < 14) return 0;
|
||||
if (fcn->ResourceRatingTier == NULL) return 0;
|
||||
return fcn->ResourceRatingTier();
|
||||
}
|
||||
|
||||
bool OEMCrypto_SupportsUsageTable(SecurityLevel level) {
|
||||
if (!gAdapter.get()) return false;
|
||||
const FunctionPointers* fcn = gAdapter->GetFunctionPointers(level);
|
||||
@@ -1249,10 +1262,14 @@ extern "C" uint32_t OEMCrypto_GetAnalogOutputFlags() {
|
||||
return OEMCrypto_GetAnalogOutputFlags(kLevelDefault);
|
||||
}
|
||||
|
||||
extern "C" const char* OEMCrypto_BuildInformation(){
|
||||
extern "C" const char* OEMCrypto_BuildInformation() {
|
||||
return OEMCrypto_BuildInformation(kLevelDefault);
|
||||
}
|
||||
|
||||
extern "C" uint32_t OEMCrypto_ResourceRatingTier() {
|
||||
return OEMCrypto_ResourceRatingTier(kLevelDefault);
|
||||
}
|
||||
|
||||
extern "C" OEMCryptoResult OEMCrypto_LoadKeys_Back_Compat(
|
||||
OEMCrypto_SESSION session, const uint8_t* message, size_t message_length,
|
||||
const uint8_t* signature, size_t signature_length,
|
||||
|
||||
Reference in New Issue
Block a user