diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2019-03-26 05:07:50 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2019-03-26 05:07:50 +0000 |
commit | 72a0ffe9c18ec043c3c7f168ec211d206cfa1bd2 (patch) | |
tree | b7f1b5486e6795d0cb1748af91c6e2f1eeb45879 | |
parent | dece12434dced6ba4b1bf2759f34c48fdaa08d14 (diff) | |
parent | 772a8de356ed0aff805e2c3a6a435f6e0eb35c69 (diff) | |
download | security-72a0ffe9c18ec043c3c7f168ec211d206cfa1bd2.tar.gz |
Merge "Adding thread safety to proto uploader"android-q-preview-6android-q-preview-5android-q-preview-4android-q-preview-2.5
-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 |