fscrypt: change to upgrade key if export fails

Importing this commit:
https://github.com/mauronofrio/android_bootable_recovery/commit/f999d65b23f0cd36ee85995ac1601d1b2ab690e5

Change-Id: If73dc534ddf6c8b96ce2789789f25ce432428aa5
This commit is contained in:
mauronofrio matarrese
2020-05-25 20:18:52 +02:00
committed by bigbiff
parent 17fb1210a9
commit bd79db4d6d
3 changed files with 27 additions and 9 deletions
+4 -4
View File
@@ -138,7 +138,7 @@ bool Keymaster::generateKey(const km::AuthorizationSet& inParams, std::string* k
return true;
}
bool Keymaster::exportKey(km::KeyFormat format, KeyBuffer& kmKey, const std::string& clientId,
km::ErrorCode Keymaster::exportKey(km::KeyFormat format, KeyBuffer& kmKey, const std::string& clientId,
const std::string& appData, std::string* key) {
auto kmKeyBlob = km::support::blob2hidlVec(std::string(kmKey.data(), kmKey.size()));
auto emptyAssign = NULL;
@@ -155,13 +155,13 @@ bool Keymaster::exportKey(km::KeyFormat format, KeyBuffer& kmKey, const std::str
auto error = mDevice->exportKey(format, kmKeyBlob, kmClientId, kmAppData, hidlCb);
if (!error.isOk()) {
LOG(ERROR) << "export_key failed: " << error.description();
return false;
return km::ErrorCode::UNKNOWN_ERROR;
}
if (km_error != km::ErrorCode::OK) {
LOG(ERROR) << "export_key failed, code " << int32_t(km_error);
return false;
return km_error;
}
return true;
return km::ErrorCode::OK;
}
bool Keymaster::deleteKey(const std::string& key) {