summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndres Morales2015-06-24 20:40:24 -0500
committerAndres Morales2015-06-24 20:40:24 -0500
commit7f6dcf657680aaf51dcd5d41c32c89254779b2a8 (patch)
treeb3611b82aee760c3618d830858eddba46335abe5 /gatekeeperd/gatekeeperd.cpp
parent3c2086dabdb87e027412bb4405279128a321e184 (diff)
downloadplatform-system-core-7f6dcf657680aaf51dcd5d41c32c89254779b2a8.tar.gz
platform-system-core-7f6dcf657680aaf51dcd5d41c32c89254779b2a8.tar.xz
platform-system-core-7f6dcf657680aaf51dcd5d41c32c89254779b2a8.zip
[gatekeeperd] fix issue with SW->HW upgrades
If the handle version is 0, there's no hardware_backed flag meaning hardware backed handles will be attempted against the soft impl. Ensure we don't try to read from hardware_backed unless the version is > 0. Bug: 21090356 Change-Id: I65f009c55538ea3c20eb486b580eb11ce93934fc
Diffstat (limited to 'gatekeeperd/gatekeeperd.cpp')
-rw-r--r--gatekeeperd/gatekeeperd.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/gatekeeperd/gatekeeperd.cpp b/gatekeeperd/gatekeeperd.cpp
index f4f2cbfc3..6622df979 100644
--- a/gatekeeperd/gatekeeperd.cpp
+++ b/gatekeeperd/gatekeeperd.cpp
@@ -144,7 +144,7 @@ public:
144 const gatekeeper::password_handle_t *handle = 144 const gatekeeper::password_handle_t *handle =
145 reinterpret_cast<const gatekeeper::password_handle_t *>(current_password_handle); 145 reinterpret_cast<const gatekeeper::password_handle_t *>(current_password_handle);
146 146
147 if (handle != NULL && !handle->hardware_backed) { 147 if (handle != NULL && handle->version != 0 && !handle->hardware_backed) {
148 // handle is being re-enrolled from a software version. HAL probably won't accept 148 // handle is being re-enrolled from a software version. HAL probably won't accept
149 // the handle as valid, so we nullify it and enroll from scratch 149 // the handle as valid, so we nullify it and enroll from scratch
150 current_password_handle = NULL; 150 current_password_handle = NULL;
@@ -209,7 +209,9 @@ public:
209 if (device) { 209 if (device) {
210 const gatekeeper::password_handle_t *handle = 210 const gatekeeper::password_handle_t *handle =
211 reinterpret_cast<const gatekeeper::password_handle_t *>(enrolled_password_handle); 211 reinterpret_cast<const gatekeeper::password_handle_t *>(enrolled_password_handle);
212 if (handle->hardware_backed) { 212 // handle version 0 does not have hardware backed flag, and thus cannot be upgraded to
213 // a HAL if there was none before
214 if (handle->version == 0 || handle->hardware_backed) {
213 ret = device->verify(device, uid, challenge, 215 ret = device->verify(device, uid, challenge,
214 enrolled_password_handle, enrolled_password_handle_length, 216 enrolled_password_handle, enrolled_password_handle_length,
215 provided_password, provided_password_length, auth_token, auth_token_length, 217 provided_password, provided_password_length, auth_token, auth_token_length,