diff options
| author | Branden Archer <brarcher@google.com> | 2018-11-21 14:58:01 -0800 |
|---|---|---|
| committer | Branden Archer <brarcher@google.com> | 2019-02-22 09:21:37 -0800 |
| commit | cb77797d66523188e0b9929274b290c0c8db3083 (patch) | |
| tree | 98460b6898b804e4271669dfad4f6814e70b73cf | |
| parent | b7ff91bc0018848aa310bde61728264fe28c0274 (diff) | |
Fix KeyStoreClientImpl::doesKeyExist to return correct result
The KeyStoreService returns NO_ERROR if the key was found,
and another response code otherwise. All of these are
mapped to non-zero values. As a result, if a key's
existence was queried it would always respond "true",
regardless if it exists or not or if there was a permissions
error.
Bug: 117993149
Test: Manual test forthcoming
Change-Id: Ib3488c6b125304fa300029e78a218f86f33d4412
Merged-In: Iffc2e155a61354f1fbffbece093b19e5cbc537fd
| -rw-r--r-- | keystore/keystore_client_impl.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/keystore/keystore_client_impl.cpp b/keystore/keystore_client_impl.cpp index 6d998ad..994e3f2 100644 --- a/keystore/keystore_client_impl.cpp +++ b/keystore/keystore_client_impl.cpp @@ -366,7 +366,7 @@ bool KeystoreClientImpl::doesKeyExist(const std::string& key_name) { int32_t result; auto binder_result = keystore_->exist(key_name16, kDefaultUID, &result); if (!binder_result.isOk()) return false; // binder error - return result; + return result == static_cast<int32_t>(ResponseCode::NO_ERROR); } bool KeystoreClientImpl::listKeys(const std::string& prefix, |
