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
+25 -25
View File
@@ -56,17 +56,17 @@ bool KeymasterOperation::updateCompletely(const std::string& input, std::string*
auto inputBlob = blob2hidlVec(reinterpret_cast<const uint8_t*>(&*it), toRead);
auto error = mDevice->update(mOpHandle, hidl_vec<KeyParameter>(), inputBlob, hidlCB);
if (!error.isOk()) {
LOG(ERROR) << "update failed: " << error.description() << "\n";
LOG(ERROR) << "update failed: " << error.description();
mDevice = nullptr;
return false;
}
if (km_error != ErrorCode::OK) {
LOG(ERROR) << "update failed, code " << int32_t(km_error) << "\n";
LOG(ERROR) << "update failed, code " << int32_t(km_error);
mDevice = nullptr;
return false;
}
if (inputConsumed > toRead) {
LOG(ERROR) << "update reported too much input consumed\n";
LOG(ERROR) << "update reported too much input consumed";
mDevice = nullptr;
return false;
}
@@ -88,11 +88,11 @@ bool KeymasterOperation::finish(std::string* output) {
hidl_vec<uint8_t>(), hidlCb);
mDevice = nullptr;
if (!error.isOk()) {
LOG(ERROR) << "finish failed: " << error.description() << "\n";
LOG(ERROR) << "finish failed: " << error.description();
return false;
}
if (km_error != ErrorCode::OK) {
LOG(ERROR) << "finish failed, code " << int32_t(km_error) << "\n";
LOG(ERROR) << "finish failed, code " << int32_t(km_error);
return false;
}
return true;
@@ -114,27 +114,27 @@ Keymaster::Keymaster() {
auto error = mDevice->generateKey(inParams.hidl_data(), hidlCb);
if (!error.isOk()) {
LOG(ERROR) << "generate_key failed: " << error.description() << "\n";
LOG(ERROR) << "generate_key failed: " << error.description();
return false;
}
if (km_error != ErrorCode::OK) {
LOG(ERROR) << "generate_key failed, code " << int32_t(km_error) << "\n";
LOG(ERROR) << "generate_key failed, code " << int32_t(km_error);
return false;
}
return true;
}*/
bool Keymaster::deleteKey(const std::string& key) {
LOG(ERROR) << "NOT deleting key in TWRP\n";
LOG(ERROR) << "NOT deleting key in TWRP";
return false;
/*auto keyBlob = blob2hidlVec(key);
auto error = mDevice->deleteKey(keyBlob);
if (!error.isOk()) {
LOG(ERROR) << "delete_key failed: " << error.description() << "\n";
LOG(ERROR) << "delete_key failed: " << error.description();
return false;
}
if (ErrorCode(error) != ErrorCode::OK) {
LOG(ERROR) << "delete_key failed, code " << uint32_t(ErrorCode(error)) << "\n";
LOG(ERROR) << "delete_key failed, code " << uint32_t(ErrorCode(error));
return false;
}
return true;*/
@@ -153,11 +153,11 @@ bool Keymaster::upgradeKey(const std::string& oldKey, const AuthorizationSet& in
};
auto error = mDevice->upgradeKey(oldKeyBlob, inParams.hidl_data(), hidlCb);
if (!error.isOk()) {
LOG(ERROR) << "upgrade_key failed: " << error.description() << "\n";
LOG(ERROR) << "upgrade_key failed: " << error.description();
return false;
}
if (km_error != ErrorCode::OK) {
LOG(ERROR) << "upgrade_key failed, code " << int32_t(km_error) << "\n";
LOG(ERROR) << "upgrade_key failed, code " << int32_t(km_error);
return false;
}
return true;
@@ -181,11 +181,11 @@ KeymasterOperation Keymaster::begin(KeyPurpose purpose, const std::string& key,
auto error = mDevice->begin(purpose, keyBlob, inParams.hidl_data(), hidlCb);
if (!error.isOk()) {
LOG(ERROR) << "begin failed: " << error.description() << "\n";
LOG(ERROR) << "begin failed: " << error.description();
return KeymasterOperation(ErrorCode::UNKNOWN_ERROR);
}
if (km_error != ErrorCode::OK) {
LOG(ERROR) << "begin failed, code " << int32_t(km_error) << "\n";
LOG(ERROR) << "begin failed, code " << int32_t(km_error);
return KeymasterOperation(km_error);
}
return KeymasterOperation(mDevice, mOpHandle);
@@ -207,7 +207,7 @@ using namespace ::android::vold;
int keymaster_compatibility_cryptfs_scrypt() {
Keymaster dev;
if (!dev) {
LOG(ERROR) << "Failed to initiate keymaster session\n";
LOG(ERROR) << "Failed to initiate keymaster session";
return -1;
}
return dev.isSecure();
@@ -224,11 +224,11 @@ int keymaster_compatibility_cryptfs_scrypt() {
Keymaster dev;
std::string key;
if (!dev) {
LOG(ERROR) << "Failed to initiate keymaster session\n";
LOG(ERROR) << "Failed to initiate keymaster session";
return -1;
}
if (!key_buffer || !key_out_size) {
LOG(ERROR) << __FILE__ << ":" << __LINE__ << ":Invalid argument\n";
LOG(ERROR) << __FILE__ << ":" << __LINE__ << ":Invalid argument";
return -1;
}
if (key_out_size) {
@@ -276,11 +276,11 @@ int keymaster_sign_object_for_cryptfs_scrypt(const uint8_t* key_blob,
{
Keymaster dev;
if (!dev) {
LOG(ERROR) << "Failed to initiate keymaster session\n";
LOG(ERROR) << "Failed to initiate keymaster session";
return -1;
}
if (!key_blob || !object || !signature_buffer || !signature_buffer_size) {
LOG(ERROR) << __FILE__ << ":" << __LINE__ << ":Invalid argument\n";
LOG(ERROR) << __FILE__ << ":" << __LINE__ << ":Invalid argument";
return -1;
}
@@ -303,7 +303,7 @@ int keymaster_sign_object_for_cryptfs_scrypt(const uint8_t* key_blob,
std::string newKey;
bool ret = dev.upgradeKey(key, paramBuilder, &newKey);
if(ret == false) {
LOG(ERROR) << "Error upgradeKey: \n";
LOG(ERROR) << "Error upgradeKey: ";
return -1;
}
@@ -312,7 +312,7 @@ int keymaster_sign_object_for_cryptfs_scrypt(const uint8_t* key_blob,
}
if (key_buffer_size < newKey.size()) {
LOG(ERROR) << "key buffer size is too small\n";
LOG(ERROR) << "key buffer size is too small";
return -1;
}
@@ -322,24 +322,24 @@ int keymaster_sign_object_for_cryptfs_scrypt(const uint8_t* key_blob,
}
if (op.errorCode() != ErrorCode::OK) {
LOG(ERROR) << "Error starting keymaster signature transaction: " << int32_t(op.errorCode()) << "\n";
LOG(ERROR) << "Error starting keymaster signature transaction: " << int32_t(op.errorCode());
return -1;
}
if (!op.updateCompletely(input, &output)) {
LOG(ERROR) << "Error sending data to keymaster signature transaction: "
<< uint32_t(op.errorCode()) << "\n";
<< uint32_t(op.errorCode());
return -1;
}
if (!op.finish(&output)) {
LOG(ERROR) << "Error finalizing keymaster signature transaction: " << int32_t(op.errorCode()) << "\n";
LOG(ERROR) << "Error finalizing keymaster signature transaction: " << int32_t(op.errorCode());
return -1;
}
*signature_buffer = reinterpret_cast<uint8_t*>(malloc(output.size()));
if (*signature_buffer == nullptr) {
LOG(ERROR) << "Error allocation buffer for keymaster signature\n";
LOG(ERROR) << "Error allocation buffer for keymaster signature";
return -1;
}
*signature_buffer_size = output.size();