Merge "Fix backwards compatibility"
This commit is contained in:
committed by
Android (Google) Code Review
commit
3bad5757d7
@@ -186,8 +186,8 @@ bool DeviceFeatures::IsTestKeyboxInstalled() {
|
||||
size_t key_data_len = sizeof(key_data);
|
||||
if (OEMCrypto_GetKeyData(key_data, &key_data_len) != OEMCrypto_SUCCESS)
|
||||
return false;
|
||||
if (key_data_len != sizeof(kTestKeybox.data_)) return false;
|
||||
if (memcmp(key_data, kTestKeybox.data_, key_data_len)) return false;
|
||||
if (key_data_len != sizeof(kValidKeybox01.data_)) return false;
|
||||
if (memcmp(key_data, kValidKeybox01.data_, key_data_len)) return false;
|
||||
uint8_t dev_id[128] = {0};
|
||||
size_t dev_id_len = 128;
|
||||
if (OEMCrypto_GetDeviceID(dev_id, &dev_id_len) != OEMCrypto_SUCCESS)
|
||||
@@ -195,8 +195,8 @@ bool DeviceFeatures::IsTestKeyboxInstalled() {
|
||||
// We use strncmp instead of memcmp because we don't really care about the
|
||||
// multiple '\0' characters at the end of the device id.
|
||||
return 0 == strncmp(reinterpret_cast<const char*>(dev_id),
|
||||
reinterpret_cast<const char*>(kTestKeybox.device_id_),
|
||||
sizeof(kTestKeybox.device_id_));
|
||||
reinterpret_cast<const char*>(kValidKeybox01.device_id_),
|
||||
sizeof(kValidKeybox01.device_id_));
|
||||
}
|
||||
|
||||
void DeviceFeatures::FilterOut(std::string* current_filter,
|
||||
|
||||
@@ -104,10 +104,10 @@ void SessionUtil::EnsureTestKeys() {
|
||||
case DeviceFeatures::LOAD_TEST_KEYBOX:
|
||||
keybox_ = kTestKeybox;
|
||||
/* Note: If you are upgrading from an older version, it may be easier to
|
||||
* uncomment the following line. This uses the same test keybox as we
|
||||
* force the following condition. This uses the same test keybox as we
|
||||
* used in older versions of this test.
|
||||
*/
|
||||
// keybox_ = kValidKeybox01;
|
||||
if (global_features.api_version < 14) keybox_ = kValidKeybox01;
|
||||
ASSERT_EQ(OEMCrypto_SUCCESS,
|
||||
OEMCrypto_LoadTestKeybox(
|
||||
reinterpret_cast<const uint8_t*>(&keybox_),
|
||||
@@ -117,8 +117,8 @@ void SessionUtil::EnsureTestKeys() {
|
||||
ASSERT_EQ(OEMCrypto_SUCCESS, OEMCrypto_LoadTestRSAKey());
|
||||
break;
|
||||
case DeviceFeatures::EXISTING_TEST_KEYBOX:
|
||||
// already has test keybox.
|
||||
keybox_ = kTestKeybox;
|
||||
// already has old test keybox.
|
||||
keybox_ = kValidKeybox01;
|
||||
break;
|
||||
case DeviceFeatures::FORCE_TEST_KEYBOX:
|
||||
keybox_ = kTestKeybox;
|
||||
|
||||
@@ -828,7 +828,7 @@ TEST_F(OEMCryptoSessionTests, LoadKeyWithNoMAC) {
|
||||
ASSERT_EQ(expected_signature, signature);
|
||||
}
|
||||
|
||||
TEST_F(OEMCryptoSessionTests, LoadEntitlementKeys) {
|
||||
TEST_F(OEMCryptoSessionTests, LoadEntitlementKeysAPI14) {
|
||||
Session s;
|
||||
ASSERT_NO_FATAL_FAILURE(s.open());
|
||||
ASSERT_NO_FATAL_FAILURE(InstallTestSessionKeys(&s));
|
||||
@@ -841,7 +841,7 @@ TEST_F(OEMCryptoSessionTests, LoadEntitlementKeys) {
|
||||
ASSERT_NO_FATAL_FAILURE(s.LoadEntitledContentKeys());
|
||||
}
|
||||
|
||||
TEST_F(OEMCryptoSessionTests, LoadEntitlementKeysNoEntitlementKeys) {
|
||||
TEST_F(OEMCryptoSessionTests, LoadEntitlementKeysNoEntitlementKeysAPI14) {
|
||||
Session s;
|
||||
ASSERT_NO_FATAL_FAILURE(s.open());
|
||||
ASSERT_NO_FATAL_FAILURE(InstallTestSessionKeys(&s));
|
||||
|
||||
Reference in New Issue
Block a user