Lines Matching refs:targetUid
68 uid_t targetUid = getEffectiveUid(uid); in get() local
69 if (!checkBinderPermission(P_GET, targetUid)) { in get()
76 ResponseCode responseCode = mKeyStore->getKeyForName(&keyBlob, name8, targetUid, TYPE_GENERIC); in get()
91 int targetUid, int32_t flags) { in insert() argument
92 targetUid = getEffectiveUid(targetUid); in insert()
94 checkBinderPermissionAndKeystoreState(P_INSERT, targetUid, flags & KEYSTORE_FLAG_ENCRYPTED); in insert()
100 String8 filename(mKeyStore->getKeyNameForUidWithDir(name8, targetUid)); in insert()
105 return mKeyStore->put(filename.string(), &keyBlob, get_user_id(targetUid)); in insert()
108 int32_t KeyStoreService::del(const String16& name, int targetUid) { in del() argument
109 targetUid = getEffectiveUid(targetUid); in del()
110 if (!checkBinderPermission(P_DELETE, targetUid)) { in del()
114 String8 filename(mKeyStore->getKeyNameForUidWithDir(name8, targetUid)); in del()
115 return mKeyStore->del(filename.string(), ::TYPE_ANY, get_user_id(targetUid)); in del()
118 int32_t KeyStoreService::exist(const String16& name, int targetUid) { in exist() argument
119 targetUid = getEffectiveUid(targetUid); in exist()
120 if (!checkBinderPermission(P_EXIST, targetUid)) { in exist()
125 String8 filename(mKeyStore->getKeyNameForUidWithDir(name8, targetUid)); in exist()
133 int32_t KeyStoreService::list(const String16& prefix, int targetUid, Vector<String16>* matches) { in list() argument
134 targetUid = getEffectiveUid(targetUid); in list()
135 if (!checkBinderPermission(P_LIST, targetUid)) { in list()
139 String8 filename(mKeyStore->getKeyNameForUid(prefix8, targetUid)); in list()
141 if (mKeyStore->list(filename, matches, get_user_id(targetUid)) != ::NO_ERROR) { in list()
272 int32_t KeyStoreService::generate(const String16& name, int32_t targetUid, int32_t keyType, in generate() argument
274 targetUid = getEffectiveUid(targetUid); in generate()
276 checkBinderPermissionAndKeystoreState(P_INSERT, targetUid, flags & KEYSTORE_FLAG_ENCRYPTED); in generate()
337 int32_t rc = generateKey(name, params, NULL, 0, targetUid, flags, in generate()
346 int targetUid, int32_t flags) { in import() argument
371 int32_t rc = importKey(name, params, KM_KEY_FORMAT_PKCS8, data, length, targetUid, flags, in import()
456 uid_t targetUid = getEffectiveUid(uid); in getmtime() local
457 if (!checkBinderPermission(P_GET, targetUid)) { in getmtime()
458 ALOGW("permission denied for %d: getmtime", targetUid); in getmtime()
463 String8 filename(mKeyStore->getKeyNameForUidWithDir(name8, targetUid)); in getmtime()
553 uid_t targetUid = getEffectiveUid(targetUid64); in clear_uid() local
554 if (!checkBinderPermissionSelfOrSystem(P_CLEAR_UID, targetUid)) { in clear_uid()
558 String8 prefix = String8::format("%u_", targetUid); in clear_uid()
560 if (mKeyStore->list(prefix, &aliases, get_user_id(targetUid)) != ::NO_ERROR) { in clear_uid()
566 String8 filename(mKeyStore->getKeyNameForUidWithDir(name8, targetUid)); in clear_uid()
567 mKeyStore->del(filename.string(), ::TYPE_ANY, get_user_id(targetUid)); in clear_uid()
675 uid_t targetUid = getEffectiveUid(uid); in getKeyCharacteristics() local
677 if (!is_granted_to(callingUid, targetUid)) { in getKeyCharacteristics()
679 targetUid); in getKeyCharacteristics()
688 mKeyStore->getKeyForName(&keyBlob, name8, targetUid, TYPE_KEYMASTER_10); in getKeyCharacteristics()
708 rc = upgradeKeyBlob(name, targetUid, upgradeParams, &keyBlob); in getKeyCharacteristics()
781 uid_t targetUid = getEffectiveUid(uid); in exportKey() local
783 if (!is_granted_to(callingUid, targetUid)) { in exportKey()
784 ALOGW("uid %d not permitted to act for uid %d in exportKey", callingUid, targetUid); in exportKey()
794 mKeyStore->getKeyForName(&keyBlob, name8, targetUid, TYPE_KEYMASTER_10); in exportKey()
819 uid_t targetUid = getEffectiveUid(uid); in begin() local
820 if (!is_granted_to(callingUid, targetUid)) { in begin()
821 ALOGW("uid %d not permitted to act for uid %d in begin", callingUid, targetUid); in begin()
837 mKeyStore->getKeyForName(&keyBlob, name8, targetUid, TYPE_KEYMASTER_10); in begin()
853 int32_t rc = upgradeKeyBlob(name, targetUid, in begin()
1185 uid_t KeyStoreService::getEffectiveUid(int32_t targetUid) { in getEffectiveUid() argument
1186 if (targetUid == UID_SELF) { in getEffectiveUid()
1189 return static_cast<uid_t>(targetUid); in getEffectiveUid()
1196 bool KeyStoreService::checkBinderPermission(perm_t permission, int32_t targetUid) { in checkBinderPermission() argument
1203 if (!is_granted_to(callingUid, getEffectiveUid(targetUid))) { in checkBinderPermission()
1204 ALOGW("uid %d not granted to act for %d", callingUid, targetUid); in checkBinderPermission()
1214 bool KeyStoreService::checkBinderPermissionSelfOrSystem(perm_t permission, int32_t targetUid) { in checkBinderPermissionSelfOrSystem() argument
1221 return getEffectiveUid(targetUid) == callingUid || callingUid == AID_SYSTEM; in checkBinderPermissionSelfOrSystem()
1231 bool KeyStoreService::checkBinderPermissionOrSelfTarget(perm_t permission, int32_t targetUid) { in checkBinderPermissionOrSelfTarget() argument
1233 if (getEffectiveUid(targetUid) == callingUid) { in checkBinderPermissionOrSelfTarget()
1236 return checkBinderPermission(permission, targetUid); in checkBinderPermissionOrSelfTarget()
1248 int32_t KeyStoreService::checkBinderPermissionAndKeystoreState(perm_t permission, int32_t targetUid, in checkBinderPermissionAndKeystoreState() argument
1250 if (!checkBinderPermission(permission, targetUid)) { in checkBinderPermissionAndKeystoreState()
1253 State state = mKeyStore->getState(get_user_id(getEffectiveUid(targetUid))); in checkBinderPermissionAndKeystoreState()