Add OEMCrypto_IsAntiRollbackHwPresent API for OEMCrypto v10.
Merge from WV CDM repo: https://widevine-internal-review.googlesource.com/#/c/13660/. bug: 18948905 Change-Id: I1ffe72baaac9abf05c06139de790236e763f89a8
This commit is contained in:
@@ -33,4 +33,10 @@ bool CryptoEngine::supports_storage() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Returns false for mock library to indicate the client does not support
|
||||
// anti-rollback hardware.
|
||||
bool CryptoEngine::is_anti_rollback_hw_present() {
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace wvoec_mock
|
||||
|
||||
@@ -512,6 +512,13 @@ bool SessionContext::InstallKey(const KeyId& key_id,
|
||||
LOGE("Error parsing key control.");
|
||||
return false;
|
||||
}
|
||||
if ((key_control_block.control_bits() &
|
||||
kControlRequireAntiRollbackHardware) &&
|
||||
!ce_->is_anti_rollback_hw_present()) {
|
||||
LOGE("Anti-rollback hardware is required but hardware not present.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!CheckNonceOrEntry(key_control_block, pst)) {
|
||||
LOGE("Failed Nonce/PST check.");
|
||||
return false;
|
||||
|
||||
@@ -256,6 +256,7 @@ class CryptoEngine {
|
||||
bool local_display();
|
||||
bool closed_platform();
|
||||
bool supports_storage();
|
||||
bool is_anti_rollback_hw_present();
|
||||
|
||||
private:
|
||||
SessionContext* current_session_;
|
||||
|
||||
@@ -19,7 +19,8 @@ namespace wvoec_mock {
|
||||
|
||||
bool KeyControlBlock::Validate() {
|
||||
if ((FOURCC('k', 'c', 't', 'l') != verification_) && // original verification
|
||||
(FOURCC('k', 'c', '0', '9') != verification_)) { // add in version 9 api.
|
||||
(FOURCC('k', 'c', '0', '9') != verification_) && // add in version 9 api
|
||||
(FOURCC('k', 'c', '1', '0') != verification_)) { // add in version 10 api
|
||||
LOGE("KCB: BAD verification string: %08X (not %08X or %08X)", verification_,
|
||||
0x6b63746c, 0x6b633039);
|
||||
return false;
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace wvoec_mock {
|
||||
const uint32_t kControlObserveDataPath = (1<<31);
|
||||
const uint32_t kControlObserveHDCP = (1<<30);
|
||||
const uint32_t kControlObserveCGMS = (1<<29);
|
||||
const uint32_t kControlRequireAntiRollbackHardware = (1<<28);
|
||||
const uint32_t kControlReplayMask = (0x03<<13);
|
||||
const uint32_t kControlNonceRequired = (0x01<<13);
|
||||
const uint32_t kControlNonceOrEntry = (0x02<<13);
|
||||
|
||||
@@ -996,7 +996,7 @@ OEMCryptoResult OEMCrypto_DeriveKeysFromSessionKey(
|
||||
|
||||
extern "C"
|
||||
uint32_t OEMCrypto_APIVersion() {
|
||||
return 9;
|
||||
return 10;
|
||||
}
|
||||
|
||||
extern "C"
|
||||
@@ -1049,6 +1049,17 @@ OEMCryptoResult OEMCrypto_GetMaxNumberOfSessions(size_t* maximum) {
|
||||
return OEMCrypto_SUCCESS;
|
||||
}
|
||||
|
||||
extern "C"
|
||||
bool OEMCrypto_IsAntiRollbackHwPresent() {
|
||||
bool anti_rollback_hw_present = crypto_engine->is_anti_rollback_hw_present();
|
||||
|
||||
if (LogCategoryEnabled(kLoggingTraceOEMCryptoCalls)) {
|
||||
LOGI("-- bool OEMCrypto_IsAntiRollbackHwPresent(): %d\n",
|
||||
anti_rollback_hw_present);
|
||||
}
|
||||
return anti_rollback_hw_present;
|
||||
}
|
||||
|
||||
extern "C"
|
||||
OEMCryptoResult OEMCrypto_Generic_Encrypt(OEMCrypto_SESSION session,
|
||||
const uint8_t* in_buffer,
|
||||
|
||||
Reference in New Issue
Block a user