summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndres Morales2015-04-10 23:03:07 -0500
committerAndres Morales2015-04-11 20:29:04 -0500
commitc828ae87768f3539cefadb7e485b877995918299 (patch)
treef9dc4f6a289ec1d684172ed419483cf5829cba53 /gatekeeperd/IGateKeeperService.cpp
parent851b57c1f81bd3572cf5908611ba029be934c706 (diff)
downloadplatform-system-core-c828ae87768f3539cefadb7e485b877995918299.tar.gz
platform-system-core-c828ae87768f3539cefadb7e485b877995918299.tar.xz
platform-system-core-c828ae87768f3539cefadb7e485b877995918299.zip
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 933b975de..b1e4811a9 100644
--- a/gatekeeperd/IGateKeeperService.cpp
+++ b/gatekeeperd/IGateKeeperService.cpp
@@ -68,7 +68,6 @@ status_t BnGateKeeperService::onTransact(
68 case VERIFY: { 68 case VERIFY: {
69 CHECK_INTERFACE(IGateKeeperService, data, reply); 69 CHECK_INTERFACE(IGateKeeperService, data, reply);
70 uint32_t uid = data.readInt32(); 70 uint32_t uid = data.readInt32();
71 uint64_t challenge = data.readInt64();
72 ssize_t currentPasswordHandleSize = data.readInt32(); 71 ssize_t currentPasswordHandleSize = data.readInt32();
73 const uint8_t *currentPasswordHandle = 72 const uint8_t *currentPasswordHandle =
74 static_cast<const uint8_t *>(data.readInplace(currentPasswordHandleSize)); 73 static_cast<const uint8_t *>(data.readInplace(currentPasswordHandleSize));
@@ -79,12 +78,43 @@ status_t BnGateKeeperService::onTransact(
79 static_cast<const uint8_t *>(data.readInplace(currentPasswordSize)); 78 static_cast<const uint8_t *>(data.readInplace(currentPasswordSize));
80 if (!currentPassword) currentPasswordSize = 0; 79 if (!currentPassword) currentPasswordSize = 0;
81 80
82 status_t ret = verify(uid, challenge, (uint8_t *) currentPasswordHandle, 81 status_t ret = verify(uid, (uint8_t *) currentPasswordHandle,
83 currentPasswordHandleSize, (uint8_t *) currentPassword, currentPasswordSize); 82 currentPasswordHandleSize, (uint8_t *) currentPassword, currentPasswordSize);
84 reply->writeNoException(); 83 reply->writeNoException();
85 reply->writeInt32(ret == NO_ERROR ? 1 : 0); 84 reply->writeInt32(ret == NO_ERROR ? 1 : 0);
86 return NO_ERROR; 85 return NO_ERROR;
87 } 86 }
87 case VERIFY_CHALLENGE: {
88 CHECK_INTERFACE(IGateKeeperService, data, reply);
89 uint32_t uid = data.readInt32();
90 uint64_t challenge = data.readInt64();
91 ssize_t currentPasswordHandleSize = data.readInt32();
92 const uint8_t *currentPasswordHandle =
93 static_cast<const uint8_t *>(data.readInplace(currentPasswordHandleSize));
94 if (!currentPasswordHandle) currentPasswordHandleSize = 0;
95
96 ssize_t currentPasswordSize = data.readInt32();
97 const uint8_t *currentPassword =
98 static_cast<const uint8_t *>(data.readInplace(currentPasswordSize));
99 if (!currentPassword) currentPasswordSize = 0;
100
101
102 uint8_t *out = NULL;
103 uint32_t outSize = 0;
104 status_t ret = verifyChallenge(uid, challenge, (uint8_t *) currentPasswordHandle,
105 currentPasswordHandleSize, (uint8_t *) currentPassword, currentPasswordSize,
106 &out, &outSize);
107 reply->writeNoException();
108 if (ret == NO_ERROR && outSize > 0 && out != NULL) {
109 reply->writeInt32(outSize);
110 void *buf = reply->writeInplace(outSize);
111 memcpy(buf, out, outSize);
112 free(out);
113 } else {
114 reply->writeInt32(-1);
115 }
116 return NO_ERROR;
117 }
88 default: 118 default:
89 return BBinder::onTransact(code, data, reply, flags); 119 return BBinder::onTransact(code, data, reply, flags);
90 } 120 }