summaryrefslogtreecommitdiffstats
path: root/gatekeeperd/IGateKeeperService.cpp
diff options
context:
space:
mode:
authorAndres Morales <anmorales@google.com>2015-04-10 21:03:07 -0700
committerAndres Morales <anmorales@google.com>2015-04-11 18:29:04 -0700
commitc828ae87768f3539cefadb7e485b877995918299 (patch)
treef9dc4f6a289ec1d684172ed419483cf5829cba53 /gatekeeperd/IGateKeeperService.cpp
parent851b57c1f81bd3572cf5908611ba029be934c706 (diff)
downloadsystem_core-c828ae87768f3539cefadb7e485b877995918299.zip
system_core-c828ae87768f3539cefadb7e485b877995918299.tar.gz
system_core-c828ae87768f3539cefadb7e485b877995918299.tar.bz2
Update verify API to return auth token blob
Change-Id: I853e61815458b54fb3b2f29e12a147b3b9aa3788
Diffstat (limited to 'gatekeeperd/IGateKeeperService.cpp')
-rw-r--r--gatekeeperd/IGateKeeperService.cpp34
1 files changed, 32 insertions, 2 deletions
diff --git a/gatekeeperd/IGateKeeperService.cpp b/gatekeeperd/IGateKeeperService.cpp
index 933b975..b1e4811 100644
--- a/gatekeeperd/IGateKeeperService.cpp
+++ b/gatekeeperd/IGateKeeperService.cpp
@@ -68,7 +68,6 @@ status_t BnGateKeeperService::onTransact(
case VERIFY: {
CHECK_INTERFACE(IGateKeeperService, data, reply);
uint32_t uid = data.readInt32();
- uint64_t challenge = data.readInt64();
ssize_t currentPasswordHandleSize = data.readInt32();
const uint8_t *currentPasswordHandle =
static_cast<const uint8_t *>(data.readInplace(currentPasswordHandleSize));
@@ -79,12 +78,43 @@ status_t BnGateKeeperService::onTransact(
static_cast<const uint8_t *>(data.readInplace(currentPasswordSize));
if (!currentPassword) currentPasswordSize = 0;
- status_t ret = verify(uid, challenge, (uint8_t *) currentPasswordHandle,
+ status_t ret = verify(uid, (uint8_t *) currentPasswordHandle,
currentPasswordHandleSize, (uint8_t *) currentPassword, currentPasswordSize);
reply->writeNoException();
reply->writeInt32(ret == NO_ERROR ? 1 : 0);
return NO_ERROR;
}
+ case VERIFY_CHALLENGE: {
+ CHECK_INTERFACE(IGateKeeperService, data, reply);
+ uint32_t uid = data.readInt32();
+ uint64_t challenge = data.readInt64();
+ ssize_t currentPasswordHandleSize = data.readInt32();
+ const uint8_t *currentPasswordHandle =
+ static_cast<const uint8_t *>(data.readInplace(currentPasswordHandleSize));
+ if (!currentPasswordHandle) currentPasswordHandleSize = 0;
+
+ ssize_t currentPasswordSize = data.readInt32();
+ const uint8_t *currentPassword =
+ static_cast<const uint8_t *>(data.readInplace(currentPasswordSize));
+ if (!currentPassword) currentPasswordSize = 0;
+
+
+ uint8_t *out = NULL;
+ uint32_t outSize = 0;
+ status_t ret = verifyChallenge(uid, challenge, (uint8_t *) currentPasswordHandle,
+ currentPasswordHandleSize, (uint8_t *) currentPassword, currentPasswordSize,
+ &out, &outSize);
+ reply->writeNoException();
+ if (ret == NO_ERROR && outSize > 0 && out != NULL) {
+ reply->writeInt32(outSize);
+ void *buf = reply->writeInplace(outSize);
+ memcpy(buf, out, outSize);
+ free(out);
+ } else {
+ reply->writeInt32(-1);
+ }
+ return NO_ERROR;
+ }
default:
return BBinder::onTransact(code, data, reply, flags);
}