summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Nelissen <marcone@google.com>2021-02-03 01:12:57 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-02-03 01:12:57 +0000
commit212c6698338a9c4eec5e3757b3049efbb2d1a606 (patch)
tree98b0a5ca6c3d6feb8ce0a0a61f08e49fc09fb005
parent1f9f7fb7424eefd2bc406e22f863332e3ef9e573 (diff)
parent7b4c96aa13fbc1febba20dbe33d48163353ef928 (diff)
downloadgatekeeper-212c6698338a9c4eec5e3757b3049efbb2d1a606.tar.gz
Implement DeleteUser/DeleteAllUsers am: 8d7cafed36 am: cd38d34d68 am: 97825cde7b am: 7b4c96aa13
Original change: https://android-review.googlesource.com/c/platform/system/gatekeeper/+/1567641 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I7f64ab977899a7675bb2bb8652155161d16316e2
-rw-r--r--gatekeeper.cpp11
-rw-r--r--include/gatekeeper/gatekeeper.h14
2 files changed, 22 insertions, 3 deletions
diff --git a/gatekeeper.cpp b/gatekeeper.cpp
index 436ae81..57be100 100644
--- a/gatekeeper.cpp
+++ b/gatekeeper.cpp
@@ -163,13 +163,18 @@ void GateKeeper::Verify(const VerifyRequest &request, VerifyResponse *response)
}
}
-void GateKeeper::DeleteUser(const DeleteUserRequest &/*request*/, DeleteUserResponse *response) {
- response->error = ERROR_NOT_IMPLEMENTED;
+void GateKeeper::DeleteUser(const DeleteUserRequest &request, DeleteUserResponse *response) {
+ if (response == nullptr) return;
+
+ uint32_t uid = request.user_id;
+ response->error = RemoveUser(uid);
}
void GateKeeper::DeleteAllUsers(const DeleteAllUsersRequest &/*request*/,
DeleteAllUsersResponse *response) {
- response->error = ERROR_NOT_IMPLEMENTED;
+ if (response == nullptr) return;
+
+ response->error = RemoveAllUsers();
}
bool GateKeeper::CreatePasswordHandle(SizedBuffer *password_handle_buffer, salt_t salt,
diff --git a/include/gatekeeper/gatekeeper.h b/include/gatekeeper/gatekeeper.h
index 9f70d6f..62f0b34 100644
--- a/include/gatekeeper/gatekeeper.h
+++ b/include/gatekeeper/gatekeeper.h
@@ -117,6 +117,20 @@ protected:
virtual uint64_t GetMillisecondsSinceBoot() const = 0;
/**
+ * Removes all records for the given user.
+ *
+ * Returns true if the user's records were successfully deleted.
+ */
+ virtual gatekeeper_error_t RemoveUser(uint32_t /* uid */) { return ERROR_NOT_IMPLEMENTED; }
+
+ /**
+ * Removes all records.
+ *
+ * Returns true if the records were successfully deleted.
+ */
+ virtual gatekeeper_error_t RemoveAllUsers() { return ERROR_NOT_IMPLEMENTED; }
+
+ /**
* Returns the value of the current failure record for the user.
*
* The failure record should be written to hardware-backed secure storage, such as