diff options
| author | Smita Ghosh <smitag@codeaurora.org> | 2019-01-11 10:38:09 -0800 |
|---|---|---|
| committer | doc HD <doc.divxm@gmail.com> | 2020-01-03 00:51:58 +0300 |
| commit | 547cda6e4590cda9039abfeaabae86ca249fdfd4 (patch) | |
| tree | c8294051519d44ea168084487f019661b87a0c19 /Keymaster.cpp | |
| parent | 00fd605456c5720d209c4316cf8d0cad7d0fbd5d (diff) | |
vold: change to upgrade key if export fails
Add support to upgrade key when export fails
with KEY_REQUIRES_UPGRADE.
CRs-Fixed: 2365225
Change-Id: I6b886929bd549920e42624261a63510a4b6a1ceb
Diffstat (limited to 'Keymaster.cpp')
| -rw-r--r-- | Keymaster.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Keymaster.cpp b/Keymaster.cpp index ab39ef8..706181d 100644 --- a/Keymaster.cpp +++ b/Keymaster.cpp @@ -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) { |
