summaryrefslogtreecommitdiff
path: root/keystore/include
diff options
context:
space:
mode:
authorJanis Danisevskis <jdanis@google.com>2017-06-07 18:03:31 -0700
committerJanis Danisevskis <jdanis@google.com>2017-06-23 14:01:54 -0700
commit6d449e8f4317b064c7868957b8ecc4472237d19e (patch)
treea3dcd529081b063fea222ea08f814ab988f98fa6 /keystore/include
parent0143be76b9c54df1333d12c0b5cc8cd8cedf47c3 (diff)
downloadsecurity-6d449e8f4317b064c7868957b8ecc4472237d19e.tar.gz
Refurbish granting mechanism
Keystore stores key blobs in with filenames that include the symbolic name and the uid of the owner. This behaviour should have been completely opaque to the user keystore. However, the granting mechanism, by which an app can allow another app to use one of its keys, leaked the internal structure in that the grantee had to specify the key name with the granter's uid prefix in order to use the granted key. This in turn collided with prefix handling in other parts of the framework. This patch refurbishes the granting mechanism such that keystore can choose a name for the grant. It uses the original symbolic key name as prefix and appends _KEYSTOREGRANT_<grant_no> where the grant_no is chosen as first free slot starting from 0. Each uid has its own grant_no space. This changes the grant call such that it now returns a string, which is the alias name of the newly created grant. The string is empty if the grant operation failed. As before apps can still mask granted keys by importing a key with the exact same name including the added suffix. But everybody deserves the right to shoot themselves in the foot if they really want to. Bug: 37264540 Bug: 62237038 Test: run cts-dev --module CtsDevicePolicyManagerTestCases --test com.android.cts.devicepolicy.DeviceOwnerTest#testKeyManagement because it grants a key Change-Id: I723c44c7ae6782c8de42063744717d088cd49ba1
Diffstat (limited to 'keystore/include')
-rw-r--r--keystore/include/keystore/IKeystoreService.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/keystore/include/keystore/IKeystoreService.h b/keystore/include/keystore/IKeystoreService.h
index 18bd8eb7..a0456796 100644
--- a/keystore/include/keystore/IKeystoreService.h
+++ b/keystore/include/keystore/IKeystoreService.h
@@ -166,8 +166,7 @@ class IKeystoreService : public IInterface {
virtual ::keystore::KeyStoreServiceReturnCode
get_pubkey(const String16& name, ::keystore::hidl_vec<uint8_t>* pubKey) = 0;
- virtual ::keystore::KeyStoreServiceReturnCode grant(const String16& name,
- int32_t granteeUid) = 0;
+ virtual String16 grant(const String16& name, int32_t granteeUid) = 0;
virtual ::keystore::KeyStoreServiceReturnCode ungrant(const String16& name,
int32_t granteeUid) = 0;