AOSP10 TWRP Merge: fix conflicts and update libraries needed

This allows flame to boot TWRP. Still will need to work on
super partition for vendor and system access.

The plan will be to cherry-pick any updates to android-9.0
through gerrit.twrp.me to this branch as a WIP.
This commit is contained in:
bigbiff
2020-03-23 10:02:29 -04:00
parent 26d5d5f0b9
commit d58ba18272
132 changed files with 3361 additions and 3309 deletions
+12 -12
View File
@@ -130,14 +130,14 @@ bool KeymasterOperation::updateCompletely(const std::string& input, std::string*
auto error =
mDevice->update(mOpHandle, nullptr, &inputBlob, &inputConsumed, nullptr, &outputBlob);
if (error != KM_ERROR_OK) {
LOG(ERROR) << "update failed, code " << error << "\n";
LOG(ERROR) << "update failed, code " << error;
mDevice = nullptr;
return false;
}
output->append(reinterpret_cast<const char*>(outputBlob.data), outputBlob.data_length);
free(const_cast<uint8_t*>(outputBlob.data));
if (inputConsumed > toRead) {
LOG(ERROR) << "update reported too much input consumed\n";
LOG(ERROR) << "update reported too much input consumed";
mDevice = nullptr;
return false;
}
@@ -150,7 +150,7 @@ bool KeymasterOperation::finish() {
auto error = mDevice->finish(mOpHandle, nullptr, nullptr, nullptr, nullptr);
mDevice = nullptr;
if (error != KM_ERROR_OK) {
LOG(ERROR) << "finish failed, code " << error << "\n";
LOG(ERROR) << "finish failed, code " << error;
return false;
}
return true;
@@ -161,7 +161,7 @@ bool KeymasterOperation::finishWithOutput(std::string* output) {
auto error = mDevice->finish(mOpHandle, nullptr, nullptr, nullptr, &outputBlob);
mDevice = nullptr;
if (error != KM_ERROR_OK) {
LOG(ERROR) << "finish failed, code " << error << "\n";
LOG(ERROR) << "finish failed, code " << error;
return false;
}
output->assign(reinterpret_cast<const char*>(outputBlob.data), outputBlob.data_length);
@@ -174,14 +174,14 @@ Keymaster::Keymaster() {
const hw_module_t* module;
int ret = hw_get_module_by_class(KEYSTORE_HARDWARE_MODULE_ID, NULL, &module);
if (ret != 0) {
LOG(ERROR) << "hw_get_module_by_class returned " << ret << "\n";
LOG(ERROR) << "hw_get_module_by_class returned " << ret;
return;
}
if (module->module_api_version == KEYMASTER_MODULE_API_VERSION_1_0) {
keymaster1_device_t* device;
ret = keymaster1_open(module, &device);
if (ret != 0) {
LOG(ERROR) << "keymaster1_open returned " << ret << "\n";
LOG(ERROR) << "keymaster1_open returned " << ret;
return;
}
mDevice = std::make_shared<Keymaster1Device>(device);
@@ -189,12 +189,12 @@ Keymaster::Keymaster() {
keymaster2_device_t* device;
ret = keymaster2_open(module, &device);
if (ret != 0) {
LOG(ERROR) << "keymaster2_open returned " << ret << "\n";
LOG(ERROR) << "keymaster2_open returned " << ret;
return;
}
mDevice = std::make_shared<Keymaster2Device>(device);
} else {
LOG(ERROR) << "module_api_version is " << module->module_api_version << "\n";
LOG(ERROR) << "module_api_version is " << module->module_api_version;
return;
}
}
@@ -203,7 +203,7 @@ Keymaster::Keymaster() {
keymaster_key_blob_t keyBlob;
auto error = mDevice->generate_key(&inParams, &keyBlob);
if (error != KM_ERROR_OK) {
LOG(ERROR) << "generate_key failed, code " << error << "\n";
LOG(ERROR) << "generate_key failed, code " << error;
return false;
}
key->assign(reinterpret_cast<const char*>(keyBlob.key_material), keyBlob.key_material_size);
@@ -215,7 +215,7 @@ bool Keymaster::deleteKey(const std::string& key) {
keymaster_key_blob_t keyBlob{reinterpret_cast<const uint8_t*>(key.data()), key.size()};
auto error = mDevice->delete_key(&keyBlob);
if (error != KM_ERROR_OK) {
LOG(ERROR) << "delete_key failed, code " << error << "\n";
LOG(ERROR) << "delete_key failed, code " << error;
return false;
}
return true;
@@ -229,7 +229,7 @@ KeymasterOperation Keymaster::begin(keymaster_purpose_t purpose, const std::stri
keymaster_key_param_set_t outParams_set;
auto error = mDevice->begin(purpose, &keyBlob, &inParams, &outParams_set, &mOpHandle);
if (error != KM_ERROR_OK) {
LOG(ERROR) << "begin failed, code " << error << "\n";
LOG(ERROR) << "begin failed, code " << error;
return KeymasterOperation(nullptr, mOpHandle);
}
outParams->Clear();
@@ -244,7 +244,7 @@ KeymasterOperation Keymaster::begin(keymaster_purpose_t purpose, const std::stri
keymaster_operation_handle_t mOpHandle;
auto error = mDevice->begin(purpose, &keyBlob, &inParams, nullptr, &mOpHandle);
if (error != KM_ERROR_OK) {
LOG(ERROR) << "begin failed, code " << error << "\n";
LOG(ERROR) << "begin failed, code " << error;
return KeymasterOperation(nullptr, mOpHandle);
}
return KeymasterOperation(mDevice, mOpHandle);