summaryrefslogtreecommitdiffstats
path: root/android_keymaster
diff options
context:
space:
mode:
authorShawn Willden <swillden@google.com>2018-01-19 13:32:42 -0700
committerShawn Willden <swillden@google.com>2018-01-19 16:59:54 -0700
commit3c665a20c7a63fc601b5d21d8bf7a1b5567ffa6f (patch)
tree38ccab8c68ead9f3d2eeef014547e8060e67cbea /android_keymaster
parent7efc77216ead495bcfe4504be9040cb8a8b284ca (diff)
downloadandroid_system_keymaster-3c665a20c7a63fc601b5d21d8bf7a1b5567ffa6f.tar.gz
android_system_keymaster-3c665a20c7a63fc601b5d21d8bf7a1b5567ffa6f.tar.bz2
android_system_keymaster-3c665a20c7a63fc601b5d21d8bf7a1b5567ffa6f.zip
Add additional parameters to importWrappedKey
Bug: 31675676 Test: local unit tests and VtsHalKeymasterV4_0TargetTest Change-Id: Ia865b035604b3d42ab5b3de6f22b2fac8400ddbf
Diffstat (limited to 'android_keymaster')
-rw-r--r--android_keymaster/android_keymaster.cpp17
-rw-r--r--android_keymaster/android_keymaster_messages.cpp8
2 files changed, 21 insertions, 4 deletions
diff --git a/android_keymaster/android_keymaster.cpp b/android_keymaster/android_keymaster.cpp
index 395ffa5..bbcc011 100644
--- a/android_keymaster/android_keymaster.cpp
+++ b/android_keymaster/android_keymaster.cpp
@@ -486,10 +486,23 @@ void AndroidKeymaster::ImportWrappedKey(const ImportWrappedKeyRequest& request,
return;
}
+ int sid_idx = key_description.find(TAG_USER_SECURE_ID);
+ if (sid_idx != -1) {
+ uint8_t sids = key_description[sid_idx].long_integer;
+ if (!key_description.erase(sid_idx)) {
+ response->error = KM_ERROR_UNKNOWN_ERROR;
+ return;
+ }
+ if (sids & HW_AUTH_PASSWORD) {
+ key_description.push_back(TAG_USER_SECURE_ID, request.password_sid);
+ }
+ if (sids & HW_AUTH_FINGERPRINT) {
+ key_description.push_back(TAG_USER_SECURE_ID, request.biometric_sid);
+ }
+ }
+
keymaster_algorithm_t algorithm;
- key_description.GetTagValue(TAG_ALGORITHM, &algorithm);
KeyFactory* factory = 0;
-
if (!key_description.GetTagValue(TAG_ALGORITHM, &algorithm) ||
!(factory = context_->GetKeyFactory(algorithm))) {
response->error = KM_ERROR_UNSUPPORTED_ALGORITHM;
diff --git a/android_keymaster/android_keymaster_messages.cpp b/android_keymaster/android_keymaster_messages.cpp
index ac00a0b..dd5c8d3 100644
--- a/android_keymaster/android_keymaster_messages.cpp
+++ b/android_keymaster/android_keymaster_messages.cpp
@@ -642,14 +642,18 @@ uint8_t* ImportWrappedKeyRequest::Serialize(uint8_t* buf, const uint8_t* end) co
serialize_key_blob(wrapped_key, buf, end);
serialize_key_blob(wrapping_key, buf, end);
serialize_key_blob(masking_key, buf, end);
- return additional_params.Serialize(buf, end);
+ buf = additional_params.Serialize(buf, end);
+ buf = append_uint64_to_buf(buf, end, password_sid);
+ return append_uint64_to_buf(buf, end, biometric_sid);
}
bool ImportWrappedKeyRequest::Deserialize(const uint8_t** buf_ptr, const uint8_t* end) {
return deserialize_key_blob(&wrapped_key, buf_ptr, end) &&
deserialize_key_blob(&wrapping_key, buf_ptr, end) &&
deserialize_key_blob(&masking_key, buf_ptr, end) &&
- additional_params.Deserialize(buf_ptr, end);
+ additional_params.Deserialize(buf_ptr, end) &&
+ copy_uint64_from_buf(buf_ptr, end, &password_sid) &&
+ copy_uint64_from_buf(buf_ptr, end, &biometric_sid);
}
void ImportWrappedKeyRequest::SetWrappedMaterial(const void* key_material, size_t length) {