Lines Matching refs:targetUid
68 uid_t targetUid = getEffectiveUid(uid);
69 if (!checkBinderPermission(P_GET, targetUid)) {
76 ResponseCode responseCode = mKeyStore->getKeyForName(&keyBlob, name8, targetUid, TYPE_GENERIC);
91 int targetUid, int32_t flags) {
92 targetUid = getEffectiveUid(targetUid);
94 checkBinderPermissionAndKeystoreState(P_INSERT, targetUid, flags & KEYSTORE_FLAG_ENCRYPTED);
100 String8 filename(mKeyStore->getKeyNameForUidWithDir(name8, targetUid, ::TYPE_GENERIC));
105 return mKeyStore->put(filename.string(), &keyBlob, get_user_id(targetUid));
108 int32_t KeyStoreService::del(const String16& name, int targetUid) {
109 targetUid = getEffectiveUid(targetUid);
110 if (!checkBinderPermission(P_DELETE, targetUid)) {
114 String8 filename(mKeyStore->getKeyNameForUidWithDir(name8, targetUid, ::TYPE_ANY));
115 int32_t result = mKeyStore->del(filename.string(), ::TYPE_ANY, get_user_id(targetUid));
122 name8, targetUid, ::TYPE_KEY_CHARACTERISTICS));
123 return mKeyStore->del(chrFilename.string(), ::TYPE_KEY_CHARACTERISTICS, get_user_id(targetUid));
126 int32_t KeyStoreService::exist(const String16& name, int targetUid) {
127 targetUid = getEffectiveUid(targetUid);
128 if (!checkBinderPermission(P_EXIST, targetUid)) {
133 String8 filename(mKeyStore->getKeyNameForUidWithDir(name8, targetUid, ::TYPE_ANY));
141 int32_t KeyStoreService::list(const String16& prefix, int targetUid, Vector<String16>* matches) {
142 targetUid = getEffectiveUid(targetUid);
143 if (!checkBinderPermission(P_LIST, targetUid)) {
147 String8 filename(mKeyStore->getKeyNameForUid(prefix8, targetUid, TYPE_ANY));
149 if (mKeyStore->list(filename, matches, get_user_id(targetUid)) != ::NO_ERROR) {
280 int32_t KeyStoreService::generate(const String16& name, int32_t targetUid, int32_t keyType,
282 targetUid = getEffectiveUid(targetUid);
284 checkBinderPermissionAndKeystoreState(P_INSERT, targetUid, flags & KEYSTORE_FLAG_ENCRYPTED);
345 int32_t rc = generateKey(name, params, NULL, 0, targetUid, flags,
354 int targetUid, int32_t flags) {
379 int32_t rc = importKey(name, params, KM_KEY_FORMAT_PKCS8, data, length, targetUid, flags,
464 uid_t targetUid = getEffectiveUid(uid);
465 if (!checkBinderPermission(P_GET, targetUid)) {
466 ALOGW("permission denied for %d: getmtime", targetUid);
471 String8 filename(mKeyStore->getKeyNameForUidWithDir(name8, targetUid, ::TYPE_ANY));
562 uid_t targetUid = getEffectiveUid(targetUid64);
563 if (!checkBinderPermissionSelfOrSystem(P_CLEAR_UID, targetUid)) {
567 String8 prefix = String8::format("%u_", targetUid);
569 if (mKeyStore->list(prefix, &aliases, get_user_id(targetUid)) != ::NO_ERROR) {
575 String8 filename(mKeyStore->getKeyNameForUidWithDir(name8, targetUid, ::TYPE_ANY));
576 mKeyStore->del(filename.string(), ::TYPE_ANY, get_user_id(targetUid));
579 String8 chr_filename(mKeyStore->getKeyNameForUidWithDir(name8, targetUid,
581 mKeyStore->del(chr_filename.string(), ::TYPE_KEY_CHARACTERISTICS, get_user_id(targetUid));
716 uid_t targetUid = getEffectiveUid(uid);
718 if (!is_granted_to(callingUid, targetUid)) {
720 targetUid);
729 mKeyStore->getKeyForName(&keyBlob, name8, targetUid, TYPE_KEYMASTER_10);
749 rc = upgradeKeyBlob(name, targetUid, upgradeParams, &keyBlob);
849 uid_t targetUid = getEffectiveUid(uid);
851 if (!is_granted_to(callingUid, targetUid)) {
852 ALOGW("uid %d not permitted to act for uid %d in exportKey", callingUid, targetUid);
862 mKeyStore->getKeyForName(&keyBlob, name8, targetUid, TYPE_KEYMASTER_10);
887 uid_t targetUid = getEffectiveUid(uid);
888 if (!is_granted_to(callingUid, targetUid)) {
889 ALOGW("uid %d not permitted to act for uid %d in begin", callingUid, targetUid);
905 mKeyStore->getKeyForName(&keyBlob, name8, targetUid, TYPE_KEYMASTER_10);
921 int32_t rc = upgradeKeyBlob(name, targetUid,
939 responseCode = mKeyStore->getKeyForName(&charBlob, name8, targetUid, TYPE_KEY_CHARACTERISTICS);
1277 uid_t KeyStoreService::getEffectiveUid(int32_t targetUid) {
1278 if (targetUid == UID_SELF) {
1281 return static_cast<uid_t>(targetUid);
1288 bool KeyStoreService::checkBinderPermission(perm_t permission, int32_t targetUid) {
1295 if (!is_granted_to(callingUid, getEffectiveUid(targetUid))) {
1296 ALOGW("uid %d not granted to act for %d", callingUid, targetUid);
1306 bool KeyStoreService::checkBinderPermissionSelfOrSystem(perm_t permission, int32_t targetUid) {
1313 return getEffectiveUid(targetUid) == callingUid || callingUid == AID_SYSTEM;
1323 bool KeyStoreService::checkBinderPermissionOrSelfTarget(perm_t permission, int32_t targetUid) {
1325 if (getEffectiveUid(targetUid) == callingUid) {
1328 return checkBinderPermission(permission, targetUid);
1340 int32_t KeyStoreService::checkBinderPermissionAndKeystoreState(perm_t permission, int32_t targetUid,
1342 if (!checkBinderPermission(permission, targetUid)) {
1345 State state = mKeyStore->getState(get_user_id(getEffectiveUid(targetUid)));