|
|
|
@@ -264,6 +264,7 @@ typedef OEMCryptoResult (*L1_CreateOldUsageEntry_t)(
|
|
|
|
uint8_t* server_mac_key, uint8_t* client_mac_key, const uint8_t* pst,
|
|
|
|
uint8_t* server_mac_key, uint8_t* client_mac_key, const uint8_t* pst,
|
|
|
|
size_t pst_length);
|
|
|
|
size_t pst_length);
|
|
|
|
typedef uint32_t (*L1_GetAnalogOutputFlags_t)(void);
|
|
|
|
typedef uint32_t (*L1_GetAnalogOutputFlags_t)(void);
|
|
|
|
|
|
|
|
typedef const char* (*L1_BuildInformation_t)(void);
|
|
|
|
|
|
|
|
|
|
|
|
struct FunctionPointers {
|
|
|
|
struct FunctionPointers {
|
|
|
|
uint32_t version;
|
|
|
|
uint32_t version;
|
|
|
|
@@ -330,6 +331,7 @@ struct FunctionPointers {
|
|
|
|
L1_CopyOldUsageEntry_t CopyOldUsageEntry;
|
|
|
|
L1_CopyOldUsageEntry_t CopyOldUsageEntry;
|
|
|
|
L1_CreateOldUsageEntry_t CreateOldUsageEntry;
|
|
|
|
L1_CreateOldUsageEntry_t CreateOldUsageEntry;
|
|
|
|
L1_GetAnalogOutputFlags_t GetAnalogOutputFlags;
|
|
|
|
L1_GetAnalogOutputFlags_t GetAnalogOutputFlags;
|
|
|
|
|
|
|
|
L1_BuildInformation_t BuildInformation;
|
|
|
|
|
|
|
|
|
|
|
|
L1_LoadKeys_V8_t LoadKeys_V8;
|
|
|
|
L1_LoadKeys_V8_t LoadKeys_V8;
|
|
|
|
L1_GenerateRSASignature_V8_t GenerateRSASignature_V8;
|
|
|
|
L1_GenerateRSASignature_V8_t GenerateRSASignature_V8;
|
|
|
|
@@ -567,6 +569,10 @@ class Adapter {
|
|
|
|
WatchDog *watcher = new WatchDog();
|
|
|
|
WatchDog *watcher = new WatchDog();
|
|
|
|
watcher->CheckForPreviousFailure(&metrics);
|
|
|
|
watcher->CheckForPreviousFailure(&metrics);
|
|
|
|
watcher->StartThread();
|
|
|
|
watcher->StartThread();
|
|
|
|
|
|
|
|
if (level3_.BuildInformation) {
|
|
|
|
|
|
|
|
LOGI("Level 3 Build Info (v%d): %s", level3_.version,
|
|
|
|
|
|
|
|
level3_.BuildInformation());
|
|
|
|
|
|
|
|
}
|
|
|
|
OEMCryptoResult result = watcher->WaitForStatusAndCleanUp();
|
|
|
|
OEMCryptoResult result = watcher->WaitForStatusAndCleanUp();
|
|
|
|
if (Level3_IsInApp()) {
|
|
|
|
if (Level3_IsInApp()) {
|
|
|
|
metrics.SetInitializationMode(
|
|
|
|
metrics.SetInitializationMode(
|
|
|
|
@@ -599,6 +605,10 @@ class Adapter {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (LoadLevel1(&metrics)) {
|
|
|
|
if (LoadLevel1(&metrics)) {
|
|
|
|
LOGD("OEMCrypto_Initialize Level 1 success. I will use level 1.");
|
|
|
|
LOGD("OEMCrypto_Initialize Level 1 success. I will use level 1.");
|
|
|
|
|
|
|
|
if (level1_.BuildInformation) {
|
|
|
|
|
|
|
|
LOGI("Level 1 Build Info (v%d): %s", level1_.version,
|
|
|
|
|
|
|
|
level1_.BuildInformation());
|
|
|
|
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
level1_ = FunctionPointers(); // revert to all null pointers.
|
|
|
|
level1_ = FunctionPointers(); // revert to all null pointers.
|
|
|
|
level1_valid_ = false;
|
|
|
|
level1_valid_ = false;
|
|
|
|
@@ -677,6 +687,7 @@ class Adapter {
|
|
|
|
LOOKUP( 9, 9, GetHDCPCapability_V9, OEMCrypto_GetHDCPCapability_V9);
|
|
|
|
LOOKUP( 9, 9, GetHDCPCapability_V9, OEMCrypto_GetHDCPCapability_V9);
|
|
|
|
LOOKUP_ALL(10, GetHDCPCapability, OEMCrypto_GetHDCPCapability);
|
|
|
|
LOOKUP_ALL(10, GetHDCPCapability, OEMCrypto_GetHDCPCapability);
|
|
|
|
LOOKUP_ALL(14, GetAnalogOutputFlags, OEMCrypto_GetAnalogOutputFlags);
|
|
|
|
LOOKUP_ALL(14, GetAnalogOutputFlags, OEMCrypto_GetAnalogOutputFlags);
|
|
|
|
|
|
|
|
LOOKUP_ALL(15, BuildInformation, OEMCrypto_BuildInformation);
|
|
|
|
LOOKUP_ALL( 8, GetKeyData, OEMCrypto_GetKeyData);
|
|
|
|
LOOKUP_ALL( 8, GetKeyData, OEMCrypto_GetKeyData);
|
|
|
|
LOOKUP_ALL(10, GetMaxNumberOfSessions, OEMCrypto_GetMaxNumberOfSessions);
|
|
|
|
LOOKUP_ALL(10, GetMaxNumberOfSessions, OEMCrypto_GetMaxNumberOfSessions);
|
|
|
|
LOOKUP_ALL(10, GetNumberOfOpenSessions, OEMCrypto_GetNumberOfOpenSessions);
|
|
|
|
LOOKUP_ALL(10, GetNumberOfOpenSessions, OEMCrypto_GetNumberOfOpenSessions);
|
|
|
|
@@ -820,6 +831,7 @@ class Adapter {
|
|
|
|
level3_.SecurityLevel = Level3_SecurityLevel;
|
|
|
|
level3_.SecurityLevel = Level3_SecurityLevel;
|
|
|
|
level3_.GetHDCPCapability = Level3_GetHDCPCapability;
|
|
|
|
level3_.GetHDCPCapability = Level3_GetHDCPCapability;
|
|
|
|
level3_.GetAnalogOutputFlags = Level3_GetAnalogOutputFlags;
|
|
|
|
level3_.GetAnalogOutputFlags = Level3_GetAnalogOutputFlags;
|
|
|
|
|
|
|
|
// TODO(srujzs) level3_.BuildInformation = Level3_BuildInformation;
|
|
|
|
level3_.SupportsUsageTable = Level3_SupportsUsageTable;
|
|
|
|
level3_.SupportsUsageTable = Level3_SupportsUsageTable;
|
|
|
|
level3_.IsAntiRollbackHwPresent = Level3_IsAntiRollbackHwPresent;
|
|
|
|
level3_.IsAntiRollbackHwPresent = Level3_IsAntiRollbackHwPresent;
|
|
|
|
level3_.GetNumberOfOpenSessions = Level3_GetNumberOfOpenSessions;
|
|
|
|
level3_.GetNumberOfOpenSessions = Level3_GetNumberOfOpenSessions;
|
|
|
|
@@ -1066,6 +1078,15 @@ uint32_t OEMCrypto_GetAnalogOutputFlags(SecurityLevel level) {
|
|
|
|
return fcn->GetAnalogOutputFlags();
|
|
|
|
return fcn->GetAnalogOutputFlags();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const char* OEMCrypto_BuildInformation(SecurityLevel level) {
|
|
|
|
|
|
|
|
if (!gAdapter.get()) return "<not initialized>";
|
|
|
|
|
|
|
|
const FunctionPointers* fcn = gAdapter->GetFunctionPointers(level);
|
|
|
|
|
|
|
|
if (!fcn) return "<not initialized>";
|
|
|
|
|
|
|
|
if (fcn->version < 14) return "pre v15";
|
|
|
|
|
|
|
|
if (fcn->BuildInformation == NULL) return "unknown";
|
|
|
|
|
|
|
|
return fcn->BuildInformation();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool OEMCrypto_SupportsUsageTable(SecurityLevel level) {
|
|
|
|
bool OEMCrypto_SupportsUsageTable(SecurityLevel level) {
|
|
|
|
if (!gAdapter.get()) return false;
|
|
|
|
if (!gAdapter.get()) return false;
|
|
|
|
const FunctionPointers* fcn = gAdapter->GetFunctionPointers(level);
|
|
|
|
const FunctionPointers* fcn = gAdapter->GetFunctionPointers(level);
|
|
|
|
@@ -1231,6 +1252,10 @@ extern "C" uint32_t OEMCrypto_GetAnalogOutputFlags() {
|
|
|
|
return OEMCrypto_GetAnalogOutputFlags(kLevelDefault);
|
|
|
|
return OEMCrypto_GetAnalogOutputFlags(kLevelDefault);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" const char* OEMCrypto_BuildInformation(){
|
|
|
|
|
|
|
|
return OEMCrypto_BuildInformation(kLevelDefault);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" OEMCryptoResult OEMCrypto_LoadKeys_Back_Compat(
|
|
|
|
extern "C" OEMCryptoResult OEMCrypto_LoadKeys_Back_Compat(
|
|
|
|
OEMCrypto_SESSION session, const uint8_t* message, size_t message_length,
|
|
|
|
OEMCrypto_SESSION session, const uint8_t* message, size_t message_length,
|
|
|
|
const uint8_t* signature, size_t signature_length,
|
|
|
|
const uint8_t* signature, size_t signature_length,
|
|
|
|
|