diff options
author | Max Bires <jbires@google.com> | 2019-03-25 22:19:02 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2019-03-25 22:19:02 -0700 |
commit | 400263683432e5eb2414bdc7824fdea46f529a1e (patch) | |
tree | b7f1b5486e6795d0cb1748af91c6e2f1eeb45879 | |
parent | fe8fb1fc2c1cda925a5712af23dd342fc8eddf5f (diff) | |
parent | 72a0ffe9c18ec043c3c7f168ec211d206cfa1bd2 (diff) | |
download | security-400263683432e5eb2414bdc7824fdea46f529a1e.tar.gz |
Merge "Adding thread safety to proto uploader"
am: 72a0ffe9c1
Change-Id: I3fbb545b17abea8cc5a11bbabbd224c573a25040
-rw-r--r-- | keystore/operation_proto_handler.cpp | 1 | ||||
-rw-r--r-- | keystore/operation_proto_handler.h | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/keystore/operation_proto_handler.cpp b/keystore/operation_proto_handler.cpp index 1833acb3..dfc06928 100644 --- a/keystore/operation_proto_handler.cpp +++ b/keystore/operation_proto_handler.cpp @@ -106,6 +106,7 @@ void checkOpCharacteristics(const hidl_vec<KeyParameter>& characteristics, } void OperationProtoHandler::uploadOpAsProto(Operation& op, bool wasOpSuccessful) { + std::lock_guard<std::mutex> lock(op_upload_mutex); OperationConfig operationConfig; determinePurpose(op.purpose, &operationConfig); checkKeyCharacteristics(op.characteristics.softwareEnforced, &operationConfig); diff --git a/keystore/operation_proto_handler.h b/keystore/operation_proto_handler.h index 838f3ec4..64d0a594 100644 --- a/keystore/operation_proto_handler.h +++ b/keystore/operation_proto_handler.h @@ -20,6 +20,7 @@ #include "operation_config.pb.h" #include "operation_struct.h" #include <chrono> +#include <mutex> #include <unordered_map> #include <vector> @@ -35,6 +36,7 @@ class OperationProtoHandler { private: std::unordered_map<std::string, int> protoMap; std::chrono::steady_clock::time_point start_time = std::chrono::steady_clock::now(); + std::mutex op_upload_mutex; }; } // namespace keystore |