Support and use TAG_ALLOW_WHILE_ON_BODY
There are three changes in this CL:
1. Persist all characteristics provided at the time of key creation.
We do this to avoid device-specific keymaster implementations
stripping keys they are not aware of.
2. Add an onDeviceOffBody API method that will be called whenever a
wearable device is detected to have been removed.
3. Check whether a key was created with TAG_ALLOW_WHILE_ON_BODY and
the device has gone off-body since the last auth event when
deciding whether it can be used.
BUG: 30701680
BUG: 28911985
Change-Id: I6be3af3dee8e576fe713dfdd726502d8b333f224
diff --git a/keystore/keystore.h b/keystore/keystore.h
index b15d00f..278a0a0 100644
--- a/keystore/keystore.h
+++ b/keystore/keystore.h
@@ -53,9 +53,11 @@
ResponseCode writeMasterKey(const android::String8& pw, uid_t userId);
ResponseCode readMasterKey(const android::String8& pw, uid_t userId);
- android::String8 getKeyName(const android::String8& keyName);
- android::String8 getKeyNameForUid(const android::String8& keyName, uid_t uid);
- android::String8 getKeyNameForUidWithDir(const android::String8& keyName, uid_t uid);
+ android::String8 getKeyName(const android::String8& keyName, const BlobType type);
+ android::String8 getKeyNameForUid(const android::String8& keyName, uid_t uid,
+ const BlobType type);
+ android::String8 getKeyNameForUidWithDir(const android::String8& keyName, uid_t uid,
+ const BlobType type);
/*
* Delete entries owned by userId. If keepUnencryptedEntries is true