am f9add545: am 62a9cf3c: Terminate Level 1 OEMCrypto on Initialization Error

* commit 'f9add54545bc4b8b875de41b9a111a273e1db9f4':
  Terminate Level 1 OEMCrypto on Initialization Error
This commit is contained in:
Fred Gylys-Colwell
2014-12-18 23:22:28 +00:00
committed by Android Git Automerger

View File

@@ -280,6 +280,7 @@ class Adapter {
if (level1_.version < minimum_version) {
LOGW("liboemcrypto.so is version %d, not %d. Falling Back to L3.",
level1_.version, minimum_version);
level1_.Terminate();
return false;
}
if( level1_.version == 8 ) {
@@ -303,11 +304,13 @@ class Adapter {
std::string filename;
if (!wvcdm::Properties::GetFactoryKeyboxPath(&filename)) {
LOGW("Bad Level 1 Keybox. Falling Back to L3.");
level1_.Terminate();
return false;
}
ssize_t size = file.FileSize(filename);
if (size <= 0 || !file.Open(filename, file.kBinary | file.kReadOnly)) {
LOGW("Could not open %s. Falling Back to L3.", filename.c_str());
level1_.Terminate();
return false;
}
uint8_t keybox[size];
@@ -315,6 +318,7 @@ class Adapter {
if (level1_.InstallKeybox(keybox, size) != OEMCrypto_SUCCESS) {
LOGE("Could NOT install keybox from %s. Falling Back to L3.",
filename.c_str());
level1_.Terminate();
return false;
}
LOGI("Installed keybox from %s", filename.c_str());