summaryrefslogtreecommitdiffstats
path: root/keymaster/3.0
diff options
context:
space:
mode:
authorJanis Danisevskis <jdanis@google.com>2018-11-09 07:51:56 -0800
committerJanis Danisevskis <jdanis@google.com>2018-11-09 10:49:55 -0800
commit9c41221206e0d57f702c5dd5eb1e133a21afb736 (patch)
tree84a1f8995d0396025065ce0575b82ac8122277f6 /keymaster/3.0
parentf1d854616ed20cdd0b33e7f393be398d55d08cc1 (diff)
downloadandroid_hardware_interfaces-9c41221206e0d57f702c5dd5eb1e133a21afb736.tar.gz
android_hardware_interfaces-9c41221206e0d57f702c5dd5eb1e133a21afb736.tar.bz2
android_hardware_interfaces-9c41221206e0d57f702c5dd5eb1e133a21afb736.zip
Removed unsafe use of hidl_vec<>.setToExternal
hidl_vec objects that do not own their associated buffer are highly unsafe in multithreaded environments where move semantic is used to transfer ownership between threads. With keystore transitioning to a multi threaded execution model we can no longer use this optimization safely. Bug: 111443219 Test: Ran full keystore cts test suite. Change-Id: I9a366fc7df5dfee508dc092855545963ef6d9665
Diffstat (limited to 'keymaster/3.0')
-rw-r--r--keymaster/3.0/vts/functional/authorization_set.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/keymaster/3.0/vts/functional/authorization_set.h b/keymaster/3.0/vts/functional/authorization_set.h
index 5f92d816a..60b00e432 100644
--- a/keymaster/3.0/vts/functional/authorization_set.h
+++ b/keymaster/3.0/vts/functional/authorization_set.h
@@ -201,7 +201,7 @@ class AuthorizationSet {
void push_back(TypedTag<TagType::BYTES, tag> ttag, const uint8_t* data, size_t data_length) {
hidl_vec<uint8_t> new_blob;
new_blob.setToExternal(const_cast<uint8_t*>(data), data_length);
- push_back(ttag, std::move(new_blob));
+ push_back(ttag, new_blob);
}
/**
@@ -225,8 +225,7 @@ class AuthorizationSet {
}
hidl_vec<KeyParameter> hidl_data() const {
- hidl_vec<KeyParameter> result;
- result.setToExternal(const_cast<KeyParameter*>(data()), size());
+ hidl_vec<KeyParameter> result(begin(), end());
return result;
}
@@ -252,7 +251,7 @@ class AuthorizationSetBuilder : public AuthorizationSet {
size_t data_length) {
hidl_vec<uint8_t> new_blob;
new_blob.setToExternal(const_cast<uint8_t*>(data), data_length);
- push_back(ttag, std::move(new_blob));
+ push_back(ttag, new_blob);
return *this;
}