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:
Edwin Wong
2015-03-17 13:51:20 -07:00
parent a8243b75fe
commit a7887f60fc
11 changed files with 64 additions and 9 deletions

View File

@@ -1054,8 +1054,10 @@ class Session {
sizeof(license_.keys[i].key_iv));
OEMCrypto_GetRandom(license_.keys[i].control_iv,
sizeof(license_.keys[i].control_iv));
if (control & (wvoec_mock::kControlHDCPVersionMask |
wvoec_mock::kControlReplayMask)) {
if (control & wvoec_mock::kControlRequireAntiRollbackHardware) {
memcpy(license_.keys[i].control.verification, "kc10", 4);
} else if (control & (wvoec_mock::kControlHDCPVersionMask |
wvoec_mock::kControlReplayMask)) {
memcpy(license_.keys[i].control.verification, "kc09", 4);
} else {
memcpy(license_.keys[i].control.verification, "kctl", 4);
@@ -1585,6 +1587,23 @@ class OEMCryptoClientTest : public ::testing::Test {
}
};
TEST_F(OEMCryptoClientTest, AntiRollbackHardwareRequired) {
Session s;
s.open();
s.GenerateDerivedKeys();
s.FillSimpleMessage(0, wvoec_mock::kControlRequireAntiRollbackHardware, 0);
s.EncryptAndSign();
OEMCryptoResult sts = OEMCrypto_LoadKeys(
s.session_id(), s.message_ptr(), sizeof(MessageData), &s.signature()[0],
s.signature().size(), s.encrypted_license().mac_key_iv,
s.encrypted_license().mac_keys, kNumKeys, s.key_array(), NULL, 0);
if (OEMCrypto_IsAntiRollbackHwPresent()) {
ASSERT_EQ(OEMCrypto_SUCCESS, sts);
} else {
ASSERT_EQ(OEMCrypto_ERROR_UNKNOWN_FAILURE, sts);
}
}
//
// Keybox Tests
// These two tests are first, becuase it might give an idea why other